Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poisson Distribution request rate #2

Open
6 tasks
twood02 opened this issue Jun 1, 2022 · 0 comments
Open
6 tasks

Poisson Distribution request rate #2

twood02 opened this issue Jun 1, 2022 · 0 comments
Labels
enhancement New feature or request js javascript related coding

Comments

@twood02
Copy link
Member

twood02 commented Jun 1, 2022

Loadtest generates requests with a Uniform Distribution arrival pattern, meaning there is the same fixed interval between each new request sent to the server. That isn't very realistic.

Many natural phenomenon, whether it be people going to the grocery store or meteors flying through the sky, follow what is known as a Poisson Arrival pattern. Here is an article describing what this means:
https://towardsdatascience.com/the-poisson-distribution-and-poisson-process-explained-4e2cb17d459

In practice, we can simulate a Poisson process by generating inter-arrival times that are Exponential Random numbers with mean = 1/R where R is the request rate we want to send. There are libraries which can help you generate Exponential Random numbers.

So if we want a realistic arrival process with an average rate of 10 req/sec, we should generate a sequence of inter arrival times by generating exponential random numbers each with mean 1/10 = 0.1. On average, this will still give us 10 request per second, but instead of them all having the exact same 0.1 second gap between each one, they will be randomly distributed with periods of no load and then a burst of requests with short gaps.

Todo:

  • Learn about poisson arrival process
  • Learn how to generate exponentially distributed random numbers. You can do this in a simple javascript test script, not the real loadtest code. Your script should take a target RPS value and then determine a list of interval times as exponential random values
  • Use your script to produce 10000 exponential random values and then make a histogram of them. Discuss with @twood02 about how this will produce a different type of load than the normal fixed interval
  • Modify the loadtest code so that it will use exponential random values for the sleep period between each request instead of a fixed value
  • Measure the performance of a website with the original loadtest versus this modified version. When the RPS value is the same, which version will have better performance?
  • Make it so that loadtest can be configured to use either a fixed rate or a Poisson rate as a command line argument or configuration file variable
@twood02 twood02 added enhancement New feature or request js javascript related coding labels Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request js javascript related coding
Projects
None yet
Development

No branches or pull requests

1 participant