Author Topic: Your scripts consume too much CPU and overload our servers  (Read 18084 times)

0 Members and 1 Guest are viewing this topic.

Offline satine88

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Your scripts consume too much CPU and overload our servers
« on: June 09, 2010, 11:02:43 PM »
Hello

My host (which is serious and deem France) blocked my site because:

"Your scripts consume too much CPU and overload our servers"

It categories.php which I have problems

I do not know what to do, can you help me?
« Last Edit: June 10, 2010, 12:59:28 PM by satine88 »

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: Your scripts consume too much CPU and overload our servers
« Reply #1 on: June 10, 2010, 02:34:54 PM »
Hi,
    Do you have more details about the server load ?

1. How many categories you have ?
2. how many images, users and what is your daily page visit ?


Thanks,
batu544


Offline satine88

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: Your scripts consume too much CPU and overload our servers
« Reply #2 on: June 10, 2010, 06:00:56 PM »
Hi,
    Do you have more details about the server load ?

1. How many categories you have ?
2. how many images, users and what is your daily page visit ?


Thanks,
batu544



--> http://www.fond-ecran-gratuit.biz/
1) 379 categories
2) 800 daily page visit

(categories.php consume too much CPU and overload our servers)

Is what I can alleviate categorie.php

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: Your scripts consume too much CPU and overload our servers
« Reply #3 on: June 10, 2010, 08:17:51 PM »
in the includes/constants.php file...
look for..
Code: [Select]
// Debug contants
// define("PRINT_STATS", 1);
// define("PRINT_QUERIES", 1);
// define('PRINT_CACHE_MESSAGES', 1);
if you take out the // in front you can use these for troubleshooting...
The print_stats will tell you the amount of time it took to render the page
the print_queries will show you every database call that page is making while being created..

I have used these in the past to see how long my pages take to process but I am not sure if that is all CPU or other factors involved.

But they have to let you get your site back up too see the results unless you have a local server on your computer you can run them on.

Good Luck, Shared servers are hard to deal with sometimes as your site grows...
Buddy Duke
www.budduke.com

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: Your scripts consume too much CPU and overload our servers
« Reply #4 on: June 10, 2010, 08:22:03 PM »
well.. I tried to browse your website .. but its Forbidden for me..

Here couple of tips for minimizing the server load..

1. Turn OFF the random wallpaper option.
2. Enable cache for the category pages.


May be some other member can suggest some more optimization tips..

One other option is... you can move into premium hosting service..


Thanks,
batu544



Offline satine88

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: Your scripts consume too much CPU and overload our servers
« Reply #5 on: June 10, 2010, 08:50:06 PM »
Code: [Select]
// define("PRINT_STATS", 1);
--> Page generated in 2.142466 seconds with 1156 queries, spending 0.835000 seconds doing MySQL queries and 1.307466 doing PHP things. GZIP compression disabled

Code: [Select]
define("PRINT_QUERIES", 1);

I did :
Code: [Select]
define('SHOW_RANDOM_IMAGE', 0);
2. Enable cache for the category pages.
Can you tell me how I can do that?

--> http://www.fond-ecran-gratuit.biz/

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: Your scripts consume too much CPU and overload our servers
« Reply #6 on: June 10, 2010, 09:07:02 PM »

2. Enable cache for the category pages.
Can you tell me how I can do that?


in your global.php file
look for
Code: [Select]
// Initialize cache configuration
$cache_enable          = 0;
$cache_lifetime        = 3600; // 1 hour
$cache_path            = ROOT_PATH.'cache';
$cache_page_index      = 0;
$cache_page_categories = 1;
$cache_page_top        = 1;
$cache_page_rss        = 1;
Change $cache_enable = 1  and I always have top set to 1 because it does allot of database calls.
Hope that helps!
Buddy Duke
www.budduke.com

Offline satine88

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: Your scripts consume too much CPU and overload our servers
« Reply #7 on: June 10, 2010, 10:31:17 PM »
Thank you for all your advice, I'll see if I still have problems! I'll let you know

Thank you very much

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Your scripts consume too much CPU and overload our servers
« Reply #8 on: June 11, 2010, 01:07:04 AM »
Page generated in 2.142466 seconds with 1156 queries, spending 0.835000 seconds doing MySQL queries and 1.307466 doing PHP things. GZIP compression disabled
:waaa:


Let me guess, you are using "original" version of the SEO mod? If you are, then try optimized version (replace code from step 2 with the new code)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline satine88

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: Your scripts consume too much CPU and overload our servers
« Reply #9 on: June 11, 2010, 01:08:36 PM »
Page generated in 2.142466 seconds with 1156 queries, spending 0.835000 seconds doing MySQL queries and 1.307466 doing PHP things. GZIP compression disabled
:waaa:


Let me guess, you are using "original" version of the SEO mod? If you are, then try optimized version (replace code from step 2 with the new code)


I do this:
http://www.4homepages.de/forum/index.php?topic=17598.msg126756#msg126756

was it to do?

Result:

index
Quote
Page generated in 0.674547 seconds with 391 queries, spending 0.432000 seconds doing MySQL queries and 0.242547 doing PHP things. GZIP compression disabled

categorie
Quote
Page generated in 0.399420 seconds with 388 queries, spending 0.072000 seconds doing MySQL queries and 0.327420 doing PHP things. GZIP compression disabled

