In production, Apache + mod_wsgi or Nginx + mod_wsgi?

前端 未结 4 937
灰色年华
灰色年华 2020-12-07 11:05

What to use for a medium to large python WSGI application, Apache + mod_wsgi or Nginx + mod_wsgi?

Which combination will need more memory and CPU time?
Whi

4条回答
  •  旧巷少年郎
    2020-12-07 11:23

    The main difference is that nginx is built to handle large numbers of connections in a much smaller memory space. This makes it very well suited for apps that are doing comet like connections that can have many idle open connections. This also gives it quite a smaller memory foot print.

    From a raw performance perspective, nginx is faster, but not so much faster that I would include that as a determining factor.

    Apache has the advantage in the area of modules available, and the fact that it is pretty much standard. Any web host you go with will have it installed, and most techs are going to be very familiar with it.

    Also, if you use mod_wsgi, it is your wsgi server so you don't even need cherrypy.

    Other than that, the best advice I can give is try setting up your app under both and do some benchmarking, since no matter what any one tells you, your mileage may vary.

提交回复
热议问题