Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Server load jumps too much...help?

    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

  • #2
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,764
    Thanks
    19
    Thanked 155 Times in 146 Posts
    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...
    Last edited by chump2877; 06-10-2006 at 09:13 PM.
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #3
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chump2877
    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

  • #4
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,764
    Thanks
    19
    Thanked 155 Times in 146 Posts
    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
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #5
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chump2877
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •