Post by SolutionArchitects » Tue Aug 15, 2017 7:25 pm

I've got a site set up and have done quite a few modifications and installed a few extensions as well. What I've found recently during testing is that the edit order option (Sales/Orders) the first tab opens fine and relatively quickly however when I click "Continue" to move to the Product tab, the page becomes unresponsive, the button remains dark blue (as if it was still being clicked) and nothing happens for a very, very long time.

I used the developer tools to monitor the network activity and nothing appears to happen when the button is clicked and the request only appears in the list once the page has loaded. This is not normal, I created a new store for comparative purposes and the same action is almost instant on the blank site. The slow site does have products with quite a lot of options so I can imagine that would add some time to build the product page but not like this, surely if it were the case, the front end would be comparatively slow?

Here's the network activity with the waterfall expanded, what is the possible cause for the huge gaps?
Image

The site is running on a shared hosting server, it's using PHP 5.6 and Maria DB as the database engine


Posts

Joined
Fri Jul 28, 2017 6:34 pm

Post by rgbrewer » Thu Aug 17, 2017 7:02 am

2 minutes is a very very long time... but I have had issues where the page seemed unresponsive, and the issue is that opencart is running every product image through a resizer. If you have a lot of products being displayed, or simply very high-resolution images, it might have to chew for a while.

If youve got the knowledge and skill, the solution is resize all the images yourself to the sizes you need, and skip the resizing function in the controller.

*if* thats the problem...

New member

Posts

Joined
Sat Apr 22, 2017 9:30 am

Post by thekrotek » Thu Aug 17, 2017 7:51 am

It's not that easy to tell, to be honest. There can be multiple reasons for that: slow database query (most unlikely), slow server response (also unlikely), badly configured database (well, this might be the reason) and others.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by SolutionArchitects » Thu Aug 17, 2017 11:05 pm

thekrotek wrote:
Thu Aug 17, 2017 7:51 am
It's not that easy to tell, to be honest. There can be multiple reasons for that: slow database query (most unlikely), slow server response (also unlikely), badly configured database (well, this might be the reason) and others.
Thanks for your feedback, I've found that most of the delays were between getting a select box's value using the jQuery .val() function. I removed the "storeid" parameter from the ajax requests urls and that almost immediately removed the lag! Now I've found that getting the selected payment method is what is causing a 30 second delay and there's only two options enabled!! What could be causing this? Is it just the sheer size of the page that jQuery has to search through? Here's the culprit:

Code: Select all

if (json['payment_methods'][i]['code'] == $('select[name=\'payment_method\'] option:selected').val()) {
  var t4 = new Date();
  html += '<option value="' + json['payment_methods'][i]['code'] + '" selected="selected">' + json['payment_methods'][i]['title'] + '</option>';
  console.log("in the " + a + " iteration, if statement, elapsed time: " + (t4 - t3) );
} else {
  var t4 = new Date();
  html += '<option value="' + json['payment_methods'][i]['code'] + '">' + json['payment_methods'][i]['title'] + '</option>';
  console.log("in the " + a + " iteration, else statement, elapsed time: " + (t4 - t3) );
}


Posts

Joined
Fri Jul 28, 2017 6:34 pm
Who is online

Users browsing this forum: No registered users and 19 guests