8 ms·
SI Units for Request Rate (2024)
- hirsin 6mo agoIs there some obvious reason not to measure requests per minute rather than second? Or is it an offhand joke? Some systems I've worked on had APIs that averaged less than one per second, but I don't think we want to be measuring in millibecquerels. Some have measured on millions of requests per hour, because the hourly usage was a key quantity, as rate limits were hourly as well.
- WaxProlix 6mo agoIn my experience, rate limits are more often per second. It's easy to talk about kilo or mega-units, so this isn't as big an issue as the awkwardness of talking about very very low volume services. Maybe those (generally) inherently don't care about rates as much?
- spockz 6mo agoIn my perception there is a difference between 1req/s as a rate limit, and 60/min. The difference has to do with bucketing. If we agree that the rate limit is 1/s, I expect to be able to exactly that and sometimes 2 within the same second. However, if we agree on 60/min, then it should be fine to spend all 60 in the first second of a minute, or averaged out, or some other distribution. This also helps with the question I always get when discussing rate limits “but what about bursts?”. 60/min already conveyed you are okay to receive bursts of 60 at once, in contrast to with 1/s. In my experience it is exactly the low rate service that care about rate limits as they are the most likely to break under higher load. Services that already handle 100k req/s typically don’t sweat it with a couple extra once in a while.
- atoav 6mo agoAn effective rate limiting system has multiple bases in my experience, depending on what the goal is. But I usually implement the configuration as a list where you can define how much requests are allow maximum per how many units of time. E.g. to prevent fast bursts you limit it to 1 request per 1 second, but to avoid someone sending out 86400 requests a day you also cap them at 100 per 86400 seconds (24 hours) and 1000 per 3600 seconds (1 hour). Whichever limit they hit first will stop it. That isn't hard to implement if you know how to deal with arrays and it allows long term abuse, while still along fast retries if something went wrong.
- spockz 6mo agoExactly, you still will want to agree on multiple rate limit bases, precisely because they are different.
- stackghost 6mo ago>Is there some obvious reason not to measure requests per minute rather than second? It's much less obtuse to say something like "average req/min" or whatever, but then again you can't write a cool blog post about misusing an SI unit for radioactivity and shoving it into a nonsensical context.
- rswail 6mo agoIf you're looking at SI units, the base unit for time is the second. SI multipliers are all powers of 10, not 60, so minutes and hours are not really compliant.
- scbrg 6mo agoI guess there's a difference between talking about how many requests a system is capable of handling, and how many they actually get. At least when i encountered the discussion initially (some thirty years ago) I'd say we usually talked about how many requests the system was capable of handling. Then requests per second was the obvious unit since a request usually took less than a second to process (obviously depending on the system and so on - but mostly), so using that unit often gave a fairly low, comprehensible number. Was it ten? A hundred (very impressive)? Perhaps even a thousand (very, very impressive!)? Multiply those numbers by 60, and there's suddenly a lot more mental gymnastics involved. By 3600 and you're well into "all big numbers look the same" land.
- avmich 6mo agoCan we talk - or assume, or understand - about "average frequencies" of requests and still use Hz as units?
- curtisf 6mo agoSure. A reasonable model for incoming requests within a short window of time is as a "Poisson process", which means the expected number of incoming requests within any interval is proportional to the length of that interval. The parameter of that distribution is the expected (aka average) rate. If the intervals are time intervals, then the proper units of the parameter are events/second
- ozim 6mo agoNo because everyone expects Hz to be as explained in TFA. It is much more useful as a unit if 4Hz is 250ms event.
- fph 6mo agoAs the OP discusses, the current state of the standard formally disallows it: the SI specifies that hertzes are only to be used for periodic phenomena, and becquerels only for radioactivity.
- Ekaros 6mo agoHertz is fixed frequency. Say you poll x times in second with set intervals. It is not measurement of discreet events say packet arriving. Probably best just to leave hertz out unless it is something that is actually fixed rate. So just leave it unitless.
- hasley 6mo agoIf you define frequency as the derivative of the phase with respect to time, then you also have an instantaneous frequency which (at least formally) also has Hz as unit - even though it does not necessarily describe some real periodicity. To measure discrete events, I would prefer as unit "events per second" instead of Hz.
- bjoli 6mo agoHah! I wrote a unit converter for Android recently and that is one of the criticism I get. "Why does my conversion end up in becquerel?" It is usually because people forgot to divide by time, where they write something like "(31l/m2)/1min in mm" when they should have have written something like "(31l/m2)/1min in mm/h". Anyway, check it out here: https://github.com/bjoli/Umits https://github.com/bjoli/Umits I am about 6 days away from publishing and open beta (currently in mandatory closed testing). If you want to join the closed test, you can do so by mailing me at the email at the top of the readme.
- bananaflag 6mo agoI think your interface is a bit inconsistent, this is why people ask that question. If you have 65mi in 12mi/h -> 19500s then instead of 12h in s -> 43200s you should have 12h in s -> 43200 Then a unit at the end should mean that not all dimensions have been reduced. In the same vein, in the README, the "weird results" section should come after the "dimension removal" section. The way it is now, the apparent "bug" comes before the feature.
- bjoli 6mo agoYou are right about this being confusing. I have thought about whether to adopt in as strict division or whether to be strict about in UNIT to have to produce UNIT. The first one will not resolve the issue of Umits selecting becquerel or Hz to represent N/s, but the second is not as much fun.
- bananaflag 6mo agoI think the behaviour is good as it is, it is just the output display that should be consistent (as I suggested in my example).
- bjoli 6mo agoYes. But treating in a strict division isn't really what people expect. Then 12mi/h in km/h becomes "19.3xyz" not "19.3xyz km/h". The least surprising thing would be to enforce unit output. If I say I want "in km/h" the output should be in km/h or show an error. It is however less fun. Getting becquerel when you forget a unit along the way is the kind of spice that makes life fun. Treating "in" as strict division also doesnt solve the surprise of getting Bq or Hz when you accidentally end up with something that is N/s
- nofriend 6mo agoThe hertz is formally defined as 1/s, except this leaves open the question of 1 what each second. I've seen it argued that since the numerator is unitless, and radians are also unitless, that the hertz as defined refers to one radian per second, and that it should have instead been defined as rev/s. While this argument might be specious, it suggests to us that even if our numerator is unitless, we should still be clear about what kind of thing we are describing rates of. So say "requests per second" if that is what you are talking about, and things will be clearer for everyone.
- pants2 6mo agoIs a "count" not a valid unit?
- orangesilk 6mo ago"count" is an incomplete type, the same as "array" is an incomplete type. "count of fruit" would be a complete type, compare to "Array of int64". SI leaves this underspecified, which causes confusion with dimensionless units.
- nlitened 6mo ago> "count" is an incomplete type, the same as "array" is an incomplete type. "count of fruit" would be a complete type, compare to "Array of int64". Javascript has arrays of unspecified types, and count of items of such arrays. I don’t think your analogy holds
- pants2 6mo agoPerhaps the SI system needs generics :)
- deleted 6mo ago[deleted]
- nvader 6mo agoSo something that is entirely revolving once a second is spinning at 2 * pi Hertz? Hertz just thinking about it.
- murkt 6mo ago> writing “90 kBq” is a lot more convenient than “ninety thousand requests per second” and “90,000 requests/s” I once made a joke during the talk that MongoDB is better than Postgres in two ways, and one of those ways is that it’s faster to say “Mongo” than “Post-gres-Qu-eL”. Same vibe here. 90krps is not that longer than 90kBq. With requests per minute, rpm: engine in my car revs up to 9000 requests per minute! It’s sometimes funny to see some marketing posts like “we built our infrastructure to handle UNREAL load during the event, 100 million of requests during the day.” Which is just a bit more than 1100 rps.
- childintime 6mo agoxps or x/s would be the better unit, no? Reads like transactions per second. Or as times per second. Or as just anything per second ;) 1100x/s. 1100xps.
- murkt 6mo agoWhen I see rps in development context, I immediately know it is requests per second. x/s on the other hand… 3x/s. kx/s looks like a physics formula to me. Some spring action? K is for coefficient, x is displacement.
- vasco 6mo agoI really had a hard time figuring out if the post is satire. Mackerels per second would be funnier though, if were making shit up.
- Sesse__ 6mo agoMostly, people who do “requests per day” have a lot lower load than 1100 requests/sec, too… it's a typical red flag for having a team that know a lot less about performance than they think.
- murkt 6mo agoFrankly, that usually comes from orgs that deal with the real world. 50k generic requests per day is nothing. 50k orders per day for a small e-commerce company can be pretty overwhelming. It’s becoming laughable when people use it to boast about microservices or something :)
- blablabla123 6mo agoPhysicist here: usually bin size is adjusted to change the interval over which you average. Also rpm is the unit if you want to pin it down to a single number If writing rpm is too long, there's also a trick: write "requests/rpm:" That means: requests measured in rpm. Thus afterwards you can write single numbers which is even shorter
- blackhaz 6mo agoFor me the word becquerel itself requires some additional brain power points to write. Is it bequerel or becquerel? Do we capitalize it or not? Not when written, but Bq is capitalized, so it's indeed kBq. But then again, is it per second? No, the unit, has per second in it already... And we not need to confuse it with B for byte. I thoroughly enjoyed the article but there's no need to complicate the world further. rps is perfectly fine.
- throw_await 6mo agoFun Fact: your salary comes in a very regular Intervall, son you can convert dollars per year to $Hz. 100k$/year is around 3µHz$.
- Sesse__ 6mo agoThat sounds too low; 3 m$Hz would probably be right, but 3 µ$Hz is very little.
- maxnoe 6mo agoYes, the year has pi * 1e7 seconds 1e5 / 3.14e7 ≈ 3e-3, milli, not micro
- throw_await 6mo agoYou're right of course.
- cyberrock 6mo agoHas anyone ever run Fourier analysis on their request rate and found something interesting? Bonus points if it's not a day/night or weekday/weekend thing.
- kqr 6mo agoI actually did that recently, but only at low sample rate so I don't qualify for bonus points. (My purpose was filtering to get at underlying patterns. Found what I expected but not much more.)
- mytailorisrich 6mo ago"writing “90 kBq” is a lot more convenient than “ninety thousand requests per second” and “90,000 requests/s”" Not sure if article is serious or tongue-in-cheek, but no this isn't more convenient because it is more difficult to understand. "requests/s" is best because it is the clearest, most unambiguous, and easiest to understand instantly. SI factors can be used on the number if needed (90k instead of 90,000)
- maxnoe 6mo agoPlease don't. The authority on the definition of SI units is very clear: > The hertz shall only be used for periodic phenomena and the becquerel shall only be used for stochastic processes in activity referred to a radionuclide Neither is usually the case for requests. https://www.bipm.org/documents/d/guest/si-brochure-9-en-pdf https://www.bipm.org/documents/d/guest/si-brochure-9-en-pdf
- HansHamster 6mo agoClearly, we should place a radioactive source, a Geiger counter, and a computer in a sealed box. Every time the counter registers a decay, the computer performs a HTTP GET. Thus, we end up with Schrödinger's webserver...
- mattkrause 6mo agoThere’s an even stronger reason not to given in the same document: "The special names becquerel, gray and sievert were specifically introduced because of the dangers to human health that might arise from mistakes involving the units reciprocal second… "
- tuetuopay 6mo agoWell the SI unit for request rate is … requests/s. Just like speed is m/s and not something bespoke. However when the infra is crumbling under requests (one could say decaying), then becquerel seems appropriate
- bofadeez 6mo agoAnd what if something goes from rest to light speed every second to average 1 m/s over the second. Is that the same thing as smooth 1 m/s?
- v9v 6mo agoFor it to be an SI unit, shouldn't you be able to express it in terms of the 7 SI base units?
- tuetuopay 6mo agoThe requests would be a dimension-less quantity. There are a few examples of what those are and how they fit in: - The frames in frames per second are dimensionless, thus the SI unit for FPS is frames/s. When the frames are periodic, such as monitor refresh rates are, the unit is Hz. - Percentages are dimensionless quantities too, produced by divinding two quantities of the same dimension (ie unit). CPU%? That’s "busy second per second", which is dimensionless, and expressed as a percentage. A dimensionless quantities don’t have any physical backing reality in terms of the, well, dimension in which you could measure it. Time, space, mass, etc. Fun fact: angles are dimensionless! Both degrees and radians are just shorthands as divisions of the unit circle.
- saltcured 6mo agoThink of those as event counts in an arrival process, then think of the events as impacts or strikes, and eventually you can come to the unit of countable Hurts. These counts have implicit measurement windows since they are aperiodic. Rather than Hs representing "counts per second" akin to Hz being "cycles per second", I think we should combine it with an explicit window annotation. So 100 Hs/1s is the same rate as 6000 Hs/60s but with one second versus one minute counting interval.
- gempir 6mo agoI think this is mostly to blame on Grafana. Every dashboard ships with $__interval by default and every query uses that by default. I never understood the value of that. It makes the graphs look pretty I guess, but looking at the values becomes a little less useful because nothing is compareable to another not even to yesterday when you last looked at the dashboard. Personally I always setup a variable $interval that can be set to 1m, 5m, 15m etc and use that in all my queries.
- JSR_FDED 6mo agoThe problem with becquerel is that it makes me think of bechamel which makes me think of lasagna. Now I have to remove drool from the keyboard. Thanks for nothing, OP!
- DaveFlater 6mo agoSI avoids identifying countable entities and events except in special cases like bequerel. This is but one example among many where the needs of IT are outside the scope that SI serves. https://www.researchgate.net/publication/339954122_Quantities_and_Units_for_Software_Product_Measurements https://www.researchgate.net/publication/339954122_Quantitie...
- M3Henry 6mo agoThanks, I'm converted. I also think that there are other silly units: mAh -> C kWh -> J kg -> gv
- peterabbitcook 6mo agomAh has always seemed silly to me as well. I get that the actual voltage of a battery is a function of battery charge %, load current, temperature and “other stuff”, but the battery designer/manufacturer knows all this… Why not just tell us how much energy is in it {,k,M}Wh or {,k,M}J?
- dang 6mo agoRelated. Others? SI Units for Request Rate - https://news.ycombinator.com/item?id=39219573 https://news.ycombinator.com/item?id=39219573 - Feb 2024 (93 comments)
- jryb 6mo agoI think it would be helpful to reframe this as a statistical problem, and not as an issue with units. Estimating some measure of central tendency and variance (mean and 95% CI maybe? I'm not familiar with time series statistics) would not only make it clear that there's uncertainty in the number, but it would handle the issue with picking a window size - smaller windows would increase the uncertainty.