Bangku Sisi Jendela

Tampak sosok lelaki bertubuh agak gelap duduk menghadap ke arah jendela. Sesekali mengaduk sendok pada jusnya. Sesekali pun mengecek handphone untuk menantikan kabar. Posisi yang benar-benar…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to handle Database Overloading Attacks caused by 404 URLs?

If you are someone working on scale project applications that must handle millions of queries, a 404 request is something you can’t ignore. This is something that can take the entire system to crash in a matter of seconds.

Consider a case where someone tries to overload your database by simply doing HTTP/HTTPS calls of a non-existing URL. Every time request is sent to the database to fetch the information about that URL resulting in a 404.

To handle such a scenario one of the approaches we can take is to use CACHE for all existing URLs the application has.

Server-side caching is typically done to keep unchanged data or data that changes least frequently in the cache to reduce system load and minimize expensive database reads. We can use the server-side CACHE like Redis or Memcache to store all the existing URLs from the database.

Let’s assume we maintain a cache of all existing URLs in the cache. This cache gets updated either whenever a new URL is added to the database or based on an interval.

Whenever a request is received to the application, the application will first do a lookup in the cache for the requested URL, if the cache is missed it means the URL doesn’t exist and the application will return a bad request without executing further saving DB calls.

As shown above, here a valid user requested a URL and the application checks in the cache, if the record is found in the cache then the application will execute further and will return a valid 200 response.

In case anyone tries to overload the application with 404 URLs, the application will not find those keys in the cache and the application will raise an exception for bad requests immediately. This will help in saving lots of computing operations including DB calls and applications will have the bandwidth to serve more requests.

Add a comment

Related posts:

Their war is over and we lost

The hashwar is over. The ABC team took the lead and rightfully obtain the Bitcoin Cash name. The nice guys won. The exchanges resumed their BCH trading and everything is back to normal… well… the war…

7 African Superstitions You Should Know About

Africans were into African Traditional Religion which had their attendant beliefs before the advent of Christianity which many of them adopted but some of them still held onto the worship of their…

Best Practices for Digital Copywriting

The practice of producing language that convinces people to do specific actions, such as purchasing goods, is known as copywriting. This is essential for all companies and agencies. Copywriting is an…