You are not logged in.

#1 2003-12-16 14:46:03

kog
Member
From: Earth/Europe/Poland/Gdynia
Registered: 2003-06-02
Posts: 16
Website

How to start httpd: as deamon or by inetd (what with mysql)?

What is better ? I mean start the httpd as a deamon using xinetd or in init script? By my current knowledge :oops:  first option will be less memmory consumption.

And the second question: <b>If I configure xinetd to start httpd is possible to start mySql  in the same way ?</b>
I mean:
1. somebody asking httpd for data
2. httpd starting (by xinetd)
3. php asking for mysql data
4. mysql starting (by xinetd)
5. mysql giving data
6. mysql stopping
7. php "creating" page
8. httpd giving data
9. httpd stops
10. inetd waiting for connection.

I'm not sure about that: Will this by slower then got httpd and mysql (starting and stoping deamons) ?[/b]


--
Tomasz Bakiera, jabber: kog@jabber.wp.pl
http://www.oxiv.net

Offline

#2 2003-12-16 17:23:39

Gyroplast
Member
From: Germany
Registered: 2002-09-03
Posts: 166
Website

Re: How to start httpd: as deamon or by inetd (what with mysql)?

As a rule of thumb, xinetd is a more resource-conserving approach if "only a few" connections are expected, ie. on most private or hobby-installations, as the httpd is only invoked on explicit request instead of listening in the background permanently. This, of course, implies that the startup time of an httpd thread is a little longer in comparison to always having 5 or so processes eagerly waiting for connections.

Basically, for you it probably does not matter, do whatever you find easiest. This is, usually, running the httpd standalone from rc.d, as packaged.

Well, another difference is xinetd's ability to policy connections, ie. block IP ranges or limit connections, etc. If you feel you are needing that, xinetd is obviously the way to go.

If I am guessing correctly that your MySQL daemon is supposed to only be used from the local machine, I'd suggest dumping the whole networking enchilada with MySQL and use the socket capability instead. This obliterates any networking security issues (and potentially creates a few on filesystem level wink ).

All in all, yes, using xinetd makes overall responsiveness slower, but at a resource gain for systems with light load. You probably won't notice it in your environment, though. Your run diagram is quite correct, too, that's about what's happening when using xinetd for both services.

HTH,
  Dennis


"That's the problem with good advice. Nobody wants to hear it."
-- Dogbert

Offline

#3 2003-12-17 09:35:00

kog
Member
From: Earth/Europe/Poland/Gdynia
Registered: 2003-06-02
Posts: 16
Website

Re: How to start httpd: as deamon or by inetd (what with mysql)?

Thanks for reply big_smile

I'm slowly moving from W2K (with apache, php, mysql) to AL :shock: my current system is starting so slow (ca. 5 mins to be able to work), deamons starting as services with system.  I'm impressed by the AL it is ready for work in ca 2 mins with simillar configuration (apache, mysql, gnome). I need to test configuration with xinetd and 'as deamon' (see memmory occupation and speed). httpd and mysql is used for 'local test and work' and by my current knowledge :?  better should be set all as deamons.

I'm not sure about xinetd (need to browse manual): Is possible to left httpd running for example 20 mins after serving data ? (I mean: I wrote couple php lines, then testing,  correcting but httpd still in memmory for next 20 mins to speed up next testing. It will close when no activity for 20 mins)

If is possible to set xinetd to left running application for certain time it will be the best, I will set all deamon aplication (I want to have apache, mysql, ftp, ssh maybe vnc) to be started by xinetd.

I want to left security 'abroad', later I want to configure ipchains  - my machine is running most W2K (untill I set my LinuxBox as I want).

And the last main question: <b>Is sense to play with inetd ? big_smile </b>

My machine is 1GHz with 256 MB RAM (512 MB in the future). I using it to watch DivX, play MP3, internet browsing, WWW design (GIMP will be in use),  office work, and Wolfenstein - Enemy Teritory (there is no port for Battlefield 1942 client)


--
Tomasz Bakiera, jabber: kog@jabber.wp.pl
http://www.oxiv.net

Offline

#4 2003-12-17 10:35:40

andy
Member
From: Germany
Registered: 2002-10-11
Posts: 374

Re: How to start httpd: as deamon or by inetd (what with mysql)?

Quite frankly, with a 1Ghz machine, I would simply start apache as a regular daemon and not mess with xinetd/inetd. If apache is not serving anything, it will not use any CPU time. Also the memory consumption should not be large, and ultimatly, the OS will swap out stuff that's not needed. This is Linux after all :-) ... the OS DOES do a great job in managing processes.
I would rather configure apache to not spawn that many childs/threads (depending on setup). See
http://httpd.apache.org/docs-2.0/mpm.html
http://httpd.apache.org/docs-2.0/mod/prefork.html (which is AFAIK the default use). Just lower
StartServers
MinSpareServers
MaxSpareServers
if you are really concerend about memory wasting (but 256MB is quite a bit !)

But to have a daemon run for 20 minutes more than last activity ....hmmm ...  that would have to be implemented in apache itself.

Of course, you can always start and stop apache by hand. Either with
/etc/rc.d/httpd start|stop|restart
or simply with
apachectl start|stop|restart

Offline

Board footer

Powered by FluxBB