4
$\begingroup$

Suppose you're working on infrastructure for web service and you're tasked with determining the probability distribution of concurrent requests to your services.

In example, suppose the first request arrives at 6:05:00 am with a duration of two seconds (until 6:05:02), the second arrives at 6:05:01 am with a duration of one second (6:05:02) and the third arrives at 6:05:03 with a duration of three seconds (6:05:06.) Of these three requests, only two were concurrent (the first two.)

Suppose you have two distributions, first, when requests arrive over time and second, the length of requests. (Perhaps arrivals are uniformly distributed throughout the day and durations are distributed as lognormal.)

In a real world, if total concurrent requests exceed some threshold, one of the following would result: 1/ request dropped (0 duration), 2/ requests added to a queue (increased duration if queue time is counted), new infrastructure spin-up (increased duration to only the requests arriving duration spin-up time.)

However, to simplify the problem, suppose that computational resources are limitless and none of the above three scenarios would be realized.

How would you go about deriving the probability distribution over concurrent requests given the distributions presented (request arrivals and request durations.)

$\endgroup$
2
  • 1
    $\begingroup$ Empirical estimation is not an option? You could simply draw random points in time, compute the number of concurrent connections and then make a histogram over the number of concurrent connections. $\endgroup$
    – Ggjj11
    Commented Oct 11, 2023 at 20:37
  • $\begingroup$ What is the copula between p(arrival) and p(duration)? It is not clear what the joint probability distribution p(arrival, duration would be) $\endgroup$
    – Ggjj11
    Commented Oct 12, 2023 at 11:19

1 Answer 1

1
$\begingroup$

The probability that the next call becomes concurrent is $$P[A<D]$$ where $A$ is the time between call arrivals and $D$ is the duration of calls.

Similarly, the cdf for the lengths of concurrent calls is $$F(x)=\frac{P[x<D-A\ |\ A<D]}{P[A<D]}$$

For the example in the post, these probabilities might not have closed-form expressions.

A similar example with a closed-form expression is where $A$ is distributed exponentially with rate $\lambda$ and $D$ is distributed as $\max(0,N(\mu,\sigma))$. Then

$$P[A<D]=1-P[\lambda \sigma^2<D]\exp(-\lambda\mu + \lambda^2\sigma^2/2).$$

$\endgroup$
8
  • $\begingroup$ For the CDF, if x=3, the CDF should give us the proportion of all requests that are less than or equal to 3 seconds. $\endgroup$
    – jbuddy_13
    Commented Oct 10, 2023 at 14:06
  • $\begingroup$ P[A<D] should give us the probability that the time between adjacent requests is less than the duration of requests. So suppose P[A<D] = 0.0, we know that there’s an 80% chance that any two requests are concurrent. (Correct?) $\endgroup$
    – jbuddy_13
    Commented Oct 10, 2023 at 14:08
  • $\begingroup$ The biggest question we have is the number of concurrent requests, which might be exponentially distributed. It would be very useful if we could compute P[C>x]. If we determined that P[C>5]=0.05 then we’re 95% sure that there are 5 or fewer concurrent requests. $\endgroup$
    – jbuddy_13
    Commented Oct 10, 2023 at 14:11
  • $\begingroup$ However I’m not sure if this is tractable from the inputs I’ve described. $\endgroup$
    – jbuddy_13
    Commented Oct 10, 2023 at 14:12
  • $\begingroup$ The question asked for the probability distribution of concurrent requests, which is given by the CDF $F$ in the question. The proportion of all requests less than or equal to 3 seconds is $F_D(3)$, given the CDF $F_D$ for $D$. $\endgroup$
    – user225256
    Commented Oct 10, 2023 at 18:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.