4 ms·
Okay, then let's do a bakeoff! You outfit a Python webserver that only uses threads, and I'll outfit an identical webserver that also implements async. Server t
by willseth 6y ago
Okay, then let's do a bakeoff! You outfit a Python webserver that only uses threads, and I'll outfit an identical webserver that also implements async. Server that handling the most requests/sec wins. I get to pick the workload.
- js2 6y agoFWIW, I have a real world Python3 application that does the following: - receives an HTTP POST multipart/form-data that contains three file parts. The first part is JSON. - parses the form. - parses the JSON. - depending upon the JSON accepts/rejects the POST. - for accepted POSTs, writes the three parts as three separate files to S3. It runs behind nginx + uwsgi, using the Falcon framework. For parsing the form I use streaming-form-data which is cython accelerated. (Falcon is also cython accelerated.) I tested various deployment options. cpython, pypy, threads, gevent. Concurrency was more important than latency (within reason). I ended up with the best performance (measured as highest RPS while remaining within tolerable latency) using cpython+gevent. It's been a while since I benchmarked and I'm typing this up from memory, so I don't have any numbers to add to this comment.