Slow server access via http://127.0.0.1

I have a local server box setup with a 4 year old Dell SC420, 2.8GHz, 3GB RAM, Pentium - should be a relatively fast machine I would think.

I am running PCBSD 1.5.1 (FreeBSD 6.3/X11) and using Firefox3 trying to access an Apache2 server and MySQL5 server with PHP5 and Drupal6, in the same box, via the localhost on http://127.0.0.1 but it's running absurdly slow, so I suspect some kind of DNS problem.

I can access the same server from outside the box on the local network, via the NIC IP address and it's considerably faster.

If I ping 127.0.0.1 internally it returns .03 ms; pretty fast.

It can easily take more than 60 seconds to load a complex admin page internally but less than half that externally.

Accessing any site on the internet is also slightly slower from the server box VS my Window laptop through the same router. That's a separate issue I'd like to solve someday too.

Can there be that much work for the processor to do running all that stuff? Or is this an Apache config issue? For comparison I tried running Drupal on XAMPP on the Windows laptop and it was off the charts slow.

Any suggestions how to diagnose/fix this?

Thanks, Jeff
 
SirDice said:
You are accessing it via it's IP address, which makes DNS irrelevant.

Not necessarily, maybe Apache is trying to do a reverse lookup? I haven't seriously used Apache for years, so I'm not sure how Apache handles this...

When accessing the machine from an outside box, what address do you use? DNS or IP? If you're using DNS, try adding an entry for that in /etc/hosts

Another thing you can look at is the Apache logfile.

Also, making a HTTP connection with telnet(1) is often useful to debug problems, use ``http telnet'' or something on google to find more info on this.
 
Thought so too

I also thought using IP numbers obviated any culpability with DNS. Don't know enough about this stuff but in my Google search on this I've seen a lot of other people with the same problem and plenty of talk about DNS and reverse lookup and such.

I'll have to research this more.

The etc/hosts file contains: 127.0.0.1

Externally I access the machine on the local net at 192.168.1.10, a fixed IP address of the NIC in the server box.

I suppose I could try shutting down the X server and using a really stripped down browser like CURL or something to see the effect.

When you look at Firefox's progress bar it does nothing for a long time and then quickly starts moving, rendering most of the page, but then hangs at 98% or so for a long time before finishing. Even on simple static page requests the internal access can take 10 seconds to render a page.

Accessing 192.168.1.10 from internally takes even longer and often won't connect at all yet it pings with no problem, which seems like an important but perplexing clue.

It's got to be an Apache config problem.

....Jeff
 
For the remainder of your testing (at least for now), could you focus on static pages? Might as well eliminate possibilities.

Please post your /etc/hosts file. If it contains only the value "127.0.0.1" as you said, that's a problem.

Also, set your LogLevel directive in your Apache config to "debug" and restart httpd. Now tail Apache's error log while trying to access a static page. Any interesting chatter in there?
 
Apache might do reverse lookups for logging if configured that way, IIRC this isn't the default.

The webpage you're accessing might use some hostnames, as mentioned above try to use a simple test page.
 
I wrote a dumbass html file and put it in the web directory. It takes forever to serve it via the localhost.

I am in the process of moving from Thailand back to NYC for the summer, so I won't be able to flesh this out completely for a few weeks. Stay tuned...
 
Well, I gave up trying to find the problem. Moot anyway as I rebuilt the whole machine with PCBSD 7.1 RC1 which runs FreeBSD 7.2 beta under the hood, and what an enormous difference! Not sure what was wrong with the old pig, but there is now no speed difference in accessing apache via the localhost or the NIC IP.

Have to say KDE4.2.1 is shaping up pretty nicely! Minor bugs so far but overall I'm very impressed. I'm running a very old (~8 yrs) Gateway box with a P4,1.8G,1G-RAM brain and it's like a new machine. Before, running XP, it had slowed over the years to a unusable crawl (FBSD 6.3/KDE3.5.8 was a lot better), but I've resurrected it!
 
Back
Top