...

View Full Version : Server load jumps too much...help?



jeromepelletier
06-10-2006, 02:22 PM
Hello, i have optimized my mysql by adding indexs, making only 1 connection and ruuning as little queries as possible (i reduced my queries to recieve to very little)
But, i still have high CPU usage spikes, what could be the cause? my php pages are about 80-160kb, would reducing these somehow doit? i tested by having 3 people click as fast as possible, the cpu jumped from 1 % to 4%

Any ideas would be great thanks

chump2877
06-10-2006, 09:10 PM
Are you closing all of your open MySQL connections after use?...that's all I can think of off the top of my head...

Oh, and 80-160kb i think is a little large for a PHP file....like you suggested sort of, try optimizing the code to reduce file length (throw reusable code into functions, include files, etc.)...you might try using object oriented programming to reduce file size too...

jeromepelletier
06-10-2006, 09:26 PM
Are you closing all of your open MySQL connections after use?...that's all I can think of off the top of my head...

Oh, and 80-160kb i think is a little large for a PHP file....like you suggested sort of, try optimizing the code to reduce file length (throw reusable code into functions, include files, etc.)...you might try using object oriented programming to reduce file size too...

I thought you didnt need to close connections because they are terminated at the end of the script?
Also i could probably squize the total file sizes down a tad by splitting and including more
and about object oriented...no clue what that means

chump2877
06-10-2006, 09:35 PM
I thought you didnt need to close connections because they are terminated at the end of the script?

Usually not necesary, but worth a try: http://us3.php.net/manual/en/function.mysql-close.php

Object oriented programming includes classes, methods, properties, etc....as opposed to procedural coding...in your case, OOP might break apart code into smaller chunks of reusable code....here's a link: http://www.sitepoint.com/article/php-paging-result-sets

jeromepelletier
06-10-2006, 11:06 PM
Usually not necesary, but worth a try: http://us3.php.net/manual/en/function.mysql-close.php

Object oriented programming includes classes, methods, properties, etc....as opposed to procedural coding...in your case, OOP might break apart code into smaller chunks of reusable code....here's a link: http://www.sitepoint.com/article/php-paging-result-sets
I tried closing connection, so far it seems my CPU doesnt jump as much, it seems steaderier but i still hit 4 easy, ima read that OOP thing and start splitting the files down as much as possible.

Thanks, any more suggesgiojns just post em :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum