1

SI Units for Request Rate

 7 months ago
source link: https://two-wrongs.com/si-units-for-request-rate
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

SI Units for Request Rate

by kqr, published 2024-01-31

Request rate is the number of requests that arrive, or are serviced, or leave, during some period.

It’s surprisingly common for people to speak of a request rate without specifying what the length of the period is. I have even seen dashboards that don’t have a fixed period for the metrics query – the request rate becomes measured per whatever aggregation interval the dashboard deems appropriate for the window size at the time. If you zoom out, you get a higher request rate. If you move the window to a high-resolution screen, you get a lower request rate.

We should specify the period length in the query to the metrics database, so everyone sees the same request rate regardless of how many pixels their dashboard occupies at the time.

The good period length to use is the second. Request rates should be measured as the number of requests per second.11 I have met some people who measure requests per minute. Don’t be those people. This sounds like it would have an si unit, i.e. we should be able to say something like “our request rate is 57 metres per second.” Except obviously not metres per second.


Turns out there are two si units that both could fit:

  • The hertz, or Hz, is the si unit of frequency. It is defined as one event per second.
  • The becquerel, or Bq, is the si unit of (radio)activity. It is also defined as one event per second.

Why are there two units for the same thing? A physicist that hears that an event occurs at 4 Hz will assume that there is one event exactly every 250 milliseconds. The hertz unit is strongly associated with periodic behaviour. Radioactive decay is not that well behaved, and will happen only on average with the given frequency. A sample that decays at 4 Bq may decay zero times one second, and then 9 times the next.22 Assuming a Poisson distribution, these will be rare events, but if you look at the sample for an hour, you have a better than 50 % chance of observing that exact sequence of decays.

It makes sense then that we would say the request rate is 500 Hz when we talk about highly regular load testing, where one request is issued consistently every 2 ms. But if it’s about organic traffic that happens to arrive at an average of 500 times per second, then maybe saying 500 Bq is more appropriate.


Except! It seems that – in contrast to the hertz which is a general unit – the becquerel is meant to be specifically about radioactive decay. There’s no si unit for arbitrary events that happen on average with a certain frequency. I will keep using the becquerel for request rates, and I hope that 50 years from now, we will have forgotten the silly mistake of thinking it was only about nuclear decay.


Try it in a sentence. I promise you no kittens will die from it.

Yesterday, two-wrongs.com had a daily average request rate of 0.06 Bq.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK