LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Local websites are slow (https://www.linuxquestions.org/questions/linux-networking-3/local-websites-are-slow-15606/)

mdscudder 03-05-2002 02:42 AM

Local websites are slow
 
Hello. Just found these forums so please be nice :-).

I figure myself rather competent with Slackware 8, but this one's been bugging me for awhile. I host a few servers off of cable modems in this area (business class *and* the no-no home-class, so that probably doesn't matter). My usual setup is Apache/PHP/MySQL (latest, in fact I put in one today with all the latest) on Slackware 8, and the server also functions as the router with IP Masquerading. So my webserver has two ethernet cards, one connected to the cable modem, and one connected to the hub that connects the computers in the LAN. The Slack box runs dhcpd for IPs internally.

Here's the problem. If I'm sitting at home and I view sites on the server at the office, they come up instantly. If I view sites on the server at the office on the office's LAN, there are extreme delays (30-90 seconds) on page requests. Same thing goes for the other way around: If I'm at the office and I hit sites on a server at home, it's as fast as any site. If I'm at home and I browse sites locally, it lags like crazy. I would think that this would be the other way around.

My DNS entries are hosted in NYC (about four hours' drive from where I'm at), but if that was the problem it would be the problem all over. The servers are pretty much copies of one another (I always reference existing config files, sometimes copy them straight over if the config is similar enough). Both LANs access the outside internet (i.e. anything I'm not hosting locally) very quickly. I just had to move some sites home and I'm kind of frustrated because it seems I either get the luxury of working on sites locally (say, with HomeSite or UltraEdit over a Samba connection), or I get the luxury of not waiting 60 seconds to see a change I've made after I hit refresh, but never both.

Hardware is pretty standard, 10/100 cards and hubs all around, good wiring. All Intel or AMD machines. Workstation OS has been Windows 98, Windows 2000, and Windows XP (no flames please, they're good for what they're good for and their mere existence is not the problem, that I'm relatively sure of).

Please tell me the problem is simple to fix... it's been driving me crazy for longer than I care to admit :-)

-Mark

Mik 03-05-2002 04:57 AM

Sounds like a weird problem, I don't think I have the answer but maybe a few things which might help you get closer to the solution.
You could check the /etc/nsswitch.conf file to make sure it's using the right place to resolve the domain name. Might be trying to get it from some nis server which is slow.
You could also try to rule out any dns problems by accessing everything by ip number. You might have to configure apache for that to since it usually uses the FQDN. And make sure apache is not trying to reverse dns ip numbers for it's log files.
I don't think it has anything to do with routing because then other traffic would also be slow. Unless you've got special routes for web traffic.

mdscudder 03-05-2002 06:51 PM

Turns out I *was* using HostnameLookups in Apache. I turn it off, and everything flies. It's too bad though, I sort of like seeing where hits are coming from.

Now, is there a best-of-both-worlds scenario, where I can have it do hostname lookups just outside the LAN, and/or provide hostnames for the internal IPs?

Thanks!
-Mark

Mik 03-06-2002 03:12 AM

I suppose you could add all the host names to /etc/hosts and then make sure you check files first when resolving hostnames. Might get tricky though since you are using dhcp for your clients unless you've set it up so that each machine always gets the same ip number.
I've never really worked with a dhcp server but I suppose it should be able to pass on the hostname and ip number it just leased to a client. Maybe it would work well in combination with a nis server or maybe a caching dns server. But I really wouldn't know how to get that set up.

I was just looking around on the net and I found something better. Apache comes with a small program called logresolve. It resolves ip numbers in log files. You can schedule it as a cron job to resolve the ip numbers in your log files every so often, without it ever affecting the speed of apache when it runs.


All times are GMT -5. The time now is 05:28 AM.