I want to expose my development site to more computers in the house. What I'm finding is that accessing it via an internal ip like is extremely slow compared to hitting localhost .

I'd rather train myself a bit in debugging these situations because there might not be a single answer.

The server is running nginx for static content, redirecting to apache ( for dynamic django-generated html. I'm also running postgresql and solr for database and search index as well as memcache.

My django settings.py file lists and as it's internal ips. The DB backend is configured for localhost. The memcached and solr backends are configured for

My /etc/hosts file looks like:       localhost localhost   localhost       jacob-desktop       redmine

(I was accessing my redmine project management system using a name based virtual host until I installed nginx - that's what that is for).

Interestingly, it seems much faster to access the static home page than the subsequent pages that have DB/memcached/solr access.

A lot of my confusion stems from what exactly the differences between localhost/ are, how these various ips interact with the network infrastructure (in my case, crappy dlink router). Further, there's various systems like solr and postgresql where I'm not sure about the ip's I want to use.

The goal is to configure these areas so that I'm on the right path towards horizontal scalability - which means probably won't be where my db / search index are located.


I don't have a complete answer here - rather some hints on where I'd start to look...

Usually access to your own IP address is not sent over the wire, e.g. your router should not be involved. There might be some reverse lookup involved, but that seems to be handled through your hosts file...

Regarding your /etc/hosts, I've not seen 192.168.x.x being assigned to the name localhost - that's rather the machine name or any alias you want your machine to reply to.

Also, you can try if

route -n

yield some timing results - e.g. the first command performs reverse lookup, the second not.

What doesn't seem to be your problem, but is related:

I've had some speed problems when an IP address was not resolvable - e.g. either reverse DNS lookup or an appropriate /etc/hosts file could help. The reason in this case usually is some logging where a host name lookup is performed that times out when the dns cannot be resolved. This has especially been the case with ssh logins on machines where the client address (rather: name) couldn't be resolved.

  • Which of these hints has lead to the solution? What was the solution? – Olaf Dec 17 '09 at 19:12

In general cases on one machine you'd better use lo0 instead of external interface, because:

  • Loopback's MTU is way higher - 16436
  • Loopback is not using any of hardware drivers, like e1000(Linux) or em0(FreeBSD)
  • Loopback skips some OSI levels when transfers data
  • Loopback don't use some times buggy features like TSO,LRO etc
  • Loopback is always up, even if link on interface is down

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.