TCPSocket#initialize slow on Windows

  • Thread starter Victor 'Zverok' Shepelev
  • Start date
V

Victor 'Zverok' Shepelev

ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32_71]

TCPSocket.new('localhost', 80) takes something like 1.5-2 sec each call.
(Test program only consists of profiling of this line with ruby-prof).

Can this be a bug or result of my misunderstanding of something fundamental?


Thanks.

V.
 
R

Roger Pack

Victor said:
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32_71]

TCPSocket.new('localhost', 80) takes something like 1.5-2 sec each call.
(Test program only consists of profiling of this line with ruby-prof).

Can this be a bug or result of my misunderstanding of something
fundamental?


Thanks.

V.

Could try
require 'resolv-replace' before hand, or using 127.0.0.1 instead of
localhost.
-=R
 
R

Roger Pack

I've kinda tried 127.0.0.1 and it was the same slow... and after I've
tried
your advice and required 'resolv-replace', all things became fast. But
then,
when I commented out "require 'resolv-replace'", they are still fast.
I'm
slightly shocked for now. Are there any explanations, or just it some
kind
of network magic I'll never debug about?

Anyway, thank you for advice.

Kind of reminds me of OS X 10.5's DNS problems--the first lookup
sometimes takes 15s, then after that it's cached so it's fast. Maybe?
The fix for that on OS X was to switch to opendns name servers. Not
sure about XP tho.
-=R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top