Extremely slow to load pages and use 100% CPU
Posted Sep 26, 2013 - 3:11 AM:
HelloPaul
In recent weeks,I have a problemwith thisscript. 1 -This problem isextremely slowto loadpagesanduse100% CPU ofmy hosting. 2 - Inaddition, whenyourupdates, many files are not copiedcorrectly, there are onlya few hundred linesthentheyshouldmake a few thousand.
Foroneproblem, would it notdownload.phpfile used todisplaypictures ofcategories? A simpledisplaywould itnotless greedybecause eachpagethereare 40picturesto display. Andthenanother portion of thescriptin a loop.
Here is themessage received frommyhost: CPU resources were limited for your site
Your site might hit resource limits soon
You had 10 entry processes (number of simultaneously running php and cgi scripts, as well as cron jobs and shell sessions) out of 10 max entry processes allowed
You had 999 I/O usage out of 1024 max I/O usage allowed
And this is whatgives me theCPU usageof myhosting,this for6 pagesdisplayedwith thisscript:
Current Usage
Description
Usage
Limit
Fault
CPU Usage
100%
100%
-
I/O usage
0
1024
-
Entry Processes
6
10
0
Physical Memory Usage
221.16M
1.00G
0
Virtual Memory Usage
191.29M
1.00G
0
Can you lookatthese problemsin advancethank you. Cordially. Fancis
Were you seeing download.php used for displaying images? If so, this may be a template problem. Make sure you're displaying images with the thumbnailing template variables and not the download template variables. For a custom category field, <img src="{CATCUSTOMATTACHTHUMBURL[100 <,> 100]}">
I see {CATFOLDERIMAGE} is serving up the download.php's instead of making a thumbnail. The solution is more complicated than anticipated but I'm working on it.
Fixed so all the folder images are cached 200x200 thumbnails now. Let me know if the load remains high.
2 - In addition, when your updates, many files are not copied correctly, there are only a few hundred lines then they should make a few thousand.
I've never seen this happen, but it's suggestive of a timeout stopping the upgrade in the middle. It could be that this server does filesystem operations slower than most, or that something in the site configuration makes upgrades slower (though I can't see what that could be).
I just testedand the problem isalways the same. Attached is theresult of theCPU usageof mycPanel.
These photosare those thatare beforethe titleof the article andeachpagedisplaysa list of theseitemsso40titles40 photos.
Thefields in thedatabase isimagearticleattach(egcontent forAiredaleraceon the first pageof the list-7c5b3.wsn[,]7.jpg[,]2[,]200[,]160 - WhenI checktheinformationof the photo withFirefox,I havethis: www.milouchouchou.com/artic...p;field=imagearticleattach
- For the problemof damagedwhen transferringfiles, I getthe file from thepreviousR1Softbackupserverand Isent backwithFileZilla,it is the onlysolution I'vefoundyet.
the 40breedson this page arethose who usethese photos inthe title, thefivelinks to thecategoriesabovealsoreferto lists ofbreeds thatuse photosin the title.
All the articlesin other categoriesalsohavea photoin the title.
I see it's taking over half a second to process template variables for each listing there, which is much slower than for my sites strangely... I'll step through the source to try to determine why.
You'd get much faster rendering if you changed the 40 listings per page to a smaller number, but it shouldn't be this slow per listing.
I just testedwith12 items per pageand this gives: 30totalqueries Thispagewascreated in4.89seconds Whatstill seemsexcessive.
Compared to28.01secondsfor40 items, the difference inloading timeis notrelated,4.89secondsmultiplied by3should giveabout 15seconds to a fewtenthstofourmoretitles, orto display40 titels is thedouble ofthis theory.
The problemoccurswithFirefox, Chromeand Operabrowsers.
It'sreally notmy weekwith thisscript. I am preparing asmall fileto explainsomeproblemsencountered withmultilingualdisplaytranslationsof the script.
Iexpectthat the currentproblem is resolvednot to overloadyou, so I'mwaiting for yourgreen lightbefore suggestingthese problems.
For information,here is theconfiguration of myPC FujitsuSiemens Intel(R) Core (TM)2 QuadCPUQ9300 @ 2.50GHz2.50GHz Memory4.0Gb WindowsVista Servicepack 232 bit AntivirusAVGInternet Security2013
Parse errors just show up while I'm in the middle of uploading a change and it hasn't fully uploaded yet.
I went through everything carefully for the past 4 hours and made a bunch of optimizations but they were only able to shave a few seconds. There's no specific bottleneck, each template variable is being processed in about a hundredth of a second but there are 30 template variables per listing (after I wrote an optimization to remove duplicates and removed some unnecessary bits from your listing bit) and 40 listings.
There are no slow mysql queries, it's just processing all those template variables.
Compared to 28.01 seconds for 40 items, the difference in loading time is not related, 4.89 seconds multiplied by 3 should give about 15 seconds to a few tenths to four more titles, or to display 40 titels is the double of this theory.
The slowness of a page naturally snowballs as the longer it takes to finish the higher the server load goes and the higher the server load goes the slower the script runs.
Leaving it at 12 per page would cause the load to subside over time which might make it start to run a little faster than 5 seconds.
Comments on Extremely slow to load pages and use 100% CPU
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Posted Sep 26, 2013 - 3:11 AM:
Hello Paul
In recent weeks, I have a problem with this script.
1 - This problem is extremely slow to load pages and use 100% CPU of my hosting.
2 - In addition, when your updates, many files are not copied correctly, there are only a few hundred lines then they should make a few thousand.
The cache script was regenerated and nothing changes the problem.
For one problem, would it not download.php file used to display pictures of categories?
A simple display would it not less greedy because each page there are 40 pictures to display.
And then another portion of the script in a loop.
Here is the message received from my host:
CPU resources were limited for your site
Your site might hit resource limits soon
You had 10 entry processes (number of simultaneously running php and cgi scripts, as well as cron jobs and shell sessions) out of 10 max entry processes allowed
You had 999 I/O usage out of 1024 max I/O usage allowed
And this is what gives me the CPU usage of my hosting, this for 6 pages displayed with this script:
Can you look at these problems in advance thank you.
Cordially.
Fancis
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Were you seeing download.php used for displaying images? If so, this may be a template problem. Make sure you're displaying images with the thumbnailing template variables and not the download template variables. For a custom category field, <img src="{CATCUSTOMATTACHTHUMBURL[100 <,> 100]}">
I thought you sent me an inspection request recently but I can't find it so please send: http://www.wsnkb.com/inspection.html
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
When I look at the image information of the categories, I see this:
]http://www.milouchouchou.com/artic...=imagearticleattach
I remind you that this is a custom field.
I send you an inspection as you ask.
Cordially.
Francis
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I see {CATFOLDERIMAGE} is serving up the download.php's instead of making a thumbnail. The solution is more complicated than anticipated but I'm working on it.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Fixed so all the folder images are cached 200x200 thumbnails now. Let me know if the load remains high.
2 - In addition, when your updates, many files are not copied correctly, there are only a few hundred lines then they should make a few thousand.
I've never seen this happen, but it's suggestive of a timeout stopping the upgrade in the middle. It could be that this server does filesystem operations slower than most, or that something in the site configuration makes upgrades slower (though I can't see what that could be).
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Hello Paul
I just tested and the problem is always the same.
Attached is the result of the CPU usage of my cPanel.
These photos are those that are before the title of the article and each page displays a list of these items so 40 titles 40 photos.
The fields in the database is imagearticleattach (eg content for Airedale race on the first page of the list - 7c5b3.wsn [,] 7.jpg [,] 2 [,] 200 [,] 160 -
When I check the information of the photo with Firefox, I have this:
www.milouchouchou.com/artic...p;field=imagearticleattach
- For the problem of damaged when transferring files, I get the file from the previous R1Soft backup server and I sent back with FileZilla, it is the only solution I've found yet.
Good day.
Cordially.
Francis
Attached Files:
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I didn't notice you had a custom listing field too. Can you link me to the URL of the page those images appear on? I can't find them.
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
If you go to this link
www.milouchouchou.com/artic...icles/les-races-de-chiens/
the 40 breeds on this page are those who use these photos in the title, the five links to the categories above also refer to lists of breeds that use photos in the title.
All the articles in other categories also have a photo in the title.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
All of those are cached now, is the load down?
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Hello Paul
Thank you to work on the problem, but it's really not what we can "fast" although everything is cached.
I enabled the debug mode, which always works for you check.
For the home page, it is time to load but reasonable http://www.milouchouchou.com/articles/
24 total queries
This page was created in 2.13 seconds
For the presentation page of races, it is still extremely long to load www.milouchouchou.com/artic...icles/les-races-de-chiens/
30 total queries
This page was created in 28.01 seconds
For rare breeds page with only 14 photos for 40 titles, it is also far too long www.milouchouchou.com/artic...les-races-de-chiens-rares/
29 total queries
This page was created in 9.38 seconds
For comparison, the main home page of my site with 11 photos is load http://www.milouchouchou.com/
Page loaded in 0.096 seconds
Sorry to insist with the loading time, but there must be a serious problem somewhere.
Cordially.
Francis
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
I see it's taking over half a second to process template variables for each listing there, which is much slower than for my sites strangely... I'll step through the source to try to determine why.
You'd get much faster rendering if you changed the 40 listings per page to a smaller number, but it shouldn't be this slow per listing.
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
I just tested with 12 items per page and this gives:
30 total queries
This page was created in 4.89 seconds
What still seems excessive.
Compared to 28.01 seconds for 40 items, the difference in loading time is not related, 4.89 seconds multiplied by 3 should give about 15 seconds to a few tenths to four more titles, or to display 40 titels is the double of this theory.
The problem occurs with Firefox, Chrome and Opera browsers.
It's really not my week with this script.
I am preparing a small file to explain some problems encountered with multilingual display translations of the script.
I expect that the current problem is resolved not to overload you, so I'm waiting for your green light before suggesting these problems.
For information, here is the configuration of my PC
Fujitsu Siemens
Intel (R) Core (TM) 2 Quad CPU Q9300 @ 2.50GHz 2.50 GHz
Memory 4.0 Gb
Windows Vista Service pack 2 32 bit
Antivirus AVG Internet Security 2013
Cordially.
Francis
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Currently Parse error: syntax error, unexpected T_IF in /home/milouch1/public_html/articles/includes/commonfuncs.php on line 4956
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
Parse errors just show up while I'm in the middle of uploading a change and it hasn't fully uploaded yet.
I went through everything carefully for the past 4 hours and made a bunch of optimizations but they were only able to shave a few seconds. There's no specific bottleneck, each template variable is being processed in about a hundredth of a second but there are 30 template variables per listing (after I wrote an optimization to remove duplicates and removed some unnecessary bits from your listing bit) and 40 listings.
There are no slow mysql queries, it's just processing all those template variables.
Compared to 28.01 seconds for 40 items, the difference in loading time is not related, 4.89 seconds multiplied by 3 should give about 15 seconds to a few tenths to four more titles, or to display 40 titels is the double of this theory.
The slowness of a page naturally snowballs as the longer it takes to finish the higher the server load goes and the higher the server load goes the slower the script runs.
Leaving it at 12 per page would cause the load to subside over time which might make it start to run a little faster than 5 seconds.
Forum Regular
Usergroup: Customer
Joined: Nov 05, 2006
Location: Borlo Belgique
Total Topics: 27
Total Comments: 121
Ok Paul, thank you for this work.
I leave 12 items per page in order to have a normal loading time, I understand the number of variables to be processed for each template.
I'm sure visitors will enjoy the site came back with normal speed.
Then will the multilingual issues, demand is ready to be sent on the forum.
Good Sunday.
Cordially.
Francis