When creating Simple Web Analytics I tried to be able to scale from the beginning. Coming from the Python world one thing I hear a lot is “The database is the bottleneck”. But for that specific use case that turned out to not be true. Apparently, my application code seemed not to weight in into how many requests per second the server can handle so much. And in the end I had to switch to go to be able to accomplish what I find acceptable results.
Let me explain and compare numbers. With a hello world flask application and gunicorn I can get 3343.95 trans/sec. Trying an asynchronous (gevent.pywsgi) based wsgi to http adapter did not help, here the numbers are something like 1003.65 trans/sec. Now let’s throw golang into the comparison. Before boring you too much I will do an really completely unfair comparison and jump straight to this number 8765.15 trans/sec. That is also including the whole application code. And now just for completeness here is my unperfect measurement of what a simple hello world in golang can do: 12465.77 trans/sec.
In conclusion for my specific use case – doing optimized queries on a redis database – the bottleneck is clearly handling the http requests and not the application code. I wonder what exactly takes so long (in comparison with the application code). Is it parsing HTTP, is it handling the sockets, is it something else? Id’ like to know!
暂无评论内容