Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy are Python webservers unstable?
    primarykey
    data
    text
    <p>I'm developing an HTTP server based game in Python. The plan is to have as few dependencies as possible, so I wanted it to work without installing a standalone webserver (like Apache, Lighttpd or nginx). The problem is, it doesn't work.</p> <p>I tried the following versions:</p> <ul> <li>BaseHTTPServer.HTTPServer (+SocketServer.ThreadingMixIn)</li> <li>wsgiref.simple_server</li> <li>twisted.web.server</li> </ul> <p>When put under heavy load (<code>siege -b -c 100 -t 30s</code>), they all partially failed with either</p> <p><code>[error] socket: read error Connection reset by peer sock.c:460: Connection reset by peer</code></p> <p>or</p> <p><code>[error] socket: -1313092800 address is unavailable.: Cannot assign requested address</code></p> <p>By partially I mean: some requests were served, some not.</p> <p>On the other hand, when I tried Lighttpd + Flask (i.e. WSGI) or even Lighttpd + PHP (just as a control case), it works absolutely fine. Availability 100%, Concurrency 100%.</p> <p>Because of the latter working versions, I suppose the problem is not <code>siege</code>, or running <code>siege</code> and the server on the same machine, or the machine itself (Ubuntu 12.04 by the way).</p> <p>NOTE: in all cases I tested simple "hello world" servers to minimize the possiblity of bugs.</p> <p>So my two question:</p> <ol> <li><em>Why</em> are Python webservers unstable? (What exactly is the <em>cause</em>, not the solution?)</li> <li>Is using a standalone webserver + Python the only/best solution (if I stick to Python), or am I missing something?</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload