Question

I am playing with Heroku to test how good it is for Django apps.

I created a simple project with two actions:

  1. return simple hello world
  2. generate image and send it as response

I used siege -c10 -t30s to test both Django dev server and gunicorn (both running on Heroku). These are my results:

Simple hello world
- django dev

Lifting the server siege...      done.
Transactions:                376 hits
Availability:             100.00 %
Elapsed time:              29.75 secs
Data transferred:           0.00 MB
Response time:              0.29 secs
Transaction rate:          12.64 trans/sec
Throughput:             0.00 MB/sec
Concurrency:                3.65
Successful transactions:         376
Failed transactions:               0
Longest transaction:            0.50
Shortest transaction:           0.26

- gunicorn

Lifting the server siege...      done.
Transactions:                357 hits
Availability:             100.00 %
Elapsed time:              29.27 secs
Data transferred:           0.00 MB
Response time:              0.27 secs
Transaction rate:          12.20 trans/sec
Throughput:             0.00 MB/sec
Concurrency:                3.34
Successful transactions:         357
Failed transactions:               0
Longest transaction:            0.34
Shortest transaction:           0.26

generating images
- django dev

Lifting the server siege...      done.
Transactions:                144 hits
Availability:             100.00 %
Elapsed time:              29.91 secs
Data transferred:           0.15 MB
Response time:              1.52 secs
Transaction rate:           4.81 trans/sec
Throughput:             0.01 MB/sec
Concurrency:                7.32
Successful transactions:         144
Failed transactions:               0
Longest transaction:            4.14
Shortest transaction:           1.13

- gunicorn

Lifting the server siege...      done.
Transactions:                 31 hits
Availability:             100.00 %
Elapsed time:              29.42 secs
Data transferred:           0.05 MB
Response time:              7.39 secs
Transaction rate:           1.05 trans/sec
Throughput:             0.00 MB/sec
Concurrency:                7.78
Successful transactions:          31
Failed transactions:               0
Longest transaction:            9.13
Shortest transaction:           1.19

I used
- Django 1.4
- Gunicorn 0.14.6
- venv

Why is gunicorn so slow?

//UPDATE
Both tests were running in Heroku envirenment dev server means standard django server - it can be ran by python manage.py runserver it is described here.

Was it helpful?

Solution

Are settings the same? Django 1.4 dev server is multithreaded by default and there is only 1 sync worker in gunicorn default config.

OTHER TIPS

You're going to have to set up application profiling to gain some insight into where exactly the problem is located.

Maybe the speed of your Internet connection is a bottleneck? Downloading data from Heroku is obviously slower than moving it through localhost (I assume django dev server is run at localhost). This may explain why benchmarks with small responses (hellowords) are equally fast and the benchmarks with large responses (images) are slow for Heroku.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top