5

The werkzeug documentation states that it can only be used for development rather than production. If you want to be equipped with a production environment it is recommended to use nginx, apache + uwsgi, etc.

  1. So what happens if the production environment uses werkzeug?
  2. Not recomended use in production because it performance poor?
  3. If it performance poor, but I see werkzeug originally also supports multi-threaded multi-process, why it performance poor?
  4. What difference between werkzeug and NGINX in performance and why ?
1
  • 1. You can use it in production but it will perform poorly. 2. That is what the documentation says: "It was designed especially for development purposes and performs poorly under high load." 3 (and incidentally 4). If software isn't designed to do something, then asking why it doesn't do it invites the snotty answer because it wasn't designed to do it. It's a bit like asking why SUVs can't climb trees. If you want to ask the developers why they made those design decisions then maybe SO isn't the best place to ask.
    – BoarGules
    Commented May 3, 2018 at 10:42

1 Answer 1

6

TL;DR : writing a robust, fast and scalable HTTP server is far from trivial and requires much more than "support(ing) multi-threaded multi-process".

What the documentation states is that you shouldn't use the development server in production:

The development server is not intended to be used on production systems. It was designed especially for development purposes and performs poorly under high load.

This doesn't prevent you from building your app on werkzeug (hopefully), you just want to use a production-ready HTTP server for deployment.

As to the why, it's clearly stated above: this development server has not been designed to perform correctly under load but to be a practical development tool. Correctly handling load is a quite complex problem, and that's why there are dedicated HTTP servers like nginx, apache etc - almost all of them coded in C - with attention to stability and performance. So what will happen if you try to use werkzeug's development server in production is that it will become extremely slow under load, to the point your site will be downright unusable. You may also have memory use issues (which can potentially just kill your server) and also security issues - two other points that are difficult to get right and better left to a dedicated, debugged and optimized HTTP server.

Not the answer you're looking for? Browse other questions tagged or ask your own question.