[sldev] Linux 64 bit framerate stutter (0.5 - 2.0 second frame periodically [every 5 to 60 seconds])

Argent Stonecutter secret.argent at gmail.com
Fri Mar 14 10:59:07 PDT 2008


On 2008-03-14, at 11:16, Robin Cornelius wrote:
> Argent Stonecutter wrote:
>>> BTW using a local cacheing DNS improves this problem by a factor  
>>> of 10,
>>> i now get 1 second stutters that i hardly notice instead of 10  
>>> second.
>>

>> That sounds like it's in a call to gethostbyname() somewhere.  
>> That's a
>> notorious blocking call with a lot of internal complexity.

>> The fix would be to replace gethostbyname(), or at least grab the  
>> source
>> and insert callbacks inside it. The most portable thing would be  
>> to use
>> a separate name server process and isolate the whole lookup.

> Looking at the calls libcurl calls getaddrinfo()

No doubt the same blocking model as the older gethostbyname().

> in libc so we may have
> to do what you said and split it to a seperate process. apparently  
> there
> is a getaddrinfo_a() in glibc? but in these cases we need a *eek*  
> custom
> libcurl.

Not necessarily, you should be able just override the routine in libc  
with one talks to a separate process... this shouldn't involve  
hacking libc, there should be a way to do it portably with glibc.

Well, with a sane libc you could. What I've heard of glibc doesn't  
bear thinking about.

It might be worthwhile just doing whatever it's using curl for  
directly. HTTP isn't that complex.

Another possibility would be simply to run a fast proxy on localhost  
for all HTTP(S). That way the name lookups will happen after the  
connect has completed, *and* you get a one-stop-shop for proxy  
settings for everything that uses HTTP. There's an open-source one  
called tinyproxy that I've done some work on that works very well...  
and is very versatile and easy to configure. It's a pure proxy, not a  
cache like squid, so it has very little overhead.

> But looking at this now i have to wonder just how many stutters are
> being caused by this DNS lookup.

And then there's mozlib... I hope the Mozilla source tree's been  
cleaned up. I haven't delved into it in many years, and that was back  
before the gecko days: I was seeing WINS lookups coming out of my  
FreeBSD desktop and traced it down to my use of an unqualified host  
name for my proxy server. I can understand why they'd make their name  
lookup try WINS for unqualified host names, but sheesh.



More information about the SLDev mailing list