2

I have a instance of django deployed in Heroku as follow, Procfile:

web: python manage.py collectstatic --noinput ; gunicorn MY_APP.wsgi --log-file -
worker: celery -A MY_APP worker
beat: celery -A MY_APP beat

This instance can receive 2000-4000 requests per minute, and sometimes it is too much.

I know I should change the communications... but can I change something in the configuration to get a 10-30% in the server efficiency?

Goin
  • 3,856
  • 26
  • 44
  • 1
    When you say "requests", you mean http requests? These are all requests for django, or do they include requests for static files? Do many of these requests result in a celery task, and how heavy are these celery tasks? – Antonis Christofides Oct 23 '16 at 10:04
  • Yes, http requests. These http requests are without static files, because the django server is an API with django rest framework. And very few requests result in a celery task (1% - 5%). Thanks – Goin Oct 23 '16 at 10:10

2 Answers2

2

The first thing that springs to mind is to check out connection pooling and/or persistent database connections. Depending on how much database access your app is using, this could significantly increase the number of RPM your app is able to handle.

Check out this StackOverflow question for some good ideas, in particular the following answers:

Community
  • 1
  • 1
Rob Gwynn-Jones
  • 677
  • 1
  • 4
  • 14
1

The whole point of Heroku is that you can dynamically scale your app. You can spin up new web workers with heroku ps:scale web+1 for example.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • Yes, of course. I know it :-) But I don't know if I can configure better the server too. Do you know a better configuration? – Goin Oct 17 '16 at 11:27