In my rails app i do a nslookup using a ruby library resolv
. If the site like dgdfgdfgdfg.com
is entered its talking too long to resolve. in some instance like 20 sec.(mostly for non-existent sites) Because it cause the application to slowdown.
So i though of introducing a timeout period for the dns lookup.
What will be the ideal timeout period for the dns lookup so that resolution of actual site doesnt fail. will something like 10 sec will be fine?
views:
39answers:
2
+1
A:
You can run some tests among the users to find out the right number compromising responsiveness / performance.
Also you can adjust that timeout dinamically depending on the network traffic.
For example, for every sucessful resolv
, you save how much time it took you to resolv it. And every hour (for example) you can calculate an average and set double of its value as timeout (Remember that "average" is, roughly speaking, "the middle"). This way if your latency is high at some point, it autoadjust itself to increase the timeout period.
pakore
2010-06-14 09:16:21
yeah i can do that. but for a quick fix. is there anything like a most resonable timeout period?
railscoder
2010-06-14 09:31:35
There's no magic number. But I guess for me 5 seconds is enough for a resolv.Anyway, you should start accepting answers, your accept rate is really low :)
pakore
2010-06-14 09:35:24