<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>sulam</author><text>There&amp;#x27;s a fixed memory solution that doesn&amp;#x27;t suffer from the boundary condition that allows you to double the rate. It&amp;#x27;s pretty straightforward, so I&amp;#x27;ll describe it in prose, since it&amp;#x27;s 6am and I&amp;#x27;d rather not get the code wrong. :)&lt;p&gt;The approach uses a ring buffer. If you&amp;#x27;re not familiar with them, they are a fix-sized array or linked list that you iterate through monotonically, wrapping around to the beginning when you are at the limit. Our ring buffer will hold timestamps and should be initialized to hold 0&amp;#x27;s -- ensuring that only someone with a time machine could be rate limited before they send any requests. The size of the buffer is the rate limit&amp;#x27;s value, expressed in whatever time unit you find convenient.&lt;p&gt;As each request comes in, you fetch the value from the buffer at the current position and compare it to current time. If the value from the buffer is more than the current time minus the rate limit interval you&amp;#x27;re using, then you return a 420 to the client and are done. If not, their request is ok and you should serve it normally, but first you store the current time stamp in the buffer and then advance the counter&amp;#x2F;index.</text><parent_chain></parent_chain></comment><story><title>An Alternative Approach to Rate Limiting</title><url>https://medium.com/figma-design/an-alternative-approach-to-rate-limiting-f8a06cf7c94c</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>irgeek</author><text>&lt;i&gt;In response, we implemented a shadow ban: On the surface, the attackers continued to receive a 200 HTTP response code, but behind the scenes we simply stopped sending document invitations after they exceeded the rate limit.&lt;/i&gt;&lt;p&gt;And right there they broke the service for legitimate users. Totally unacceptable collateral damage IMHO.</text><parent_chain></parent_chain></comment><story><title>An Alternative Approach to Rate Limiting</title><url>https://medium.com/figma-design/an-alternative-approach-to-rate-limiting-f8a06cf7c94c</url></story>