VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: iMilazzo on October 23, 2012, 20:06:21 PM

Title: Site too slow
Post by: iMilazzo on October 23, 2012, 20:06:21 PM
Hi, everybody! I have this site www.jmparafusos.com.br/JM (http://www.jmparafusos.com.br/JM) it's a Tool and Screw store. My problem is, it's take TOO LONG to load the store at the first time and I don't know what to do!!

Thank you
Ivan Milazzotti
Title: Re: Site too slow
Post by: bytelord on October 23, 2012, 22:57:01 PM
Hello,

Tested you site with google speed test tool. Seems that is not too heavy (light i can say, scores 76/100). Your are not loading a lot of files, specially js is to light.

Some issues coming with your boostrap template loading those files http://www.jmparafusos.com.br/JM/templates/bootstraptemplate/fonts/PTSans/PTS55F_W.woff ... are fonts (5-6 of them)... are a little bit heavy i think, why are you loading too many fonts? Is that a template issue?

If by correcting the fonts (no use them, not load them, use only one of them ... not sure ... better remove them from loading) the problem percists then you should try with other hosting provider.

Regards
Title: Re: Site too slow
Post by: jjk on October 24, 2012, 07:33:09 AM
I agree with bytelord. Although many template providers seem to love Google's webfont api, I frequently see VM2 shops here in the forum where these webfonts are making the website extremely slow. Often the webfonts seem to take forever to load or they don't load at all. If you can, I would recommend not to use webfonts. Templates making use of webfonts typically try to load several of them into a single page. If only one of them is loading slow because 10000 other websites are requesting it at the same time or it is replaced by a newer font and not available anymore, your shop page won't load completly anymore.

...sometimes Google is evil...  ;)
Title: Re: Site too slow
Post by: iMilazzo on October 24, 2012, 14:57:51 PM
I will do everything u said, but the problem is not the "site" but the "virtual store" menu. I mean, u will see 4 items on top menu:

Home
Vitrine
Loja Virtual <-- Virtual Store
Contato
Minha Conta

The "Loja Virtual" item is the Virtual Store and this item is too slow and some categories llike "Fixação" (Fixings)  and "Parafusos" (Screws) are very slow too!

Can u help me?

Thanks
Ivan Milazzotti
Title: Re: Site too slow
Post by: jjk on October 24, 2012, 15:23:47 PM
If you use the Firefox browser, you can use the Firebug plugin to see yourself which files are slowing down your site (if you click the "Net" button).
http://forum.virtuemart.net/index.php?topic=102850.0 (http://forum.virtuemart.net/index.php?topic=102850.0)
Title: Re: Site too slow
Post by: iMilazzo on October 24, 2012, 16:58:41 PM
Sorry mu bad english...

This is the time to load my links on top menu:

Home - less than 1s
Vitrine - less than 1s
Loja Virtual -> Virtual Store = almost 30s *****
Contato - less than 1s
Minha Conta - less than 1s

Plz, try to click on the "Loja Virtual" page to see my problem, it's a small page that takes almos 30s to load....
There is nothing to do with css, html or this kind of problem, it's not a typeface problem, it's the Virtuemart Menu and I need to know what to do. Seems Virtuemart try to read "all" of my products before create the side menu.

Thank u very much
Ivan Milazzotti
Title: Re: Site too slow
Post by: bytelord on October 24, 2012, 17:52:27 PM
Hello,

What exactly is not clear to you? Fonts take a long time to load, disable them. If you cannot you could change joomla template or ask your template provider to correct it!

Take a look on the attached image

Also make your images smaller in size.

Regards

[attachment cleanup by admin]
Title: Re: Site too slow
Post by: jjk on October 24, 2012, 19:21:46 PM
Webfonts slow down his site considerably. But his "loja-virtual" link takes approximately 30 seconds to load. Might be primarily a slow server. Typing his domain into a whois service reveals that more than 1200 domains are located on the same server. Not a good neighbourhood for a shop.
Title: Re: Site too slow
Post by: bytelord on October 24, 2012, 19:47:25 PM
Yes, i agree. His provider is too slow, may be a vps or shared hosting. Server processing is also too slow may be for that reason Apache processes goes to the queue creating a "huge" time lag to respond.

Need both disable that fonts and also try with another host... or try with localhost, not the best to compare, but if the respond time is better then probably that server is out of resources.

Regards
Title: Re: Site too slow
Post by: iMilazzo on October 24, 2012, 20:19:44 PM
I just removed all webfonts and stills taking a long time to load the Virtual Store, can u make that analisys again plz????


