RE: [PHP] PHP load to high on server
On Thu, January 19, 2006 3:20 am, Albert wrote: > Richard Lynch wrote: >> On Tue, January 17, 2006 11:18 pm, Albert wrote: >> > The page having the heaviest load uses 5 simultaneous sessions - >> they >> > refresh every 5 seconds. Even with just one connection there are >> 16 >> > Apache >> > threads running all occupying between 5 and 20% of CPU. >> >> Are you saying that you have a page that chews up 5 HTTP >> connections, >> and each uses PHP heavily, and you reload that page every 5 seconds? > > I have a page that loads which never refreshes. > > It displays three images generated with PHP. The three images updates > at > least once every 5 seconds because the content actually changes. I'm sure you have thought of it, but consider (again) things like: Slightly smaller images. Fewer colors (for GIF/PNG) Lower quality/resolution (for JPEG) If you can chop the image file size down, even a little, it may help some. Maybe consider posting your image generation code -- Frequently there's a faster way to do something on that for incredible performance boost. Though, again, I would assume you've already been over this with a fine-tooth comb... Still, you never know. If the information page is a lot of text, maybe gzip it, if you can specify the browser at a level that will support zipped content. This will only matter if there's a fair amount of text there... gzipping the images probably won't help. -- Like Music? http://l-i-e.com/artists.htm -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP load to high on server
Richard Lynch wrote: > On Tue, January 17, 2006 11:18 pm, Albert wrote: > > The page having the heaviest load uses 5 simultaneous sessions - they > > refresh every 5 seconds. Even with just one connection there are 16 > > Apache > > threads running all occupying between 5 and 20% of CPU. > > Are you saying that you have a page that chews up 5 HTTP connections, > and each uses PHP heavily, and you reload that page every 5 seconds? I have a page that loads which never refreshes. It displays three images generated with PHP. The three images updates at least once every 5 seconds because the content actually changes. It also has an information page displaying information about the three images which also updates every time the image changes. > Maybe you shouldn't do that... > > Stretch it out to 10 seconds and see where your load goes. At 10 seconds all the problems disappear. Unfortunately the customer requires this to update at least every 5 seconds. > Find out which of the 5 sessions is most expensive (slowest). Can you > cache the results of that one? How about the second slowest? Can you > cache ANYTHING to make the application faster? I am now busy converting the three images and info page to use a cached copy if they have not changed. > > Does anyone have an idea of what I can do (short of recoding)? > #1. Buy more hardware, and build a server farm. On the lowest end of the spectrum (up to 5 simultaneous users) I have to make it work on a Celeron 400 with 512MB RAM. At the highest end (up to 100 simultaneous users) I have a Dual Xeon 3.4GHZ with 2GB RAM and SCSI drives. > #2. Buy the Zend Cache Will probably to that for the top end machines. The Zend Cache costs more than my lowest end machine after assembly. > #3. Install some other Cache product (most of which aren't as > good/fast/solid as Zend Cache, imho) I tend to trust Zend a bit more than the other developers (maybe because PHP is based on the Zend engine). If I didn't have budget constraints then I would have had the Zend Cache on each and every machine leaving my office. Albert -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.14.20/234 - Release Date: 2006/01/18 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP load to high on server
On Tue, January 17, 2006 11:18 pm, Albert wrote: > The page having the heaviest load uses 5 simultaneous sessions - they > refresh every 5 seconds. Even with just one connection there are 16 > Apache > threads running all occupying between 5 and 20% of CPU. Are you saying that you have a page that chews up 5 HTTP connections, and each uses PHP heavily, and you reload that page every 5 seconds? Maybe you shouldn't do that... Stretch it out to 10 seconds and see where your load goes. Find out which of the 5 sessions is most expensive (slowest). Can you cache the results of that one? How about the second slowest? Can you cache ANYTHING to make the application faster? > Does anyone have an idea of what I can do (short of recoding)? Oh. Well, with no recoding you can: #1. Buy more hardware, and build a server farm. #2. Buy the Zend Cache #3. Install some other Cache product (most of which aren't as good/fast/solid as Zend Cache, imho) Disclosure: I was formerly employed by Zend and am at least as biased as anybody else on this list, if not more so. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP load to high on server
Hello, The same problem I've had on a FreeBSD 4.11 box, running Apache 1.3.3 and PHP 4.3.5. From time to time, httpd went to 90%+ (I supposed it was a memory leak or smth). After upgrading Apache to 1.3.4 and PHP to 4.4.2, everything smoothed down and we got no more 90+% httpd, even on heavy load. If possible, try to downgrade/upgrade PHP and/or Apache (eventually on a test machine). Regards, Stefan From: Jochem Maas Sent: Mi 18.01.2006 18:59 To: Adi Cc: Albert; PHP List Subject: Re: [PHP] PHP load to high on server Adi wrote: Run some tracer apps on your code...could be some wild loops of some sort? Never the less, ZEND debugger with the module should do the jobit will tell you which files/functions etc are runningnice tool to track execution time etc... On 1/18/06, Albert <[EMAIL PROTECTED]> wrote: Hi I am running SuSE 9.2 (Kernel 2.6.8-24-default) with Apache 2.0.50 and PHP 4.3.8 (as an Apache module) on a Celeron 900 with 304MB RAM. This machine is used for testing. We have made some changes to our PHP application and now what changes? DB related per chance? doing any queries on tables that are not indexed properly? or maybe your app creates tons of objects? (in which case you might look at being able to clone objects rather than init new ones where possible). the machine is having trouble serving the pages. Apache is occupying almost 90% CPU usage. My Apache log configuration is: %a %b %H %r %>s %t %T %X %a : Remote IP %b : Size of response %H : Protocol %r : Request %>s : Last status of request %t : Time of request %T : Time to serve %X : Connection status after serving request In the log below the last character after the timestamp indicates the following: X : Connection terminated before end serving request + : Connection might not be terminated - : Connection terminated As you will notice almost all the statuses is connection might not have been terminated. The page having the heaviest load uses 5 simultaneous sessions - they refresh every 5 seconds. Even with just one connection there are 16 Apache threads running all occupying between 5 and 20% of CPU. Does anyone have an idea of what I can do (short of recoding)? TIA Albert From our Apache log: 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:29 +] 1 X 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D1024&w=3D1280 HTTP/1.1 200 [17/Jan/2006:16:16:28 +] 2 + 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 [17/Jan/2006:16:16:29 +] 1 + 192.168.x.x 2839 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:29 +] 2 + 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:31 +] 1 + 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:31 +] 1 + 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 0 + 192.168.x.x 429 HTTP/1.1 GET /display_background.php HTTP/1.1 200 [17/Jan/2006:16:16:32 +] 2 + 192.168.x.x 178 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 3 + 192.168.x.x 3325 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 3 + 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 3 X 192.168.x.x 1249 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 4 + 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:34 +] 3 + 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 [17/Jan/2006:16:16:37 +] 1 + 192.168.x.x 431 HTTP/1.1 GET /display_background.php HTTP/1.1 200 [17/Jan/2006:16:16:35 +] 3 + 192.168.x.x 2823 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:35 +] 4 + 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 0 + 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D768&w=3D1024 HTTP/1.1 200 [17/Jan/2006:16:16:37 +] 3 + 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:38 +] 3 X 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 2 X 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 2 + 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 3 + 192.168.x.x 2828 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 3 + 192.168.x.x 429 HTTP/1.1 GET /display_background.php HTTP/1.1 200 [17/Jan/2006:16:16:42 +] 2 + 192.168.x.x 178 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:43 +] 2 + 192.168.x.x 3325 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:43 +] 3 + 192.168.x.x 1260 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:43 +] 3 + 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D1024&w=3D1280 HTTP/1.1 200 [
Re: [PHP] PHP load to high on server
Adi wrote: Run some tracer apps on your code...could be some wild loops of some sort? Never the less, ZEND debugger with the module should do the jobit will tell you which files/functions etc are runningnice tool to track execution time etc... On 1/18/06, Albert <[EMAIL PROTECTED]> wrote: Hi I am running SuSE 9.2 (Kernel 2.6.8-24-default) with Apache 2.0.50 and PHP 4.3.8 (as an Apache module) on a Celeron 900 with 304MB RAM. This machine is used for testing. We have made some changes to our PHP application and now what changes? DB related per chance? doing any queries on tables that are not indexed properly? or maybe your app creates tons of objects? (in which case you might look at being able to clone objects rather than init new ones where possible). the machine is having trouble serving the pages. Apache is occupying almost 90% CPU usage. My Apache log configuration is: %a %b %H %r %>s %t %T %X %a : Remote IP %b : Size of response %H : Protocol %r : Request %>s : Last status of request %t : Time of request %T : Time to serve %X : Connection status after serving request In the log below the last character after the timestamp indicates the following: X : Connection terminated before end serving request + : Connection might not be terminated - : Connection terminated As you will notice almost all the statuses is connection might not have been terminated. The page having the heaviest load uses 5 simultaneous sessions - they refresh every 5 seconds. Even with just one connection there are 16 Apache threads running all occupying between 5 and 20% of CPU. Does anyone have an idea of what I can do (short of recoding)? TIA Albert From our Apache log: 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:29 +] 1 X 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D1024&w=3D1280 HTTP/1.1 200 [17/Jan/2006:16:16:28 +] 2 + 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 [17/Jan/2006:16:16:29 +] 1 + 192.168.x.x 2839 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:29 +] 2 + 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:31 +] 1 + 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:31 +] 1 + 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 0 + 192.168.x.x 429 HTTP/1.1 GET /display_background.php HTTP/1.1 200 [17/Jan/2006:16:16:32 +] 2 + 192.168.x.x 178 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 3 + 192.168.x.x 3325 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 3 + 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 3 X 192.168.x.x 1249 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:33 +] 4 + 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:34 +] 3 + 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 [17/Jan/2006:16:16:37 +] 1 + 192.168.x.x 431 HTTP/1.1 GET /display_background.php HTTP/1.1 200 [17/Jan/2006:16:16:35 +] 3 + 192.168.x.x 2823 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:35 +] 4 + 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 0 + 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D768&w=3D1024 HTTP/1.1 200 [17/Jan/2006:16:16:37 +] 3 + 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:38 +] 3 X 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 2 X 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 2 + 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 3 + 192.168.x.x 2828 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:39 +] 3 + 192.168.x.x 429 HTTP/1.1 GET /display_background.php HTTP/1.1 200 [17/Jan/2006:16:16:42 +] 2 + 192.168.x.x 178 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:43 +] 2 + 192.168.x.x 3325 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:43 +] 3 + 192.168.x.x 1260 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:43 +] 3 + 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D1024&w=3D1280 HTTP/1.1 200 [17/Jan/2006:16:16:43 +] 3 + 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 [17/Jan/2006:16:16:46 +] 0 + 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 [17/Jan/2006:16:16:44 +] 1 + 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 [17/Jan/2006:16:16:46 +] 1 + 192.168.x.x 2807 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:46 +] 1 + 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 [17/Jan/2006:16:16:48 +] 0 + 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1
Re: [PHP] PHP load to high on server
Run some tracer apps on your code...could be some wild loops of some sort? Never the less, ZEND debugger with the module should do the jobit will tell you which files/functions etc are runningnice tool to track execution time etc... On 1/18/06, Albert <[EMAIL PROTECTED]> wrote: > > Hi > > > > I am running SuSE 9.2 (Kernel 2.6.8-24-default) with Apache 2.0.50 and PHP > 4.3.8 (as an Apache module) on a Celeron 900 with 304MB RAM. This machine > is > used for testing. We have made some changes to our PHP application and now > the machine is having trouble serving the pages. Apache is occupying > almost > 90% CPU usage. > > > > My Apache log configuration is: > > %a %b %H %r %>s %t %T %X > > %a : Remote IP > > %b : Size of response > > %H : Protocol > > %r : Request > > %>s : Last status of request > > %t : Time of request > > %T : Time to serve > > %X : Connection status after serving request > > > > In the log below the last character after the timestamp indicates the > following: > > X : Connection terminated before end serving request > > + : Connection might not be terminated > > - : Connection terminated > > > > As you will notice almost all the statuses is connection might not have > been > terminated. > > > > The page having the heaviest load uses 5 simultaneous sessions - they > refresh every 5 seconds. Even with just one connection there are 16 Apache > threads running all occupying between 5 and 20% of CPU. > > > > Does anyone have an idea of what I can do (short of recoding)? > > > > TIA > > > > Albert > > > > From our Apache log: > > 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 > > [17/Jan/2006:16:16:29 +] 1 X > > 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D1024&w=3D1280 HTTP/1.1 200 > > [17/Jan/2006:16:16:28 +] 2 + > > 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 > > [17/Jan/2006:16:16:29 +] 1 + > > 192.168.x.x 2839 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:29 > > +] 2 + > > 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 > > [17/Jan/2006:16:16:31 +] 1 + > > 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 > > [17/Jan/2006:16:16:31 +] 1 + > > 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 > > [17/Jan/2006:16:16:33 +] 0 + > > 192.168.x.x 429 HTTP/1.1 GET /display_background.php HTTP/1.1 200 > > [17/Jan/2006:16:16:32 +] 2 + > > 192.168.x.x 178 HTTP/1.1 GET /selObject.php HTTP/1.1 200 > > [17/Jan/2006:16:16:33 +] 3 + > > 192.168.x.x 3325 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 > > [17/Jan/2006:16:16:33 +] 3 + > > 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 > > [17/Jan/2006:16:16:33 +] 3 X > > 192.168.x.x 1249 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:33 > > +] 4 + > > 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 > > [17/Jan/2006:16:16:34 +] 3 + > > 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 > > [17/Jan/2006:16:16:37 +] 1 + > > 192.168.x.x 431 HTTP/1.1 GET /display_background.php HTTP/1.1 200 > > [17/Jan/2006:16:16:35 +] 3 + > > 192.168.x.x 2823 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:35 > > +] 4 + > > 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 > > [17/Jan/2006:16:16:39 +] 0 + > > 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D768&w=3D1024 HTTP/1.1 200 > > [17/Jan/2006:16:16:37 +] 3 + > > 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 > > [17/Jan/2006:16:16:38 +] 3 X > > 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 > > [17/Jan/2006:16:16:39 +] 2 X > > 192.168.x.x 3711 HTTP/1.1 GET /display_menu.php HTTP/1.1 200 > > [17/Jan/2006:16:16:39 +] 2 + > > 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 > > [17/Jan/2006:16:16:39 +] 3 + > > 192.168.x.x 2828 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:39 > > +] 3 + > > 192.168.x.x 429 HTTP/1.1 GET /display_background.php HTTP/1.1 200 > > [17/Jan/2006:16:16:42 +] 2 + > > 192.168.x.x 178 HTTP/1.1 GET /selObject.php HTTP/1.1 200 > > [17/Jan/2006:16:16:43 +] 2 + > > 192.168.x.x 3325 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 > > [17/Jan/2006:16:16:43 +] 3 + > > 192.168.x.x 1260 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:43 > > +] 3 + > > 192.168.x.x 1845 HTTP/1.1 GET /msgMon.php?h=3D1024&w=3D1280 HTTP/1.1 200 > > [17/Jan/2006:16:16:43 +] 3 + > > 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 > > [17/Jan/2006:16:16:46 +] 0 + > > 192.168.x.x 3279 HTTP/1.1 GET /display_target_information.php HTTP/1.1 200 > > [17/Jan/2006:16:16:44 +] 1 + > > 192.168.x.x 216 HTTP/1.1 GET /selObject.php HTTP/1.1 200 > > [17/Jan/2006:16:16:46 +] 1 + > > 192.168.x.x 2807 HTTP/1.1 GET /gd.php HTTP/1.1 200 [17/Jan/2006:16:16:46 > > +] 1 + > > 192.168.x.x 13353 HTTP/1.1 GET /validation.php HTTP/1.1 200 > > [17/Jan/2006:16:16:48 +] 0 + > > 192.168.x.