Score:0

Initial server response time for different cached pages

mz flag

I have been trying to speed up a Drupal site and measuring speed through page speed insight. What really has puzzled me for last few weeks of experiments is that node pages score an average of 170-200ms on 'initial server response time' while taxonomy pages (which are far more important from SEO speed point of time) take an average of 720-750ms in terms of initial page response time.

(Drupal 7, Nginx, Php-fpm, large site with over 100K nodes).

These are all cached pages (tried both Database and Memcache) using Page cache for anonymous users. Why is it taking 4 times more longer for Drupal to serve cached HTML of a term page versus cached HTML of a node page?

I am really stumped. Only time this changes is when I restart the Php-fpm. For a few minutes, term pages are close to 300ms before going back to 700+ms in few minutes.

Any ideas on what could be causing this? Could it be a php configuration issue?

JM John avatar
mz flag
Update - Changing Opcache to file cache has shaved 100ms off slow pages. I guess this explains why site feels faster after restarting php-fpm. Credit to this thread: https://forums.cpanel.net/threads/websites-works-fast-after-restarting-fpm.637557/
id flag
The only way to know for sure is to profile.
cn flag
Have you confirmed (by headers or stepping through the code) that the pages are definitely being served from cache?
JM John avatar
mz flag
@Clive yes definitely going through Cache. Without Cache, those pages take over a second.
JM John avatar
mz flag
@cilefen How would you profile a Cache being delivered from database? Any help would be great!
JM John avatar
mz flag
@Clive sorry spoke too soon. It appears term pages aren't going through Cache at all. These are views pages. When I disabled Views caching, changes were showing without cache.
JM John avatar
mz flag
Now what's really happening here. Term pages are view based and views are cached. Now when some node updates and view needs to change, it expires the term page and anonymous users have the fresh page but logged in users still have old content. Is this the intended behaviour? I have minimum cache set to one hour and both page and block cache enabled.
id flag
Technically an answer to this question is "Upgrade to Drupal 10". Current releases have essentially solved this problem. In Drupal 7 I think you have to fiddle around with the Expire module.
JM John avatar
mz flag
@cilefen I agree - just too many legacy modules but we have to upgrade sooner or later I guess.
Score:1
mz flag

Finally got it to work.

Mistake I made was following.

While setting Cache for views, in the block setting page, I had selected 'Cache for every page'. This was generating and saving a copy of cache for lots of utm parameters/tracking variables and filled up Memcache instance.

Due to amount of views present on term pages, it was slowly them down.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.