Jump to content

[SOLVED] Very slow pagination


sococa

Recommended Posts

Server OS: Linux #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64

Web Server Software Version: LiteSpeed

PHP Version: 8.1.27

Memory Limit: 3072M

Max Execution Time: 480

Max File Upload Size: 3072M

PrestaShop Version: 8.1.1

Shop URL: https://lebrun.fr/prestashop/

Active Theme: lebrun (essentially the classic theme)

MySQL Version: 10.11.7-MariaDB-cll-lve

MySQL Server: 127.0.0.1:3306

Website URL: https://lebrun.fr/prestashop/

 

Hi everyone,

The pagination is extremely slow (more than 10 seconds). This is the only time the site is slow. Otherwise, the navigation is fine.

Also, once I have already paginated to a page, that page becomes fast. Has anyone encountered this problem before? I haven’t found any similar cases on the web except for one person who suggests enabling gzip here.

I have optimized the images, enabled various caches on PrestaShop and on the server, installed the Product List Pagination module, but nothing works.

Thank you for your help!

4o

Edited by sococa (see edit history)
  • Sad 1
Link to comment
Share on other sites

  • 1 month later...

I'm experiencing the exact same issues. I've tried Prestashop versions 1.7 and 8.1, and I'm having the same problems with all versions except for 1.6, which I'm currently using.

Here's my situation:

I've been using Prestashop 1.6 for the last 10-12 years.

I've been trying to upgrade to the latest version for the past 2-3 years (yes, you read that right!).

So, what's preventing me from upgrading? Here are the issues:

  1. Slow pagination: After upgrading to any latest version like 1.7.x.x and 8.1.x.x, pagination becomes very slow. It loads slowly at random, sometimes working fine for the first 4-5 pages, then becoming very slow and taking 10-12 seconds to load every next page. The pages load instantly when I visit them again.
  2. Slow orders page loading: The orders page in the backend takes around 120 seconds to load. The same page takes just 4-5 seconds to load in Prestashop 1.6 (there are lots of orders).
  3. Overall slow backend performance: Compared to Prestashop 1.6, the overall backend performance feels slow.


I've tried the following:

  1. Uninstalled almost every module (including Faceted search).
  2. Used Memcached cache.
  3. Enabled/Disabled OpCache and Prestashop cache.
  4. Used different servers like Ubuntu, CentOS, Alma, Rocky, etc., with different configurations.
  5. Used different PHP versions from 7.4 to 8.2.
  6. Used different web servers like Apache and Nginx.
  7. Optimized the database.
  8. Re-built the search index and re-generated the images.
  9. Tried different themes.
  10. Hired some developers to fix the issues, but they couldn't understand the problem and blamed the large data. They said Prestashop 1.6 is very efficient in handling large data, but Prestashop completely restructured their code for later versions, which might be the problem. So I deleted all orders for testing, and it fixed the order page loading issue as expected (Deleting the orders is not a solution though). The pagination issue was not fixed even after deleting the orders.

My current staging server configuration:

  • Server OS: AlmaLinux 9.4 (Seafoam Ocelot)
  • CPU: AMD EPYC-Milan Processor (8 cores)
  • RAM: 16.00 GB
  • Web Server Software Version: Nginx 1.26.1.1-2
  • PHP Version: 8.2.22
  • Memory Limit: 4096M
  • Max Execution Time: 600
  • Max File Upload Size: 128M
  • PrestaShop Version: 8.1.7
  • Theme: Default Classic theme
  • Control panel: Plesk Obsidian 18.0.63

I hope someone can help me resolve these issues.

Kind Regards

Edited by ZMR (see edit history)
Link to comment
Share on other sites

47 minutes ago, ZMR said:

I hope someone can help me resolve these issues.

due to some specific differences in Operating Systems, Theme applications, modules, version to version, most shops are not so similar.
What all shops have in common is the database. Go to your backend and delete all those customers which are from years back.
You should save their emails though.

You server could also be the issue slowing down, the differences from hdd vs ssd are dramatic.

Edited by Nickz (see edit history)
Link to comment
Share on other sites

The server has NVMe storage with 8 core processor and 16 GB of RAM, and I have also uninstalled all modules.

I have mentioned what I have tried, please check and provide other suggestions if possible.

6 minutes ago, Nickz said:

due to some specific differences in Operating Systems, Theme applications, modules, version to version, most shops are not so similar.
What all shops have in common is the database. Go to your backend and delete all those customers which are from years back.
You should save their emails though.

You server could also be the issue slowing down, the differences from hdd vs ssd are dramatic.

 

Link to comment
Share on other sites

9 hours ago, ZMR said:

 

I've been using Prestashop 1.6 for the last 10-12 years.

Clean your database.  What does the DB hold on data? MB or GB?

8 hours ago, ZMR said:

please check and provide other suggestions if possible.

 

Link to comment
Share on other sites

@ZMR Finally someone who understand my pain !
Is this a cache problem (i use MemCache too) ? Because when loading a page upstream, the loading is instantaneous.
But i didn't succeed to solve the problem. 

I saw that we can activate the Gzip compression on the web server, but despite that i followed the doc, this seems to be not enable. have you ever tried this ?

Link to comment
Share on other sites

12 hours ago, sococa said:

@ZMR Finally someone who understand my pain !
Is this a cache problem (i use MemCache too) ? Because when loading a page upstream, the loading is instantaneous.
But i didn't succeed to solve the problem. 

I saw that we can activate the Gzip compression on the web server, but despite that i followed the doc, this seems to be not enable. have you ever tried this ?

Yes, I also used gzip, but it did not fix the problem. I tried every possible solution, but nothing worked so far.

Link to comment
Share on other sites

48 minutes ago, ZMR said:

Yes, the database is huge. Mine is 3.35 GB.

With 3.35 GB is no wonder that the pagination is pretty slow. Get rid of dead accounts ober the back end. After backing up the data of course.

  • Like 1
Link to comment
Share on other sites

10 hours ago, Nickz said:

With 3.35 GB is no wonder that the pagination is pretty slow. Get rid of dead accounts ober the back end. After backing up the data of course.

I understand, but the loading time should be similar for all pages. If one pagination page takes 10-12 seconds, then all pages should take a similar amount of time. However, the pagination loads instantly for most pages, then gets randomly stuck at some point, loads the next 3-4 pages very slowly, and afterwards loads instantly again.

Interestingly, it seems that version 1.6 is more efficient at handling large data than later versions. For example, the "Orders" page in the backend takes around 7-8 seconds to load in PS 1.6, whereas the same page takes around 120 seconds in all later versions. Old is indeed gold!

I'll try all upcoming versions and hope they'll improve handling of large data. Until then, I'm content with my PS 1.6.

I appreciate all your help :)

  • Like 1
Link to comment
Share on other sites

1 minute ago, Prestashop Addict said:

Try to disable facetedsearch, this cause the issue with large catalog with many product combinations.

Thanks for your reply! However, please read what I have already tried.
I have uninstalled all modules including the Faceted Search, but it didn't work.
Also, we don't use combinations and it is disabled in the Performance settings.

 

On 8/18/2024 at 5:25 PM, ZMR said:

I'm experiencing the exact same issues. I've tried Prestashop versions 1.7 and 8.1, and I'm having the same problems with all versions except for 1.6, which I'm currently using.

Here's my situation:

I've been using Prestashop 1.6 for the last 10-12 years.

I've been trying to upgrade to the latest version for the past 2-3 years (yes, you read that right!).

So, what's preventing me from upgrading? Here are the issues:

  1. Slow pagination: After upgrading to any latest version like 1.7.x.x and 8.1.x.x, pagination becomes very slow. It loads slowly at random, sometimes working fine for the first 4-5 pages, then becoming very slow and taking 10-12 seconds to load every next page. The pages load instantly when I visit them again.
  2. Slow orders page loading: The orders page in the backend takes around 120 seconds to load. The same page takes just 4-5 seconds to load in Prestashop 1.6 (there are lots of orders).
  3. Overall slow backend performance: Compared to Prestashop 1.6, the overall backend performance feels slow.


I've tried the following:

  1. Uninstalled almost every module (including Faceted search).
  2. Used Memcached cache.
  3. Enabled/Disabled OpCache and Prestashop cache.
  4. Used different servers like Ubuntu, CentOS, Alma, Rocky, etc., with different configurations.
  5. Used different PHP versions from 7.4 to 8.2.
  6. Used different web servers like Apache and Nginx.
  7. Optimized the database.
  8. Re-built the search index and re-generated the images.
  9. Tried different themes.
  10. Hired some developers to fix the issues, but they couldn't understand the problem and blamed the large data. They said Prestashop 1.6 is very efficient in handling large data, but Prestashop completely restructured their code for later versions, which might be the problem. So I deleted all orders for testing, and it fixed the order page loading issue as expected (Deleting the orders is not a solution though). The pagination issue was not fixed even after deleting the orders.

