Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Apache loads slowly on boot (hangs)... probably DNS related?

Status
Not open for further replies.

shadedecho

Programmer
Oct 4, 2002
336
US
I have just finished installing and configuring Apache 2.2 on a debian linux system. I've set it up to use VirtualHost entries, as there are about half a dozen different sites being hosted on there.

I've got apache set to start on boot up from init.d with the symlink to the apachectl script that ships with apache. Starting and stopping during normal system operation work just fine, and are almost instantaneous.

However, I have noticed during my system bootup that the starting of Apache hangs the boot sequence for anywhere from 10-60+ seconds. Eventually, the Apache finishes starting, booting continues, and all is fine.

Again, stopping and starting apache subsequent to boot do not cause these issues.

I am almost certain this is being caused by some sort of DNS resolution issue that Apache is choking on. I've seen nearly identical things happen on previous system installations. What I've done in the past to resolve, I've duplicated here, but it's not solving the issue on this machine, as it has in the past on previous machines.

I've put DNS (Bind 9.4) early on in the startup sequence (S14bind), with apache somewhat later (S21apache2), with about a dozen services that start in between them. In addition, I've got a simple "delay" script that happens right after Bind starts, to cause the system to sleep for a few seconds before continuing. This was to see if DNS was simply not fully loaded and ready to respond, and to give it some time to do so.

I've also worked on the settings in httpd.conf to try and remove any unnecessary DNS calls, such as putting in an IP address for the ServerName (the IP I put in has an entry in /etc/hosts as well, so it should easily reverse-map).

Still, apache seems intent on hanging for a bit during boot, and I'd really like to figure out how to resolve that. Any thoughts?
 
Since this is Linux, I guess if you put into perspective that the machine would not normally be booted very often over the course of a month/year, perhaps this is a non-issue?

I would also challenge whether dns/named are relevant. I'm not aware of any typical modules that require valid DNS resolutions that prevent Apache startup from continuing. I think your guess isn't a good one in this area. I can't prove that directly, it's a hunch.

I would say, however, that since your problem is at bootup, I would look into resources like disk that are utilized pretty heavily during boot. You may find that in the course of loading modules such a mod_perl, mod_php, and any authentication schemes you are using, that the disk just isn't keeping up with your expectations while it's also processing all of the other process loading unrelated to apache. Keep in mind that caching is happening all the while.

If you wanted to go farther towards disproving your DNS theory, try two things...
1) remove all content from under the web root(s) for your content... just to see if any of the content or .htaccess files are playing games that you are unaware of...
2) adjust your /etc/resolv.conf if necessary to ONLY resolve through public DNS resolvers via your ISP - which would presumably be fast and immediately online.
Then check the boot issues again.

OTHER STUFF that might also affect your boot cycle performance... It takes some time for physical network services like DSL to get activated and routing added. I've seen that take the kind of time you're talking about.

Also, if you are creating any VPNs you may find your base networking is impacted while the VPNs sync up.

Also, if you are running a firewall on boot up, you may find that it could be moved earlier in the process - or later - in order to change your perceived performance.

Just some thoughts on what to try. It would really surprise me if this was a DNS/named dependency unless you have something really unusual in your Apache httpd.conf, .htaccess, or other configuration controls.

Good luck!


D.E.R. Management - IT Project Management Consulting
 
I appreciate your input. As I said, my assumption that it's DNS related is mostly based on me having seen this issue before on other systems I've set up similarly (though with older versions of all relevant software - BIND, Apache, etc). In fact, with Bind 9.2 (which was patched to use MySQL as it's data store), and Apache 2.0, this exact same behavior was alleviated by me simply putting a 2 second delay in the boot up sequence after BIND started, before Apache took over. In fact, I could look at Apache log files (and server boot log files) and see previous to that change, there would be a 90 second or more hang of apache with no further activity reported.

When I was having those issues before, I did some google'ing and found articles like this one:
which do seem to indicate that Apache does have some vulnerabilities DNS related. In addition, I remember reading on some article, though I can't find it right now, about there being a built-in function in Apache during start up that was DNS related, and people trying to figure out if there was a way to config that to stop, and finding out that their only choice was to modify the source and recompile.

Anyway, that is my basis for thinking it's DNS related. I could be wrong, but this is my best guess at this point. It may not be, but, similar (and much more complex in terms of amounts of data, more vhosts, etc) configurations previously have been able to start just fine with other tricks I've mentioned, and so I have no explanation as to why this one would struggle with file access or other such things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top