detail
Quote
Page generated in 0.637300 seconds with 416 queries, spending 0.201000 seconds doing MySQL queries and 0.436300 doing PHP things. GZIP compression disabled

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Your scripts consume too much CPU and overload our servers
« Reply #10 on: June 11, 2010, 02:58:09 PM »
The 391 queries now showing is with the cache on, correct? Cause if I start refreshing the page, once in a while I get over 1100 queries, then it drops back to 400. Cache certainly helps, but it doesn't fix the problem.

If you look at Nick's statistics at the SEO mod page, you'll see that with the nic_bck's code it optimized on 50%, but with my code it's 80% optimized. But I'd first suggest disable that mod at all and see if any performance gained (all you need to do is replace code from step 2 with the original code from 4images package)....perhaps it's not that mod that causes such slowdown...anyway, 1156 database queries is way too much.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline satine88

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: Your scripts consume too much CPU and overload our servers
« Reply #11 on: June 11, 2010, 06:57:16 PM »
Yes I have in global.php

Code: [Select]
// Initialize cache configuration
$cache_enable          = 1;
$cache_lifetime        = 3600; // 1 hour
$cache_path            = ROOT_PATH.'cache';
$cache_page_index      = 1;
$cache_page_categories = 1;
$cache_page_top        = 1;
$cache_page_rss        = 1;


To disable the plugins I have to go into "admin"> "setting"?
If it is, there is no other way because I have this problem:
http://nsa15.casimages.com/img/2010/06/11/100611062741840072.jpg

(Standing problem of a year, I never took the time to try to resolve it ...)

I JUST change sessions.php (http://www.4homepages.de/forum/index.php?topic=17598.0), to have him as the start and now:
Several test (with F5)

index
Code: [Select]
Page generated in 0.705108 seconds with 15 queries, spending 0.115000 seconds doing MySQL queries and 0.590108 doing PHP things. GZIP compression disabled
Code: [Select]
Page generated in 0.347588 seconds with 10 queries, spending 0.078000 seconds doing MySQL queries and 0.269588 doing PHP things. GZIP compression disabled
Code: [Select]
Page generated in 0.205167 seconds with 10 queries, spending 0.013000 seconds doing MySQL queries and 0.192167 doing PHP things. GZIP compression disabled
categorie
Code: [Select]
Page generated in 7.872441 seconds with 355 queries, spending 0.184000 seconds doing MySQL queries and 7.688441 doing PHP things. GZIP compression disabled
Code: [Select]
Page generated in 0.483311 seconds with 14 queries, spending 0.099000 seconds doing MySQL queries and 0.384311 doing PHP things. GZIP compression disabled
Code: [Select]
Page generated in 0.364798 seconds with 9 queries, spending 0.087000 seconds doing MySQL queries and 0.277798 doing PHP things. GZIP compression disabled
Code: [Select]
Page generated in 32.019884 seconds with 826 queries, spending 0.867000 seconds doing MySQL queries and 31.152884 doing PHP things. GZIP compression disabled
Code: [Select]
Page generated in 0.219854 seconds with 9 queries, spending 0.017000 seconds doing MySQL queries and 0.202854 doing PHP things. GZIP compression disabled
Code: [Select]
Page generated in 0.547811 seconds with 9 queries, spending 0.081000 seconds doing MySQL queries and 0.466811 doing PHP things. GZIP compression disabled

detail
Code: [Select]
Page generated in 0.531857 seconds with 18 queries, spending 0.170000 seconds doing MySQL queries and 0.361857 doing PHP things. GZIP compression disabled
Code: [Select]
Page generated in 0.490396 seconds with 18 queries, spending 0.044000 seconds doing MySQL queries and 0.446396 doing PHP things. GZIP compression disabled
And you ?
--> http://www.fond-ecran-gratuit.biz/

I need this mod, because I need the url rewrite

When you talk about your change? (That is: # msg126772 http://www.4homepages.de/forum/index.php?topic=17598.msg126772?)

Sorry if I do not understand everything right away
Thank you for your help

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: Your scripts consume too much CPU and overload our servers
« Reply #12 on: June 11, 2010, 09:59:58 PM »
Hi Satine,
                 What V@no wants you to do is.. first disable the cache system by changing all the values from 1 to 0 of below variables

Code: [Select]
// Initialize cache configuration
$cache_enable          = 1;
$cache_lifetime        = 3600; // 1 hour
$cache_path            = ROOT_PATH.'cache';
$cache_page_index      = 1;
$cache_page_categories = 1;
$cache_page_top        = 1;
$cache_page_rss        = 1;

2.  After this you need to test all the things, what you did exactly..



Offline satine88

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: Your scripts consume too much CPU and overload our servers
« Reply #13 on: June 11, 2010, 11:28:33 PM »
I will stop this, because I just noticed that my site was hacked, I opened another topic:

http://www.4homepages.de/forum/index.php?topic=27386.msg148192#msg148192

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Your scripts consume too much CPU and overload our servers
« Reply #14 on: June 12, 2010, 03:09:28 AM »
and yes, viruses/trojans are know for slowing down sites... (replied to your other post already)

When you talk about your change? (That is: # msg126772 http://www.4homepages.de/forum/index.php?topic=17598.msg126772?)

Sorry if I do not understand everything right away
Thank you for your help
Yes, that is the code I meant.

The original mod's code query database for each single link it creates, nic_bck's code (the one you are using) caches some of the links so it would only query database ones if previous link was the same as current, but once a different link created all cache is gone. My code caches all links, so no duplicate database query will be made.

Another thing many people don't know about is that template can dramatically affect on site performance. As more code in the template, as more work template parsing code have to do, slowing down the page creating process.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)