Thank u so much !!!

Ivan Milazzotti
Title: Re: Site too slow
Post by: iMilazzo on October 24, 2012, 20:34:27 PM
How can I analize this by myself, I'm trying to use https://developers.google.com/speed/pagespeed/insights?hl=pt-BR (https://developers.google.com/speed/pagespeed/insights?hl=pt-BR) from Google and I can't get the page "Loja Virtual"  loaded to analize!!!!

Thank you
Ivan Milazzotti
Title: Re: Site too slow
Post by: bytelord on October 24, 2012, 22:13:59 PM
Hello,

As jjk suggested using firebug, the attached image was by using firebug.

QuoteIf you use the Firefox browser, you can use the Firebug plugin to see yourself which files are slowing down your site (if you click the "Net" button).
http://forum.virtuemart.net/index.php?topic=102850.0

btw, i think major issue is your host provider, delay responses and high resources usage...

Regards
Title: Re: Site too slow
Post by: jjk on October 24, 2012, 22:21:09 PM
bytelord was quicker again... ;D
Just typed your shop url into a website speed test. Result:
"Speed test results:
    URL:   ...//www.jmparafusos.com.br/JM/index.php/loja-virtual
    The test timed out, as the page did not complete loading in 15 sec.
    You should definitely be concerned about your server's speed!"


Your biggest problem actually seems to be the slow server speed. Virtuemart files are loading pretty quick, but content is delivered very slow by your server.
I would recommend you install your shop on your own PC. The only additional thing you need is i.e. http://www.apachefriends.org/en/xampp.html (http://www.apachefriends.org/en/xampp.html). There are plenty of tutorials available in the internet about how to install Joomla on xampp. In addition to that the Firefox browser plugin "Firebug" and "Web Developer" are very usuful tools to locate problems. They are easy to use ...just try it.
:)
Title: Re: Site too slow
Post by: bytelord on October 24, 2012, 22:27:53 PM
jjk: ;D

That delay is because http requests from the server added to the queue cause of overloading, so there is a big gap between 10-15 seconds until your server responds to the requests, there is also dns delays up to 600ms, for me that dns responses are huge time lag.

But as jjk suggested and as i suggested before try using xampp, if you site in localhost is faster, change host immediately.

Quote from: bytelord on October 24, 2012, 19:47:25 PM
Yes, i agree. His provider is too slow, may be a vps or shared hosting. Server processing is also too slow may be for that reason Apache processes goes to the queue creating a "huge" time lag to respond.

Need both disable that fonts and also try with another host... or try with localhost, not the best to compare, but if the respond time is better then probably that server is out of resources.

Regards


Title: Re: Site too slow
Post by: Yesceeohhh on November 06, 2012, 12:42:21 PM
Response time for that particular page is too slow, hence it is taking around 15 seconds to load. Check with your hosting provider.
Title: Re: Site too slow
Post by: jt2012 on November 12, 2012, 18:22:14 PM
Slow page loading times are caused by extremely poorly designed code which is running way too many MySQL queries. This slowness is further compounded by the code returning an unnecessarily huge amount of JavaScript code to the client (eg. on my site, the "html" file returned by PHP is 800kB). What's worse is that this JS code appears to have no real purpose on the page it's being produced for.

This problem affects the category pages - the pages before getting to specific product detail. It is especially a problem for us because we have thousands of products and it seems to be trying to create a product "family tree".

Of course, this isn't necessarily the cause of all cases of slowness.
Title: Re: Site too slow
Post by: jt2012 on November 20, 2012, 17:12:41 PM
For those of you still having trouble with the slowness of your VirtueMart cart, and for those
of you brave enough to venture into the abyss of VirtueMart code...here's the fix I made
for the site I'm working on. This *may* work for you depending on what version you have
and what plugins you have.

Before you begin, you should know that the main cause of slowness described in this thread
IS caused by poorly written code making far too many DB queries. It is VERY bad practice to be
doing this, even on a fast server. The solution is to stop the onslaught of queries by disabling
specific code when it is called by the category page. Doing so will also cut down on the amount
of useless JS code that is returned.

First, find this file: /administrator/components/com_virtuemart/models/product.php
(or something similar as the equivalent may have been spewed some place else in a different
version). Now you need to find line 856 (or somewhere in the general vicinity) where the
rampant code is this:

