Score:0

Rate limit not working as expected on nginx

in flag

I have request rate limit set as:

20 r/m
burst=4 delay=2

My expectation is that 1 request will be handled every 3 seconds. For any bursts, upto 4 requests (beyond the rate [1 per 3 seconds]) will be queued, of which 2 will be immediately handled and 2 will be handled such that it satisfies 1 req every 3 seconds.

I am testing using synchronous requests, by adding a delay of 3500ms after every 2 requests, followed by repeat of the same; I am seeing the following results:

Request1 (latency 250ms)

Delay 250ms
Request2 (latency 250ms)

Delay 3500ms
Request3 (latency 250ms)

Delay 250ms
Request4 (latency 250ms)

Delay 3500ms
Request5 (latency 250ms)

Delay 250ms
Request6 (latency 1000ms)

Delay 3500ms
Request7 (latency 2250ms)

Delay 250ms
Request8 (latency 250ms)

Delay 3500ms
Request9 (latency 2250ms)

Delay 250ms
Request10 (latency 250ms)

Delay 3500ms
Request11 (latency 2250ms)

Why do requests 6, 7, 9, 11 have the longer latency?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.