Slow startup?

Jo Vermeulen jo at lumumba.luc.ac.be
Thu Apr 14 19:34:38 BST 2005


Op 14-apr-05 om 19:53 heeft Jo Vermeulen het volgende geschreven:
> So it is wise to limit the use of socket.getfqdn or maybe try to  
> preprocess it (make it a member?). Hopefully this information is  
> useful.

It seems on our (Ubuntu Linux) server this code is less slow (equally  
fast as socket.gehostname()):

$ time python hostname.py
real    0m0.179s
user    0m0.121s
sys     0m0.028s

$ time python fqdn.py
real    0m0.174s
user    0m0.120s
sys     0m0.035s

Which is quite weird. This is btw a fairly old system (P-II 233 MHz).

On my system:

$ time python hostname.py
real    0m0.111s
user    0m0.030s
sys     0m0.040s

$ time python fqdn.py
real    0m1.373s
user    0m0.050s
sys     0m0.040s

Maybe on local systems the socket.getfqdn() method has to do a lot of  
work to find out the fully qualified domain name, and eventually just  
defaults to socket.gethostname() (at least on my system it does).
And on server systems, it seems like it immediately finds the fqdn, and  
returns.

I found someone mentioning socket.getfqdn() slowness:

http://jtauber.com/blog/2005/01/11/ 
more_on_lost_cgi_environment_variables_in_python_2.4

I attached the (trivial) python scripts to test this on your systems.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fqdn.py
Type: application/octet-stream
Size: 83 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050414/09e8a4df/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hostname.py
Type: application/octet-stream
Size: 87 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050414/09e8a4df/attachment-0001.obj 
-------------- next part --------------


Kind regards,

-- 
Jo Vermeulen <jo at lumumba.luc.ac.be>
http://lumumba.luc.ac.be/jo/


More information about the bazaar mailing list