Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Droopy is slow due to a DNS lookup bug in python's module BaseHTTPServer #10

Open
asmwarrior opened this issue Jul 18, 2016 · 2 comments

Comments

@asmwarrior
Copy link

asmwarrior commented Jul 18, 2016

For a 1M size file, it takes about many seconds(about 20 seconds) to upload. A larger file is also much longer, so my question is: is it possible to make it a bit faster? Thanks.

BTW: I'm using it under a 100M speed intranet.

@asmwarrior
Copy link
Author

OK, problem solved, this is due to a bug under python's BaseHTTPServer class. It just use a name lookup for the client address, and the lookup takes a lot of time. I found this in this page: Slow Python HTTP server on localhost - Stack Overflow, also see the related page in XMLRPC Server Slow in Python – How to Fix - Answer My Searches. For a LAN user, we don't need such DNS lookup.

For me, I just add some code like this in droopy's source code(put the below text before the line "import cgi" in the droopy's source code, which is around line 78)

# 2016-08-16 It looks like we find the slow reason
# see here: Slow Python HTTP server on localhost - Stack Overflow - http://stackoverflow.com/questions/2617615/slow-python-http-server-on-localhost
# also see the related page in one answer:
# XMLRPC Server Slow in Python – How to Fix - Answer My Searches - http://www.answermysearches.com/xmlrpc-server-slow-in-python-how-to-fix/2140/
# since we are using BaseHTTPServer, then we can use the fix in the above link

#new code
# import BaseHTTPServer # this is already imported, so just use the imported name httpserver
def not_insane_address_string(self):
    host, port = self.client_address[:2]
    return '%s (no getfqdn)' % host #used to call: socket.getfqdn(host)
httpserver.BaseHTTPRequestHandler.address_string = \
    not_insane_address_string
#end new code

@asmwarrior asmwarrior changed the title Is it possible to make it a bit faster when upload a file Droopy is slow due to a DNS lookup bug in python's module BaseHTTPServer Aug 16, 2016
@asmwarrior
Copy link
Author

I think droopy should have a fix for this issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant