Re: Big PHP code = slow apache !?

From: Date: Wed, 06 Dec 2000 12:03:30 +0000
Subject: Re: Big PHP code = slow apache !?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-28884@lists.php.net to get a copy of this message
At 12:18 PM +0100 12/6/00, Hervé Piedvache wrote:
Hi, I would like to know if it's normal ... and/or how I can solve this trouble ... I have some PHP codes bigs, not so big but about 100Kb for some files ... then this code seems to make many times to be interpreted by PHP/Apache ... I have on my Apache Web server, 1Gb of memory but only 600Mb used ... may I use more memory ? But how ? What can I do to accelerate the procecus ? Thanks for your reply !
Well, it's kind of hard to tell from the question (not many specifics re: hardware or software), but -- What does the code itself look like? Are there loops being iterated through thousands of times? Are you using lots of ereg_* functions in those loops? the perl regex functions (pcre_*) are much faster. If you're using lots of loops than you might want a compiled or partially-compiled language like Perl, or wait for the Zend optimizer and compiler. Using PHPs time functions, you can time parts of the program; there might be some hand optimization you can do - taking invariant calculations out of loops, etc. You might also look at database calls, if you use them - setting up DB coonections can be time-consuming; perhaps you've got a bunch of connect requests stuck in a loop. The you could move the connect outside the loop, and only connect once. If you're calling a database located on a remote server, there might be a network or database-server related slowdown. Lastly, a 100KB PHP file seems pretty big to me; no matter how fast your CPU/program is, there is going to be a delay while it's read from disk. The only solutions there are faster disk, bigger disk cache, RAM disk, or smaller programs... -steve +--- "They've got a cherry pie there, that'll kill ya" ------------------+
| Steve Edberg                           University of California, Davis |
| sbedberg@ucdavis.edu                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+-------------------------------------- FBI Special Agent Dale Cooper ---+

« previous php.general (#28884) next »