Home > Blockchain >  Django: Horizontal scaling with a single database
Django: Horizontal scaling with a single database

Time:05-06

I have a single django instance about to hit its limits in terms of throughput. Id like to make a second instance and start scaling horizontally.

I understand when dealing with database read replicas there is some minimal django configuration necessary, but in the instance of only using a single database: is there anything I need to do, or anything I should be careful of when adding a second instance?

For the record, I use render.com (it’s similar to heroku) and their scaling solution just gives us a slider and will automatically move an instance up or down. Is there any sort of configuration I need to do with django gunicorn uvicorn? It will automatically sit behind their load balancer as well.

For reference my stack is:

  • Django DRF
  • Postgres
  • Redis for cache and broker
  • Django-q for async
  • Cloudflare

CodePudding user response:

You can enable autoscaling on Render and it will automatically scale your instances up (and down) based on your application's average CPU and/or memory utilization across all instances. You do not need to change your Django app.

  • Related