Search code examples
database-designarchitecturescalabilitysystem-design

What will happen if I don't scale my application or database servers and I increase the load?


I understand horizontal scaling, vertical scaling, sharding, I want to gain more understanding on what will happen to the application i.e the effects of not scaling over how I can solve the problem by scaling.

Here are my doubts,

  1. What are all the possible things that can happen to the application if I don't scale. For example, the application will slow down, the requests won't get served, or the application will go down.
  2. Let's say the system will slow down on increasing the load, why does that happen? If the requests don't get served why does that happen? Do threads come into the picture?
  3. If threads come into the picture, how does it do so?

Solution

  • Generally, all requests have a timeout, these timeouts occur at most layer boundaries (Browser->HTTP server, HTTP Server -> Application Server / Microservices layer, Application -> Database). When your load increases to the point where some layer cannot service the request before that timeout occurs, the user will not get a response, and the application will be broken

    Depending on where the timeout occurs, you may send a useful error, or it could be a generic "hang" where the application appears to be frozen or broken in some way.

    If enough requests are awaiting servicing, and you have turned up all the timeouts to an unreasonably high level, you may allow more and more threads to queue. These threads use memory, and ultimately you will run out of memory and be unable to create additional threads, at which point the application will once again hang and become unresponsive.