// set the custom variants
if (!empty($product->virtuemart_customfield_id)) {
$customfields = VmModel::getModel ('Customfields');
// Load the custom product fields
$product->customfields = $customfields->getProductCustomsField ($product);
$product->customfieldsRelatedCategories = $customfields->getProductCustomsFieldRelatedCategories ($product);
$product->customfieldsRelatedProducts = $customfields->getProductCustomsFieldRelatedProducts ($product);
//  custom product fields for add to cart
$product->customfieldsCart = $customfields->getProductCustomsFieldCart ($product);
$child = $this->getProductChilds ($this->_id);
$product->customsChilds = $customfields->getProductCustomsChilds ($child, $this->_id);
}


Subdue it by changing it to this:

// set the custom variants
if (!empty($product->virtuemart_customfield_id)) {
if (class_exists("VirtuemartViewCategory") != true) {
$customfields = VmModel::getModel ('Customfields');
// Load the custom product fields
$product->customfields = $customfields->getProductCustomsField ($product);
$product->customfieldsRelatedCategories = $customfields->getProductCustomsFieldRelatedCategories ($product);
$product->customfieldsRelatedProducts = $customfields->getProductCustomsFieldRelatedProducts ($product);
//  custom product fields for add to cart
$product->customfieldsCart = $customfields->getProductCustomsFieldCart ($product);
$child = $this->getProductChilds ($this->_id);
$product->customsChilds = $customfields->getProductCustomsChilds ($child, $this->_id);
}
}


That code is adding an if statement (essentially saying "if it's the category page being
executed, then don't bother running this code") around the code that ultimately causes
all of the unnecessary DB queries and JS code.

Notice that this mod still allows the code to be run for the product detail pages, which is
where the queries and JS code are actually useful. This code is decent on the product detail
page because it only runs queries relative to one particular product, instead of for each and
every product listed in the category page.

After you've made the mod, make sure you thoroughly test your site, because there's no
telling for certain how widespread the effects of this mod might be in your version/settings
unless you test it.

Also, don't be surprised when an update totally wipes your mod by replacing it with the
good ol' poorly written code.
Title: Re: Site too slow
Post by: bytelord on November 20, 2012, 20:39:05 PM
Hello,

Nice suggestion, but some people works with custom fields on the category view also (some advanced template edits).
If you take a look on the current product model (vm2.0.14) you will see that this area so been working and will be moved on the view model for product details page (custom fields for related products/categories).

Thanks for the code snippet.

Regards
Title: Re: Site too slow
Post by: jjk on November 21, 2012, 19:14:39 PM
Quote from: jt2012 on November 12, 2012, 18:22:14 PM
Slow page loading times are caused by extremely poorly designed code which is running way too many MySQL queries. This slowness is further compounded by the code returning an unnecessarily huge amount of JavaScript code to the client (eg. on my site, the "html" file returned by PHP is 800kB).

Well, my live site probably has less products than yours, but when I read the description of your speed problem, I doubt the number of MySQL queries is the problem on your site (how much time did you gain with your code?), because even though there are many, they are running very fast. On my site I have up to 600 queries for a category view, but still the site is very fast, even on the cheap 4.5 dollar per month shared server the site is hosted on. Also, if I look at my site with 'Firebug' enabled, the html part is only between 4 and 6 kb.

Which versions of Joomla and VM2 are you using - and can you provide a link where we can see your speed problem?
Title: Re: Site too slow
Post by: franzpeter on November 26, 2012, 11:15:30 AM
It is true. Using Joomla menu for linking to VM categories slows down the page. Using VM landing page as start page slows down too. And if the VM landing page is used to display random, featured or newest products, that slows even much more the whole page. Joomla menu is normally not slow, but it is obvious that the VM component produces some problems by just get linked to Joomla menu (without displaying pages), just because it is inside a Joomla menu with variious instances. So it is a VM problem.
The VM landing page uses a huge query to get main categories and all products and then it filters out the needed products for example (featured, newest, random) with case statements. Maybe it would be better to not use case statements and instead use different queries to filter the products.
Example: featured products have an additional entry in the database table (0 or 1). It is much faster to use a query to find those products with '1' or with the newest date, than to query the whole product table and filtering by case. Both methods work and the code with the case statements looks more elegant, but it is much slower.
Title: Re: Site too slow
Post by: Milbo on November 27, 2012, 10:07:09 AM
One big trouble, that the customfields are always loaded is removed in vm2.1

That vm is slower due menu items is imho due the sef. We added statics to the router, so we reduced the sql drastically. The version 2.0.14 is already a lot faster then 2.0.12