Bjoern: Benchmark versus uwsgi

Created on 18 Apr 2014  Â·  22Comments  Â·  Source: jonashaag/bjoern

How is bjoern performing comparing to uwsgi?
Both of them are written in C.
What are the differences?

Most helpful comment

Server performance really is negligible. 95% of the time is spent in the Python interpreter/"your Python code". You may save a few milliseconds, maybe reducing response time from 200ms to 195ms.

You shouldn't make a decision based on benchmarks and performance details. What really matters is: How well does it integrate into your stack? How easy is it to set up and maintain? How reliable is it? How difficult is it to fix a bug if you really need to? What's the code quality? How's the community? etc etc

I think where bjoern really shines is

  • zero-configuration, very easy to get a basic setup running
  • doesn't eat up loads of your memory
  • embeddable
  • small, simple code base that's not too difficult to understand

I'm not saying you shouldn't use it for production. It's just that most of the time you have a an existing setup and you must integrate your WSGI application somehow. In the case of nginx, uWSGI offers many more features with regards to integration. But maybe you don't need these at all, then you're fine with bjoern too :)

All 22 comments

Should be a tiny little bit faster. uwsgi is nice if you want easy integration with all sorts of things. bjoern is really just a standalone, barebones WSGI server.

@jonashaag Do you have time to conduct a benchmark?

Server performance really is negligible. 95% of the time is spent in the Python interpreter/"your Python code". You may save a few milliseconds, maybe reducing response time from 200ms to 195ms.

You shouldn't make a decision based on benchmarks and performance details. What really matters is: How well does it integrate into your stack? How easy is it to set up and maintain? How reliable is it? How difficult is it to fix a bug if you really need to? What's the code quality? How's the community? etc etc

I think where bjoern really shines is

  • zero-configuration, very easy to get a basic setup running
  • doesn't eat up loads of your memory
  • embeddable
  • small, simple code base that's not too difficult to understand

I'm not saying you shouldn't use it for production. It's just that most of the time you have a an existing setup and you must integrate your WSGI application somehow. In the case of nginx, uWSGI offers many more features with regards to integration. But maybe you don't need these at all, then you're fine with bjoern too :)

I run a small python-bottle based app for my home alarm system. The web server runs in a single process and thread. Some time ago I benchmarked all 17 of the servers which bottle supports natively and found bjoern to be significantly the best performing. After disabling logging, meinheld was similar (<1%) but those 2 were way better than all the others. I recently tested it under uwsgi which came a clear third but still about 25% slower than bjoern (for my app).

@bulletmark what did the benchmark look like? Of course web server performance weighs more if you benchmark Hello World applications. But I'd say that as soon as you do stuff that involves database access or other I/O then it's negligible.

@jonashaag It isn't if you are processing high volume of requests which is why WSGI servers should be blazingly fast.

My benchmark was just a simple "ab -n400" against my tiny raspberry pi bottle app which returns a html page of my home alarm status and history. True, the data just gets fetched from internal values and lists. I just did it again: bjoern = 134 requests/sec, meinheld = 132, uwsgi = 100, cherrypy = 79, python wsgiref = 62. But heck, it's easy to benchmark so I may as well choose the fastest server.

Here some benchmarks fore reference: http://benchmarks.codeart.io

@paulocheque Very nice. But why did you benchmark with only one worker?

Yes, only one.
ps: I will add some contact screen so everyone can send suggestions for improvements

@paulocheque Yeh but why did you benchmark with only one worker?

yes

To be honest, these results don't look very reliable. Did you use multiple runs? (At least 10 per configuration)

Plus what @thedrow said, you should probably include benchmarks for 1, 2, 4, … workers.

Thanks for the feedback. It was in the page that the "trials" in the TODO list. Thanks for the feedback!
Just for one toolset I tested with multiple workers. I also need to automate this! Thanks again!

I ran again the tests with 50k requests with multiple runs (2 per config). I made some adjustments but I will always try to improve the tests! Thanks for the feedbacks and be free to always send more suggestions! Best,

@saitam1 that is an old analysis to be suddenly posting here. Bjoern does not support Python 3 so is largely irrelevant now.

@bulletmark New release with Python 3 support out now :)

@jonashaag Thanks for the heads up. I have changed my Python 3 app to use Bjoern. Seems to be working fine. Will let you know how it stands up over time.

I read somewhere that we should configure Bjoern to use multi core, any idea on how / some wiki reference / anything ?
What is the recommended setup for Bjoern ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexted picture alexted  Â·  12Comments

saley89 picture saley89  Â·  34Comments

avloss picture avloss  Â·  3Comments

voroninman picture voroninman  Â·  5Comments

ryanisnan picture ryanisnan  Â·  11Comments