Re: MySQL database Overloaded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On 09/10/2004 12:58 PM, Bob Burns wrote:
> I would suspect that you have a persistent database connection.  This causes
> very high usage to consume all the database resources as they are held for
> the duration of the session.  I would suggest that you create the database
> connection for each iteration rather than by session.

This does not seem to be a good solution either because it makes each 
page request take even longer and make the Web server fork even more 
processes that suck the system memory.

The solution that I have implemented in the PHP Classes site is to use a 
separate Web server just to serve static content (images, css, etc...). 
I used thttpd running in the same machine but on a differnt IP (it used 
to be in the same IP with a different port but some firewalls block HTTP 
requests not done on port 80).

http://www.acme.com/software/thttpd/

The result is that for every page request, Apache was not forking so 
many processes that were used for serving the images. thttpd is 
multi-threaded so it consumes a ridiculous amount of memory.

Disabling Keep-Alive in the Apache that serves PHP pages is also 
mandatory to do in conjunction with moving static content to thttpd.

The result was awesome. It reduced from 50/140 processes (average/peak) 
to 20/50. The memory usage that was saved made the site not start using 
virtual memory, which is what causes major slowdown during peaks.

If the pages are not personalized, full partial page caching also helps 
a lot. I use this file cache class to store cached content on disk and 
avoid database accesses for retriving data that does not change freequently:

http://www.phpclasses.org/filecache


-- 

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux