I hope I'm posting this in the proper place.
A client of mine is running Drupal 6 on IIS7, and has started getting more traffic (about 6000 hits/day, 98% anonymous) resulting in server CPU (2GHz Xeon) being completely maxed.
I'm trying to find the bottleneck, and I've stumbled on something which I'm not sure what to make of: In trying to debug Boost's performance on this server I inserted a watchdog notice in hook_init() and found that any page load can fire hook_init() as many as 20 or 30 times.
This has to be a bug right? I don't believe hook_init() should ever run more than once, with the possible exception of asynchronous events that may fire bootstrap.
I can't find anything in my code that could be causing this issue. If anyone has any tips on debugging it I would greatly appreciate them!
Comments
Don't forget to look at the forest.
Even if you found a interesting-seeming tree.
Get XHprof set up. Consider using New Relic.
Actually figure out where your performance problems are, then tackle them in order based on resource cost.
Where did you put the watchdog? In somemodule_init()? Otherwise it might be running several times because you have greater than one module with an init.
I would recommend getting a
I would recommend getting a free trial of new relic or tracelytics to see what is going on. The detail view in tracelytics of a single process would help identify where or why you are seeing things like hook_init fire multiple times.
Thank you
Thank you for the responses!
Yep, in somemodule_init()
Going to try New Relic first since it looks like it will run on Windows, hopefully I can track this down.
Just one module?
So you are saying that just one module's hook_init() is being fired 20 or 30 time per page view?
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
Yes
Yes...that's what I'm seeing.
I believe this morning I've narrowed it down to an imagecache issue, at least it I've determined that hook_init() is being invoked when (some? any?) images are requested from the server. Not sure if it is normal practice for drupal to bootstrap when an imagecache image is generated, but I'm a little closer. This is certainly the performance issue I've run into, i've tabled php profiling until i get this one solved.
Thank you for the response!
Ah.. imagecache.
If a path in files doesn't exist, it gets handled by Drupal (this is how imagecache is able to generate the files).
If a file can't be generated (invalid path), then it will continue to happen.
Fix your 404s and you should see relief.
I've seen imagecache need to
I've seen imagecache need to regenerate a file every time if the filename contains any non-ascii characters. To get around this you can use Transliteration module
http://drupal.org/project/transliteration
--
Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his
Simillar case here, Drupal 6 on IIS7 being slow
I checked New Relic compatibility and it is not compatible with IIS7, I used an IIS7 shared server also and have a slow website too, I hope I can find a module to examine the problem, i guess when i will get fedup I will use Netbeans to debug the website (maybe yes maybe no).
@vood002 do you mean that calling the images from the database will make the website faster, because I also upload my images (which are not so much) from the server via ftp and call it from my website using '<'img srs'>' (you can see the html code yourself) and all this because the .htaccess file keep creating in site/default/file hope i got it right.
I am not a php developer but any .Net software engineer can understand what you are talking about
my website
http://www.StrongerStudents.com
Maybe You could, for
Maybe You could, for debugging purposes (if you really want to find out what's going on there), install virtualbox, do a quick ubuntu-server install and set up casual LAMP stack on it. shouldn't take more than 2 hours to set all up, but you'll be able to do in-depth debugging later on.
my issue was with imagecache
@Abyooda:
I was experiencing a specific problem, which i eventually tracked down to some manual calls to imagecache, requesting images such as /sites/default/files/imagecache/preset/sites/default/files/images/image.jpg
I believe it was a rewriting issue, the result was that drupal would generate the file in the directory /sites/default/files/imagecache/preset/ (ignoring the rest of the directory structure), then when it was requested again drupal would perform another bootstrap since the file was not at the expected location.
I did find a very helpful thread on general IIS7 performance here: http://groups.drupal.org/node/60283
@all other responders: Thanks for the input and support. You helped me track this issue down and the site in question is out of red alert status.
Thanks Alot
I guess a quick solution to just throw your images into /sites/default/files/imagecache/preset/ and see what would happen if I am not wrong.