Huge drop in website speed for logged in users when using Litespeed

Hi,

I use Litespeed on my website, like many others. I set it up like in the Hivepress blog How to Speed up a HivePress-built Website | HivePress Blog

Navigating my site goes more or less quickly when not logged in. But for logged in users, it drops in speed drastically. Like 4 to 7 seconds to load a listing search page, or a listing page. And when navigating back to the same visited page, it takes the same time, while it should be almost instant.

It must have to do with the “Cache Logged-in Users” set to OFF, that you have recommended in many many answers, because that setting affects some forms. When I set it to ON, it goes fast again.

I have seen that this is a recurring topic. I understand that setting it ON might create conflicts, but the user experience when logged in is quite terrible because of this. It would be great if you could update your blog post some time with more up to date info. And maybe investigate exactly when this option creates conflicts, so we can configure it not to cache those problematic pages. In some post I read it was mainly the listing submit form, or similar.

Hopefully you can help, or someone has figured out a good general setting for Litespeed.

Thanks

Hi,

Website performance depends on many factors. For example, media files take the longest to load, so please make sure you have image optimization enabled.

Regarding the slow loading of search listings, this should work faster than what you’re experiencing. Could you let me know how many listings you have? Also, please make sure your hosting plan is suitable for your site’s needs.

We also recommend using the Query Monitor plugin, which allows you to see what’s taking the longest to load and identify performance bottlenecks.

Hi,

my website just started like a month or two ago, with zero listings, only a few test listings, so for sure that’s not the issue. I do use image optimization as well.

Without caching logged in users, after logging in the listings indeed take ages to load, up to 7 seconds sometimes. But because caching logged in is OFF, reloading the same page takes the same amount of time each time.

I installed your recommended Query Monitor plugin. I have to mention that both the Listings and the Listing templates are heavily customized by me.

When testing with that plugin in a listing page, it shows a few things:

  1. Errors in scripts: there are like 74 scripts running, but the only ones showing errors are the geolocation ones. I’ll just copy paste:

|Missing Dependencies|geocomplete||[wp-content/plugins/hivepress-geolocation/assets/js/jquery.geocomplete.min.js]|google-maps (missing)||1.3.7|

|Missing Dependencies|markerclustererplus|[wp-content/plugins/hivepress-geolocation/assets/js/markerclustererplus.min.js]|google-maps (missing)||1.3.7|
|Missing Dependencies|markerspiderfier|[wp-content/plugins/hivepress-geolocation/assets/js/oms.min.js]|google-maps (missing)

This is funny because I use Mapbox with a Mapbox API key. No idea with it wants to load Google maps. This happens in every page of my website by the way, not only the listing page. Why does it want to load Maps in a Privacy policy page?

  1. It shows around 580 duplicate database queries. I use a lot of code snippets that retrieve data from the current listing for many things, and after deactivating a specific one, it reduced to 67 queries. Deactivating all others has no effect. There is still sth going on. Most duplicate queries relate to 1. WP_Term_Query->get_terms and as troublemaker: themes/rentalhive/header.php and themes/rentalhive/footer.php
  2. It sometimes throws a PHP error: Undefined array key “type” 1. wp-content/plugins/hivepress/includes/models/class-model.php:145

Is there any help for at least the first issue?

Thanks for the details. Please let me know if you tried to deactivate all the code customizations (e.g. if you keep them in the Code Snippets plugin you can deactivate the plugin, if you use a child theme, switch to the parent theme), and check if the issue persists?

I use a lot of code snippets that retrieve data from the current listing for many things

If you mean customizations related to retrieving data, these may affect the performance if queries are not optimized, or queries are repeated per listing. For built-in queries, we often use caching (e.g. to cache taxonomy term labels per listing to avoid extra queries).

If you have a similar number of listing or overall content as on the demo site, please log in with demo/demo to check if there are similar performance issues https://listinghive.hivepress.io/ We use LiteSpeed and the most basic DigitalOcean server.

While we can’t guide on the website optimization in detail (this requires research per website since every website is unique in terms of customizations, plugin combos, hosting, etc), if there are customizations I recommend gradually disabling them to check if you have the same issues with unchanged HivePress installation (with extensions), you can do the same with third-party plugins (a single, even simple plugin can affect performance).

Regarding the undefined “type” error, it seems that there’s a listing field (attribute) without the type set, please check if there are any custom attributes (added in Listings/Attributes, or maybe custom code snippets) that don’t have the field type selected/defined.

Please ignore the JS dependency notices as these don’t affect the functionality, we use dependencies as a way to load scripts on demand. Since Google Maps are not loaded, dependant scripts are not loaded either (this way we can simply disable Google Maps in the code and be sure that scripts related to Google Maps will also not load), but Query Monitor shows a notice about this just in case if we set dependencies incorrectly and are not aware that scripts are not loaded.

Hope this helps

Thank you both

The Query Monitor plugin helped me identify a few issues and I managed to reduce loading times to around 3 seconds, more or less like the Rentalhive demo.

Also for other users’ information, the Lazy load function in Litespeed or in some image optimizers had a big influence as well, since it was forcing lazy loading images above the fold, causing big delays.

I still see duplicated database queries (about 70) when I open a listing but it seems unavoidable somehow.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.