Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

#3481 closed defect (fixed)

Tracd HTTP response is very slow in windows between PCs.

Reported by: JoneyWu@… Owned by: Christian Boos
Priority: high Milestone: 0.10.1
Component: web frontend/tracd Version: 0.9.6
Severity: normal Keywords: slow network
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When I installed the trac in standalone way, I found it is very slow to response to browser. But this case only appear in connection from another PC. It means if I access the trac in the local machine, the speed is normal (about 0.0x seconds). I have traced the Trac code and found that: it is fine with good speed in handling the request but stuck in "send_response" step. This situation will add extra 12 seconds cost to response to the browser. Maybe is the IO/Network issue?

e.g. from my trac log— "19:45:49 Trac[standalone] DEBUG: Total request time: 12.032000 s"

Attachments (0)

Change History (10)

comment:1 by Christian Boos, 18 years ago

Milestone: 0.9.7
Resolution: worksforme
Status: newclosed

The standard python HTTPServer used by TracStandalone will log each client request. While doing this, it tries to resolve the client's numerical IP address to a fully qualified name. You probably don't have a DNS server correctly setup in your environment, hence the slow down.

So either fix that (preferred solution) or, if it's not an option, apply the following patch (hack):

Index: trac/web/standalone.py
===================================================================
--- trac/web/standalone.py	(revision 3387)
+++ trac/web/standalone.py	(working copy)
@@ -249,6 +249,16 @@
         self.wfile = None
         self.rfile = None
 
+    def address_string(self):
+        """Return the client address formatted for logging.
+
+        This version doesn't look up the full hostname using
+        gethostbyaddr() ...
+        """
+
+        host, port = self.client_address[:2]
+        return host
+
     def do_POST(self):
         self._do_trac_req()
 

(patch on stable, something similar could be done on trunk; the method is added to the TracHTTPRequestHandler class)

comment:2 by caoyanlong@…, 18 years ago

Resolution: worksforme
Status: closedreopened

Trac 0.10 release has same issue.

env:

os: windows 2003 & sp1 python: 2.4.3 standalone mode, tracd -s -d -a…

Browse it in local host will be very quick as my old trac 0.9.5. But it will very very slow from another PC in 100M LAN. It costs >60s!

comment:3 by anonymous, 18 years ago

In version 0.10, the following patch does the trick to disable dns reverse lookups (against trac/web/wsgi.py):

—- orig/wsgi.py 2006-11-06 10:36:11.991122600 -0700 +++ wsgi.py 2006-11-06 10:35:16.820306900 -0700 @@ -121,6 +121,9 @@

class WSGIRequestHandler(BaseHTTPRequestHandler):

+ def address_string(self): + host, port = self.client_address[:2] + return host

def setup_environ(self):

self.raw_requestline = self.rfile.readline()

comment:4 by caoyanlong@…, 18 years ago

Resolution: fixed
Status: reopenedclosed

thanks a lot. It is ok!

comment:5 by Emmanuel Blot, 18 years ago

Resolution: fixed
Status: closedreopened

comment:6 by Emmanuel Blot, 18 years ago

Resolution: worksforme
Status: reopenedclosed

(no change committed to the Trac base code)

in reply to:  6 comment:7 by Christopher Lenz, 18 years ago

Milestone: 0.10.1
Resolution: worksforme
Status: closedreopened

Replying to eblot:

(no change committed to the Trac base code)

… meaning this issue is still open!

comment:8 by Christopher Lenz, 18 years ago

Oops, I missed Christians response to this :-P

In any case, I think we should disable reverse lookups in tracd to get rid of this problem. I don't see any value in reverse lookups and pretty much every web server I know has them disabled by default. Plus, tracd is meant for being run either for development, or behind a HTTP proxy.

comment:9 by Christian Boos, 18 years ago

Owner: changed from all to Christian Boos
Status: reopenednew

Well, I'm all for disabling reverse lookups there, choose your patch ;)

comment:10 by Christopher Lenz, 18 years ago

Resolution: fixed
Status: newclosed

Fixed in [4161].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.