Re: [PHP-DEV] Speed/Performance From: Zeev Suraski (zeev <email protected>)
Date: 12/15/00

One important thing to try is decrease the maximum number of httpd
processes. If you set it high, Apache will happily go all the way up when
requests flow in quickly enough. Apache doesn't pay attention to the
amount of available memory, and will spawn children until the limit that
you set. If you don't have enough memory, your system will run out of
memory, hit swap, and from that point, you'll be stuck in a cyclic process
of speed reduction (system performance will decrease, the existing number
of children won't be working fast enough so Apache will spawn more
children, there'll be more swapping, etc. - your system will die).

Before you add in more memory (which as Stig said, is a very good
solution), you can try to reduce the maximum number of httpds. It won't be
as good as adding memory, as a smaller number of httpds can handle less
requests per second, but it'll prevent your system from hitting swap, and
is likely to increase performance a lot. On an old server I was running in
1997, setting the limit of httpds to 30 or 40 allowed it to run nicely,
after it choked when the limit was at 90. Sure, in rush hours, performance
did slow down a bit, but it never hit swap and thus, never got to a
situation where it stopped responding.

Zeev

At 15:04 15/12/2000, Stig S. Bakken wrote:
>szii <email protected> wrote:
> >
> > We're running some speed trials right now, and seeing that .php files
> > are taking considerably longer even if they have NO <?php ?> tags.
> > They're static pages, but by having the extension they're running slower
> > do to the parser running through them.
> >
> > Does anyone have any "performance" tips for PHP files? Caches that
> > aren't turned on by default?
> >
> > Here are the ones I know:
> > Compile into Apache, not as a DSO
> > Lots O RAM
> > Don't use "known php extensions" for non-php files.
> >
> > We're taking a single-CPU client running a multithreaded app.
> > It spawns X threads each of which open a socket, requests a
> > file, and shuts down the socket.
> >
> > At 100 threads we're choking the server (K6 233) and not
> > even touching the client's CPU usage. We're also deep
> > into VM/swap space, even at 192 MB RAM. This is quite
> > obviously not our production server (cringe at the thought).
> > We're just "playing" with this one.
> >
> > Any one have more ideas? 2.4 kernel with khttpd? Won't affect
> > PHP, but could make static pages faster...
>
>It seems to me like you have a memory problem. With Apache/PHP you are
>in deep trouble if you run out of physical memory, and when you say that
>your server is choking, it sounds to me like it's "trashing" (spends
>most of its time paging memory in and out). 192MB RAM is not exactly a
>lot these days, even my laptop has more. :-)
>
>try {
> while (server_trashes) {
> add_more_ram();
> }
>} catch (OutOfMemorySlotsException) {
> rewrite_code();
>}
>
>I wouldn't consider running a system like the one you are outlining with
>less than 512MB.
>
> - Stig
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>

--
Zeev Suraski <zeev <email protected>>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>