Standard Parallelization Models

Generators and simulation environments included under base_models focus on the modelling of JSQ(d), Redundancy-d and Threshold-d routing schemes based on queue size.

parallelqueue.base_models.JSQd(parallelism, seed, d, Arrival, AArgs, Service, SArgs, Monitors=[<class 'parallelqueue.monitors.TimeQueueSize'>], r=None, maxTime=None, doPrint=False, infiniteJobs=True, numberJobs=0)

A queueing system wherein a Router chooses the smallest queue of d sampled (identical) queues to join for each arriving job.

Parameters
  • maxTime – If set, becomes the maximum allotted time for this simulation.

  • numberJobs – Max number of jobs if infiniteJobs is False. Will be ignored if infiniteJobs is True.

  • parallelism – Number of queues in parallel.

  • seed – Random number generation seed.

  • r – Threshold. Should be set to an integer, defaulting to None otherwise.

  • infiniteJobs – If true, there will be no upper limit for the number of jobs generated.

  • d – Number of queues to parse.

  • doPrint – If true, each event will trigger a statement to be printed.

  • Arrival – A kwarg specifying the arrival distribution to use (a function).

  • AArgs – parameters needed by the function.

  • Service – A kwarg specifying the service distribution to use (a function).

  • SArgs – parameters needed by the function.

  • Monitors – List of monitors which overrides the methods of monitors.Monitor

class parallelqueue.base_models.ParallelQueueSystem(parallelism, seed, d, r=None, maxTime=None, doPrint=False, infiniteJobs=True, Replicas=True, numberJobs=0, network=<class 'parallelqueue.network.Network'>, **kwargs)

A queueing system wherein a Router chooses the smallest queue of d sampled (identical) queues to join, potentially replicating itself before enqueueing. For the sampled queues with sizes less than r, the job and/or its clones will join while awaiting service. After completing service, each job and its replicas are disposed of.

Parameters
  • maxTime – If set, becomes the maximum allotted time for this simulation.

  • numberJobs – Max number of jobs if infiniteJobs is False. Will override infiniteJobs if infiniteJobs is True.

  • parallelism – Number of queues in parallel.

  • seed – Random number generation seed.

  • r – Threshold. Should be set to an integer, defaulting to None otherwise.

  • infiniteJobs – If true, there will be no upper limit for the number of jobs generated.

  • df – Whether or not a pandas.DataFrame of the queue sizes over time should be returned.

  • d – Number of queues to parse.

  • doPrint – If true, each event will trigger a statement to be printed.

  • Arrival – A kwarg specifying the arrival distribution to use (a function).

  • AArgs – parameters needed by the function.

  • Service – A kwarg specifying the service distribution to use (a function).

  • SArgs – parameters needed by the function.

  • Monitors – Any monitor which overrides the methods of monitors.Monitor

  • Network – Network class which defines the structure of the system.

Example

# Specifies a SimPy environment consisting
# of a Redundancy-2 queueing system and a Poisson arrival process.
sim = ParallelQueueSystem(maxTime=100.0,
    parallelism=100, seed=1234, d=2, Replicas=True,
    Arrival=random.expovariate, AArgs=0.5,
    Service=random.expovariate, SArgs=1)
sim.RunSim()

References

Heavy Traffic Analysis of the Mean Response Time for Load Balancing Policies in the Mean Field Regime

Tim Hellemans, Benny Van Houdt (2020) https://arxiv.org/abs/2004.00876

Redundancy-d:The Power of d Choices for Redundancy

Kristen Gardner, Mor Harchol-Balter, Alan Scheller-Wolf, Mark Velednitsky, Samuel Zbarsky (2017) https://doi.org/10.1287/opre.2016.1582

property DataFrame

If TimeQueueSize was a monitor, returns a dataframe of queue sizes over time.

property MonitorOutput

The data acquired by the monitors as observed during the simulation.

RunSim()

Runs the simulation.

parallelqueue.base_models.RedundancyQueueSystem(parallelism, seed, d, Arrival, AArgs, Service, SArgs, Monitors=[<class 'parallelqueue.monitors.TimeQueueSize'>], r=None, maxTime=None, doPrint=False, infiniteJobs=True, numberJobs=0)

A queueing system wherein a Router chooses the smallest queue of d sampled (identical) queues to join, potentially replicating itself before enqueueing. For the sampled queues with sizes less than r, the job and/or its clones will join while awaiting service. After completing service, each job and its replicas are disposed of.

Parameters
  • maxTime – If set, becomes the maximum allotted time for this simulation.

  • numberJobs – Max number of jobs if infiniteJobs is False. Will be ignored if infiniteJobs is True.

  • parallelism – Number of queues in parallel.

  • seed – Random number generation seed.

  • r – Threshold. Should be set to an integer, defaulting to None otherwise.

  • infiniteJobs – If true, there will be no upper limit for the number of jobs generated.

  • d – Number of queues to parse.

  • doPrint – If true, each event will trigger a statement to be printed.

  • Arrival – A kwarg specifying the arrival distribution to use (a function).

  • AArgs – parameters needed by the function.

  • Service – A kwarg specifying the service distribution to use (a function).

  • SArgs – parameters needed by the function.

  • Monitors – List of monitors which overrides the methods of monitors.Monitor

Example

# Specifies a SimPy environment consisting
# of a Redundancy-2 queueing system and a Poisson arrival process.
sim = RedundancyQueueSystem(maxTime=100.0,
    parallelism=100, seed=1234, d=2,
    Arrival=random.expovariate, AArgs=0.5,
    Service=random.expovariate, SArgs=1)
sim.RunSim()