Hi. My Drupal site has become very slow. I'm trying to analyze what the issue could be, and I'm stuck.

Our site is visible here.

I'm not sure why this is happening and I've been struggling to figure out why. Click around to some of the other pages. It'll probably take a minute or so to load each one. I turned the ad blocker on and it's still very slow.

Thanks,
Brendan

Comments

bdparker’s picture

I'm able to say that it's likely slow due to an alarmingly high MySQL usage. My host confirms this, but doesn't really know how to fix it. They say it's because of the code, but I didn't do anything out of the ordinary. Could there be processes running I can cancel? Is there anything I can do?

There seems to be only one query running now, but it's taking up a lot of space:
| 362870 | catholic_drpl1 | localhost | catholic_drpl1 | Query | 45 | Sending data | SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM node node

My host recommends I start optimizing MySQL queries, database indexing, and maybe moving some of the larger tables that get a lot of writes to InnoDB. I don't know what any of this is. I'm new to Drupal and didn't write any database scripts to build this site.

My database is ~750 MB which isn't huge.

pixelsweatshop’s picture

I can a ton of things wrong with your site and why it's running slow. Just running firbug net console, I can see that there are about 6 images missing that throwing 404s that are taking a few seconds to respond. I can see the addthis.js taking forever to load from their cdn. I can see your images sizes are huge, that can easily be scaled down. You don't have your css/js aggregated. I can see calls out to your ad platform taking forever. This is just a few insights. Try using firebug (or similar) to see where the bottle necks are and work on them one by one. GOod luck.

bdparker’s picture

Thanks, but... I think most of that is resolved.

The 6 missing images... where are these? It might have been a cache issue, but I haven't found any.
I removed addthis.js. I don't like those addons. :) Too much overhead. I'll build my own.
Image sizes are somewhat large, but I've scaled them down in the Drupal Image settings so that they are a close match for the frame which holds them.
I aggregated my CSS and JS. I thought it would be a daunting task. Nope. Just a checkbox. :)
Yes, calls to ads take forever. There's nothing I can do about that, but I have the ad blocker on, and it's still slow.

The bottleneck is with MySQL, and I'm not sure how to approach it. My tables are InnoDB, I optimized them all this morning, and I'm not sure what else to try.

pixelsweatshop’s picture

The 6 missing images

icon_instagram@2x.png:1 GET http://ccdrupal.dor.org/sites/all/themes/parker_theme/images/icon_instag... 404 (Not Found)
cc@2x.png:1 GET http://ccdrupal.dor.org/sites/all/themes/parker_theme/images/cc@2x.png 404 (Not Found)
icon_twitter@2x.png:1 GET http://ccdrupal.dor.org/sites/all/themes/parker_theme/images/icon_twitte... 404 (Not Found)
icon_youtube@2x.png:1 GET http://ccdrupal.dor.org/sites/all/themes/parker_theme/images/icon_youtub... 404 (Not Found)
icon_pinterest@2x.png:1 GET http://ccdrupal.dor.org/sites/all/themes/parker_theme/images/icon_pinter... 404 (Not Found)
icon_facebook@2x.png:1 GET http://ccdrupal.dor.org/sites/all/themes/parker_theme/images/icon_facebo... 404 (Not Found)
enews_signup@2x.gif:1 GET http://ccdrupal.dor.org/sites/all/themes/parker_theme/images/enews_signu... 404 (Not Found)
news20@2x.png:1 GET http://ccdrupal.dor.org/sites/all/themes/parker_theme/images/news20@2x.png 404 (Not Found)

Image sizes are somewhat large, but I've scaled them down in the Drupal Image settings so that they are a close match for the frame which holds them

.

I am not referring to image dimensions. I am referring to file size. However, we addressed this issue in your other forum post.

but I have the ad blocker on, and it's still slow.

Even if you have ad blocker turned on, it still loads the ads. It just doesn't show them to you.

The bottleneck is with MySQL, and I'm not sure how to approach it. My tables are InnoDB, I optimized them all this morning, and I'm not sure what else to try.

Based on my cursory look at the site, your problems are front-end. I can see some google ads stuff get aborted because it is being blocked by google. Maybe because you haven't authorized this url. Not sure. You can also start removing unused modules. disabling UI/dev modules. Try also using better caching on your views. Try installing the advagg module.

Also, your LATEST PHOTOS & VIDEOS section is loading way too much. try limiting it to 10 or less items. The sheer number of resources you ae trying to load on your homepage is just too much. If you want all of that, then it will come at a cost. TIme to load.

Also allocate some more ram to drupal. how much do you have now?

bdparker’s picture

Again, thanks for a thorough response!

The 6 missing images...
Where in the heck are those coming from? I can't find that URL anywhere... in site checkers, in the source, in the code. I'm not sure how to find those.

I am not referring to image dimensions. I am referring to file size. However, we addressed this issue in your other forum post.
Yep. A good point, and something we addressed in the other thread. I'm having some troubles with it.

Even if you have ad blocker turned on, it still loads the ads. It just doesn't show them to you.
True. Just making a point. :)

Based on my cursory look at the site, your problems are front-end. I can see some google ads stuff get aborted because it is being blocked by google. Maybe because you haven't authorized this url. Not sure. You can also start removing unused modules. disabling UI/dev modules. Try also using better caching on your views. Try installing the advagg module.
Maybe. I'm not crazy about the number of ads they choose to feature on the site, but I did remove unused modules. I'm trying advagg, but it doesn't seem to do anything.

Also, your LATEST PHOTOS & VIDEOS section is loading way too much. try limiting it to 10 or less items. The sheer number of resources you ae trying to load on your homepage is just too much. If you want all of that, then it will come at a cost. TIme to load.
GOOD CATCH! Fixed.

Also allocate some more ram to drupal. how much do you have now?
8GB of 8GB, according to my host. I may need to purchase more, which I will if I need it.

pixelsweatshop’s picture

Where in the heck are those coming from? I can't find that URL anywhere... in site checkers, in the source, in the code. I'm not sure how to find those.

It looks like those are retina versions of those images. Maybe you are using https://www.drupal.org/project/touch_icons and haven't created your derivatives.

Maybe. I'm not crazy about the number of ads they choose to feature on the site, but I did remove unused modules.

It's not just the number of ads but the fact that some of the google scripts are being blocked and messing with your load time.

I'm trying advagg, but it doesn't seem to do anything.

See https://www.ostraining.com/blog/drupal/advagg/ for instructions.

8GB of 8GB, according to my host. I may need to purchase more, which I will if I need it.

That's what it is for the entire server. How much is allocated to drupal? What is your setting for memory_limit in your php.ini?

As mentioned, you have a lot of http requests on your homepage alone. 144 last time I checked (most are less than half that). That is just way too much. You are going to have to work to get that down. the fastest I could get your homepage to load was 11.3 seconds. It should be less than 2.

Did you set cache for your views as I mentioned in my previous posts? Do you have cache turned on?

Try installing entity cache as well

bdparker’s picture

It looks like those are retina versions of those images. Maybe you are using https://www.drupal.org/project/touch_icons and haven't created your derivatives.
Maybe I am.

It's not just the number of ads but the fact that some of the google scripts are being blocked and messing with your load time.
Yeah. I removed all ads (scripts and all) and I'm still having load troubles. I've since put them back.

See https://www.ostraining.com/blog/drupal/advagg/ for instructions.
I will. Thanks.

That's what it is for the entire server. How much is allocated to drupal? What is your setting for memory_limit in your php.ini?
I did a phpinfo() and found that my memory_limit is 64M. What should I up that to?

As mentioned, you have a lot of http requests on your homepage alone. 144 last time I checked (most are less than half that). That is just way too much. You are going to have to work to get that down. the fastest I could get your homepage to load was 11.3 seconds. It should be less than 2.
What's the best way to approach that? When the site loads properly, it's about 2 seconds. When it stalls, it can take much longer.

Did you set cache for your views as I mentioned in my previous posts? Do you have cache turned on?
Yes. As far as I know, I did it correctly.

Try installing entity cache as well
I think I did and got rid of it. I'll try it.

pixelsweatshop’s picture

I did a phpinfo() and found that my memory_limit is 64M. What should I up that to?

I would do at least 256. Maybe even 512 as you have a decent vps and enough ram to allocate.

What's the best way to approach that? When the site loads properly, it's about 2 seconds. When it stalls, it can take much longer.

This is going to be little steps at a time. See https://gtmetrix.com/reports/ccdrupal.dor.org/19uXCAYg and fix the issues one by one.

Yes. As far as I know, I did it correctly.

See https://drupal.stackexchange.com/questions/22724/are-views-cached-throug... to confirm

bdparker’s picture

I would do at least 256. Maybe even 512 as you have a decent vps and enough ram to allocate.
Ok, I'll ask the host to boost that up unless I find where to do that in WHM or cPanel. I don't think I have access to that root file, but I'll do some digging.

This is going to be little steps at a time. See https://gtmetrix.com/reports/ccdrupal.dor.org/19uXCAYg and fix the issues one by one.
Yeah! I've been using that. Our score's actually pretty good. It's about a C-D rating, but mostly because of images and the ads. If I remove the ads, it jumps to a 2.3 second load time and A-B rating... way better than average.

See https://drupal.stackexchange.com/questions/22724/are-views-cached-throug... to confirm
Ok, I read through it. That's a good answer. It sounds like the best approach is to manually edit the views and turn on caching for each one? That's how I interpreted it.

Thanks again!

pixelsweatshop’s picture

Ok, I'll ask the host to boost that up unless I find where to do that in WHM or cPanel. I don't think I have access to that root file, but I'll do some digging.

You should be able to ask them to put a php.ini file that is compatible with teir setup into your site root so you can modify stuff you want.

If I remove the ads, it jumps to a 2.3 second load time and A-B rating... way better than average.

Yeah, those ads are going to kill you. I know they are a must but you might want to show them the tradeoff.

It sounds like the best approach is to manually edit the views and turn on caching for each one? That's how I interpreted it.

Correct. the longer you can cache the better. You can also look at https://www.drupal.org/project/views_content_cache which will let you refresh the view if it detects new content.

bdparker’s picture

Ok, after trying a bunch of things, I realized it's my taxonomy view which is causing the problem. I detailed it in another thread:
https://www.drupal.org/node/2897899