4
$\begingroup$

Suppose I have a process that works as follows:

  • collect all outstanding requests
  • process all of them, which takes time
  • commit all results in one transaction
  • repeat

I get a data point (start, duration) from each cycle:

00:00: 1h, 01:00: 1h, 02:00: 2h30m, 04:30: 2h, 06:30: 1h, 07:30: 1h

Below is the best I've come up with so far, boxes ;-)

It shows a "slow" batch @2:00 where:

  • all users had to wait, 2h30min for their results
  • this "sloweness" lasted just as long, 2h30min

enter image description here

I this visualisation good? Is there a canonical visualisation for time spent in queue?

How can I show multiple similar processes on same plot, e.g. requests from Germany (own process), France (-"-), UK (-"-)?

$\endgroup$
4
  • 1
    $\begingroup$ Could you provide - possibly made-up - data sample of such data that can be used as example? $\endgroup$
    – Tim
    Commented Jan 20, 2016 at 11:31
  • $\begingroup$ edited, included data for the plot. $\endgroup$
    – user101275
    Commented Jan 20, 2016 at 11:37
  • $\begingroup$ Are the "wait time" and elapsed "wall time" always the same? If so, it seems odd to put totally redundant information on two axes. Also, is the wait time at 00:59 really 1 hour? At that point, you only need to wait 1 minute until the next phase. $\endgroup$ Commented Jan 20, 2016 at 11:43
  • $\begingroup$ They are same for this process (unless it fails, or is not ran at all); They would be different for e.g. a pipeline. The reason for axes if for viewer being able to grasp that at 5AM queue was 2 hours long $\endgroup$
    – user101275
    Commented Jan 20, 2016 at 11:47

1 Answer 1

2
$\begingroup$

I'm sure that many plots could be beneficial. One of my favourites is to plot the waiting times against the arrival times. It can be quite diagnostic of what is happening.

For example, let's say my customers start reneging away from my service. I would expect to see the waiting times cap. Note that other effects could lead to capping, but it is a good start.

import ciw
import matplotlib.pyplot as plt
import pandas as pd

ciw.seed(2018)

N = ciw.create_network(
    arrival_distributions=[ciw.dists.Exponential(5)],
    service_distributions=[ciw.dists.Exponential(2)],
    number_of_servers=[1],
    reneging_time_distributions=[ciw.dists.Deterministic(5)]
)


Q = ciw.Simulation(N)
Q.simulate_until_max_time(30)
df = pd.DataFrame(
    Q.get_all_records()
    )

plt.scatter(df.arrival_date, df.waiting_time)
plt.xlabel('Arrival Time')
plt.ylabel('Waiting Time')
plt.show()

enter image description here

The same process without the reneging would just show the waiting times getting longer:

import ciw
import matplotlib.pyplot as plt
import pandas as pd

ciw.seed(2018)

N = ciw.create_network(
    arrival_distributions=[ciw.dists.Exponential(5)],
    service_distributions=[ciw.dists.Exponential(2)],
    number_of_servers=[1],
)


Q = ciw.Simulation(N)
Q.simulate_until_max_time(30)
df = pd.DataFrame(
    Q.get_all_records()
    )

plt.scatter(df.arrival_date, df.waiting_time)
plt.xlabel('Arrival Time')
plt.ylabel('Waiting Time')
plt.show()

enter image description here

Or maybe I am only 'just' meeting demand on average, leading to some random walk behaviour:

import ciw
import matplotlib.pyplot as plt
import pandas as pd

ciw.seed(2018)

N = ciw.create_network(
    arrival_distributions=[ciw.dists.Exponential(5)],
    service_distributions=[ciw.dists.Exponential(5)],
    number_of_servers=[1],
)


Q = ciw.Simulation(N)
Q.simulate_until_max_time(30)
df = pd.DataFrame(
    Q.get_all_records()
    )

plt.scatter(df.arrival_date, df.waiting_time)
plt.xlabel('Arrival Time')
plt.ylabel('Waiting Time')
plt.show()

enter image description here

Or maybe we've got substantially more supply than demand. Some customer don't even need to wait!

import ciw
import matplotlib.pyplot as plt
import pandas as pd

ciw.seed(2018)

N = ciw.create_network(
    arrival_distributions=[ciw.dists.Exponential(5)],
    service_distributions=[ciw.dists.Exponential(10)],
    number_of_servers=[1],
)


Q = ciw.Simulation(N)
Q.simulate_until_max_time(30)
df = pd.DataFrame(
    Q.get_all_records()
    )

plt.scatter(df.arrival_date, df.waiting_time)
plt.xlabel('Arrival Time')
plt.ylabel('Waiting Time')
plt.show()

enter image description here

To be clear, I'm not saying these plots are the end-all-be-all. They're just helpful in diagnosing system behaviour (in conjunction with other tools).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.