CPython thread starvation

Chris Angelico rosuav at gmail.com
Fri Apr 27 23:54:59 EDT 2012


On Sat, Apr 28, 2012 at 1:35 PM, John Nagle <nagle at animats.com> wrote:
> On CentOS, "getaddrinfo()" at the
> glibc level doesn't always cache locally (ref
> https://bugzilla.redhat.com/show_bug.cgi?id=576801).  Python
> doesn't cache either.

How do you manage your local cache? The Python getaddrinfo function
doesn't return a positive TTL (much less a negative one). Do you pick
an arbitrary TTL, or cache indefinitely?

I had the same issue in a PHP server (yeah I know, but I was
maintaining a project that someone else started) - fortunately there
is a PHP function that gives a TTL on all successful lookups, though
it still won't for failures. I couldn't find anything on cache control
anywhere in the Python socket module docs.

Perhaps the simplest option is to throw down a local BIND to manage
the caching for you, but that does seem a little like overkill.

ChrisA



More information about the Python-list mailing list