How to make app ready for scalability?

Most apps are built to fail – meaning that you develop an app with half-heartedly and not architect it well to make it scalable. Ask yourself, did you make an app to fail? The problem with success is scalability. If you can’t scale, you are bound to fail.

1. Divide Everything

I have a list of following things which you can divide. If you have more, please put that in comments:

  1. Multiple users can have separate database assigned.
  2. Credential are authenticated by a separate service.
  3. Outsource the background jobs to a different server.
  4. Have multiple queues.
  5. Have at least two masters.

2. Isolate and backup every service.

Putting small services on their own small servers can help you prevent a death from hardware failure. Consider an email sending service, you can easily have two or three service provider and if one is down, immediately switch to the second one. Similarly, if your backups are relying on one slave, make it work with the other one if it gets down.

3. Don’t just switch, resurrect the services.

We had three geolocation services on three separate servers. One day, none of them were working. In the log, we found that two were crashed weeks ago because of RAM usage as one of our developers used a nasty bulk check for 20M records. It only needed a service start command. So ensuring that it remains started can actually solve “fools’ development problem”

4. Proxy is new God

There are a lot of proxy solutions for every kind of services, place them ahead of everything you are running. These proxies serve two purposes:

  1. Switching the services when dead!
  2. Limiting the number of connections

Proxies have their own pool of connections and hence, despite you are hitting database by creating 200 connections, if it is going through a proxy service, it will be as low as 20. Some of the proxy solutions we have used:

5. Monitoring Services

We are a big fan of Prometheus and Grafana. While Prometheus exporters export different data, Grafana can be used to see it beautifully and send the alert.

6. (Bonus) – Attitude

Every app must be developed with a TDD/BDD approach and attempts must be made to tune everything you have. It is far better to run an optimized query than to throw a hardware on a database. The attitude of your development team matters most. So, the first step of scalability is in fact, make sure you hire the Good and fire the Bad.

Worth Sharing?


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>