Thursday, March 28, 2013

Nginx upload module vs Flask

Env

Ubuntu 12.04 32bit
Nginx 1.1.19 (HTTP server)

Flask 0.9 (light python framework)
Gevent: 1.0rc2 (coroutine I/O)
Gunicorn 0.17.2 (WSGI server)

Nginx setting

Nginx listen to port 8666
serves requests to URL /upload
and also work as a reverse proxy to Flask which serve requests on port 8222

Server code

server application run in 5 worker mode with Gunicorn + Gevent
gunicorn -k gevent -b 0.0.0.0:8222 -w 5 t:app


Test code

start N threads, and upload file to the URL




Result


Performance test result:
Unit: seconds
file size: 3.3 MB
concurrent number
Flask 0.9 + gevent 1.0rc2 + gunicorn 0.17.2 + Nginx
(5 worker processes)
Nginx + Nginx upload module
50
6.029
2.328
100
12.788
4.995
200
28.828
10.813


As we expected, Nginx upload module which written in C, is about twice faster than pure python code while processing file uploading.


7 comments:


  1. Thanks for your extraordinary blog. Your idea for this was so brilliant. This would provide people with an excellent tally resource from someone who has experienced such issues. You would be coming at the subject from a different angle and people would appreciate your honesty and frankness. Good luck for your next blog!
    Tally ERP 9 Training
    tally classes
    Tally Training institute in Chennai
    Tally course in Chennai

    ReplyDelete

  2. That's great about what you have expressed in this clear cut blog in sense of SEO , and yes this would make a wonderful blog. Here's a lot of technical and educational information plotted as in your writings, it was more understandable and easy to read.
    Sounds like something people would want to read this blog really!keep writing…

    seo training classes
    seo training course
    seo training institute in chennai
    seo training institutes
    seo courses in chennai
    seo institutes in chennai
    seo classes in chennai
    seo training center in chennai

    ReplyDelete
  3. Nice blog, it’s so knowledgeable, informative, and good looking site. I appreciate your hard work. Good job. Thank you for this wonderful sharing with us. Keep Sharing.
    Digital Marketing Course In Kolkata
    Web Design Course In Kolkata

    ReplyDelete