Domanda

Sto giocando con Heroku per testare quanto sia buono per le app Django.

Ho creato un semplice progetto con due azioni:

    .
  1. Return Semplice Hello World
  2. Genera immagine e invialo come risposta
  3. Ho usato siege -c10 -t30s per testare sia Django Dev Server che Gunicorn (sia in esecuzione su Heroku).Questi sono i miei risultati:

    Semplice 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
    
    .

    Generazione di immagini
    - 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
    
    .

    Ho usato
    - Django 1.4
    - Gunicorn 0.14.6
    - VENV

    Perché Gunicorn è così lento?

    // Aggiorna
    Entrambi i test erano in esecuzione nell'ambiente Heroku Dev Server significa server Django standard - Può essere eseguito da python manage.py runserver è descritto qui . .

È stato utile?

Soluzione

sono le impostazioni uguali?Django 1.4 Dev Server è multithreading per impostazione predefinita e c'è solo 1 operaio di sincronizzazione nella configurazione predefinita di Gunicorn.

Altri suggerimenti

dovrai configurare Profiling dell'applicazione per ottenere qualche intuizione indove si trova esattamente il problema.

Forse la velocità della tua connessione Internet è un collo di bottiglia?Il download dei dati da Heroku è ovviamente più lento che spostarlo attraverso localhost (assumere Django Dev Server è eseguito su localhost).Questo potrebbe spiegare perché i benchmark con piccole risposte (hellowords) sono ugualmente veloci e i benchmark con risposte di grandi dimensioni (immagini) sono lente per Heroku.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top