Skip to content

Instantly share code, notes, and snippets.

@shone1991
shone1991 / littles_law.md
Created January 26, 2024 19:17 — forked from vinhnglx/littles_law.md
Little's law

How many instances do you need?

There's a theoretical tool we can use, the number of instances must obey Little's Law. The definition from Wikipedia is so hard to understand. So, basically, we just need to know the formula

Number of application instances = Average number of requests per second (requests/second) * Average response time (second)

Application Instances, its job is process a single request dependently and send it back to client. When using Puma in threaded mode, application instance is the entire Puma process, when using MRI, JRuby,each thread counts as an application instance. When using Unicorn, Puma (clustered) or Passenger, your application instance is each worker process.