Re: Speed/Performance
| From: | Ron Chmara | Date: | Sun, 17 Dec 2000 03:30:14 +0000 |
| Subject: | Re: Speed/Performance | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-41632@lists.php.net to get a copy of this message | ||
szii@sziisoft.com 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.
Well, that'll generate lots of load, regardless of PHP serving it.
Even with Perl or C you'd be hammering on a filesystem and/or your
network stack, at some point.
> At 100 threads we're choking the server (K6 233) and not
> even touching the client's CPU usage.
Well, the client's just hitting "web pages", right? So, if these were
live users, that box would support about 1000 concurrent web surfers
(who spend *much* more time reading pages than requesting them).
I'd say that's pretty good for a single 266/192 box. Chances are
that if you were testing this as an internet server, you'd be filling
most common data pipes with your supporting images before you actually
hit this load (the first bottleneck is always the 'net pipe size).
> 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.
Well, the fun part of load testing is trying to break it, and
it looks like you've managed that!
I'd second that you're obviously going to gain much more when using
more RAM (preferrably a fast variety), a server-level CPU, and
if you're using local disks for these acesses, a RAID cache can
can help. For an example of what I spec for a server, I usually
start with a minimum of 500Mhz/512Mb/Raid 5(w/64Mb cache). The RAM
will help any linux system, just to keep more files in the OS
cache.
Of course, if this is a dev machine, you may also have all sorts
of other stuff running on it (mail, news, etc.) slowing down your
threads, your version of apache is likely to be fairly bloated (my
tuned apaches tend to be about 4Mb per thread)...
And, of course, the app design *itself* may be recoded in some
other way, in order to maximize performance, for example, removing
ereg-based functions, removing "like" SQL statements, switching to a db
engine with faster performance (depending on the app, MySQL/Postgres/
whatever can all be faster or slower), optimizing your loops, removing
code layers... it's all very fluid.
-Bop
--
Personal: ron@opus1.com, 520-326-6109, http://www.opus1.com/ron/
Work: rchmara@pnsinc.com, 520-546-8993, http://www.pnsinc.com/
The opinions expressed in this email are not neccesarrily those of myself,
my employers, or any of the other little voices in my head.