Last week I created a python webserver as a patch for make talos-remote. This ended up being frought with performance issues, so I have started looking into it. I based it off of the profileserver.py that we have in mozilla-central, and while it worked I was finding my tp4 tests were timing out.
I come to find out we are using a synchronous webserver, so this is easy to fix with a ThreadingMixIn, just like the chromium perf.py script:
class MyThreadedWebServer(ThreadingMixIn, BaseHTTPServer.HTTPServer): pass
Now the test was finishing, but very very slowly (20+ minutes vs ❤ minutes). After doing a CTRL+C on the webserver, I saw a lot of requests hanging on log_message and gethostbyaddr() calls. So I ended up overloading the log_message call and things worked.
class MozRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): # I found on my local network that calls to this were timing out def address_string(self): return "a.b.c.d" # This produces a LOT of noise def log_message(self, format, *args): pass
Now tp4m runs as fast as using apache on my host machine.