My current staging server configuration:

  • Server OS: AlmaLinux 9.4 (Seafoam Ocelot)
  • CPU: AMD EPYC-Milan Processor (8 cores)
  • RAM: 16.00 GB
  • Web Server Software Version: Nginx 1.26.1.1-2
  • PHP Version: 8.2.22
  • Memory Limit: 4096M
  • Max Execution Time: 600
  • Max File Upload Size: 128M
  • PrestaShop Version: 8.1.7
  • Theme: Default Classic theme
  • Control panel: Plesk Obsidian 18.0.63

I hope someone can help me resolve these issues.

Kind Regards

 

Link to comment
Share on other sites

6 minutes ago, sococa said:

Do you think that the utilisation of a CDN can improve the speed ?

usually nope,  a CDN is often someplace else. Plus it's a source for slowing down shops and sites are CDN.

A visitor fetches data from Shop A. Shop A fetches the requested data from the CDN and delivers that to the visitors browser.
The CDN could sit next door to the visitor, it still has to send the data to the shop.

  

On 8/22/2024 at 8:19 AM, ZMR said:

I understand, but the loading time should be similar for all pages. If one pagination page takes 10-12 seconds, then all pages should take a similar amount of time. However, the pagination loads instantly for most pages, then gets randomly stuck at some point, loads the next 3-4 pages very slowly, and afterwards loads instantly again.

It could be a memory issue. Send the server a ticket, HDD and also SSD fail sometimes.

Edited by Nickz (see edit history)
  • Like 1
Link to comment
Share on other sites

Ok thank you. Hostinger said this :"Improve your site's speed by up to 40% with Hostinger CDN."...

 

Also i read the article you shared. with the debug tools from Prestashop, i see that queries are no really slows. The slowest query during 295.5ms ... However, i see that for charging a products page, Prestashop use 871 queries. Do you think that the problem is here ? and can i reduce this number ?

Link to comment
Share on other sites

55 minutes ago, Nickz said:

usually nope,  a CDN is often someplace else. Plus it's a source for slowing down shops and sites are CDN.

A visitor fetches data from Shop A. Shop A fetches the requested data from the CDN and delivers that to the visitors browser.
The CDN could sit next door to the visitor, it still has to send the data to the shop.

  

It could be a memory issue. Send the server a ticket, HDD and also SSD fail sometimes.

I tried different servers from various companies with different configurations, including AWS EC2 instances. However, the performance remained the same across different servers.

Link to comment
Share on other sites

Not sure about Sococa, but I uninstalled all modules and tried, but nothing worked for me. There are only 56 categories without any subcategories. So there are just 56 categories in total. Total products are around 5000.

Link to comment
Share on other sites

  • 3 weeks later...

Memory Limit: 3072M

Max Execution Time: 480

Why the hell you have such a big time for execution Time? It suppose to be 60s max. Memory limit 3GB for one php script? How much RAM do you have on your server?

Link to comment
Share on other sites

Are you talking about Prestashop? 60s max execution time might be low for Prestashop.
Have you checked the official recommendations? What do you think about the official recommendations?
https://devdocs.prestashop-project.org/8/scale/optimizations/

1 hour ago, ArnasL - ArnasDEV said:

Memory Limit: 3072M

Max Execution Time: 480

Why the hell you have such a big time for execution Time? It suppose to be 60s max. Memory limit 3GB for one php script? How much RAM do you have on your server?

 

Link to comment
Share on other sites

So as you see PrestaShop recommends memory_limit = 512M, I would increase this value only if you have more than 8GB RAM on your VPS.

 

Max Execution time 300 doesn't make any sense in production. I only set this value when I do PS upgrade, because 1min is not enough to complete this upgrade process, meanwhile in production scripts shouldn't take longer than 1min. Imagine you have croniob which runs for 5min. Your website will be unstable atm. Instead script should be run in chunks to avoid downtime.

Link to comment
Share on other sites

Hello,

Thanks. i changed my config but Hostinger only propose bigs memory limits.

Capture d’écran du 2024-09-09 08-46-13.png
 

Also, Prestashop says :
"Optional settings: Please check the following error(s) Enable the PHP option "allow_url_fopen" on your server." But Hostinger says:
"This option is a significant security risk, so do not enable it unless necessary." What am I supposed to do, please?

Edited by sococa (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • sococa changed the title to [SOLVED] Very slow pagination

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...