You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 10:42:01 UTC
svn commit: r1132104 -
/incubator/mesos/trunk/src/webui/bottle-0.8.3/bottle.py
Author: benh
Date: Sun Jun 5 08:42:00 2011
New Revision: 1132104
URL: http://svn.apache.org/viewvc?rev=1132104&view=rev
Log:
Fixes a performance problem in the default web server used by Bottle
(Python's built-in WSGI BaseHTTPServer). This server tries to perform a
reverse DNS lookup on each client by default in order to log its
hostname. This is really slow in environments where the reverse lookup
fails, causing the web server as a whole to pause for a long time. This
fix makes the server use the client's IP address instead.
Modified:
incubator/mesos/trunk/src/webui/bottle-0.8.3/bottle.py
Modified: incubator/mesos/trunk/src/webui/bottle-0.8.3/bottle.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/bottle-0.8.3/bottle.py?rev=1132104&r1=1132103&r2=1132104&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/bottle-0.8.3/bottle.py (original)
+++ incubator/mesos/trunk/src/webui/bottle-0.8.3/bottle.py Sun Jun 5 08:42:00 2011
@@ -1261,10 +1261,17 @@ class FlupFCGIServer(ServerAdapter):
class WSGIRefServer(ServerAdapter):
def run(self, handler): # pragma: no cover
from wsgiref.simple_server import make_server, WSGIRequestHandler
+ # A WSGI request handler that does not perform a reverse DNS lookup
+ # for each request in order to run faster than the default version.
+ # Instead, it returns the client's IP address right away.
+ class NoReverseDnsHandler(WSGIRequestHandler):
+ def address_string(self): return self.client_address[0]
if self.quiet:
- class QuietHandler(WSGIRequestHandler):
+ class QuietHandler(NoReverseDnsHandler):
def log_request(*args, **kw): pass
self.options['handler_class'] = QuietHandler
+ else:
+ self.options['handler_class'] = NoReverseDnsHandler
srv = make_server(self.host, self.port, handler, **self.options)
srv.serve_forever()