Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Optimizing Cs-Cart For Better Performance Rate Topic   - - - - -

 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 24 October 2014 - 09:45 PM #1

Hi

I recently did a performance comparison test of our store on GTMetrix.com. The results were nothing to write home about. My CS-Cart installation is even though on a dedicated VPS with 2Gig of memory and the other resources to match it is not faster but rather slower than that of my competitors and even slower than some of the cs-cart powered website of developers here in the CS-Cart community.

If a developer can assist please sent me a pm.

performance_screenshot.JPG

running CS Cart V4.10.3.SP1 


 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 27 October 2014 - 08:33 AM #2

Members of the CS-Cart community,
This is a follow up on my question. There is an article in the Knowledge Base - called "Increasing Site Performance" and I have question that is related to the procedure of optimizing the database and amending the code in the config.local.php file.

Q: is this best done when you just about to go live but you may still want to install some future add-ons or add new products. In other words can you do this at any time in the process? I am just about to go live with our store.

Kind regards.

running CS Cart V4.10.3.SP1 


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11847 posts

Posted 27 October 2014 - 07:38 PM #3

I have yet to see any performance numbers that indicate that caching in the database (note you are caching DB queries in the same DB as you are fetching them from) is any faster than the file method. If you have detailed statistics on this, please publish.

What caching method is used can be done at any time. As with all caching systems, the first access will be the slowest while the cache is built.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 28 October 2014 - 10:33 AM #4

I have yet to see any performance numbers that indicate that caching in the database (note you are caching DB queries in the same DB as you are fetching them from) is any faster than the file method. If you have detailed statistics on this, please publish.

What caching method is used can be done at any time. As with all caching systems, the first access will be the slowest while the cache is built.


Well I have yet to optimize the database as I have written the first post. Simbirsk Technologies Ltd write in there knowledge base that you need to optimize the database first and then replace the caching from 'file' to 'mysql'.

But the way you write about it Tony, it does not matter at all ? Are there perhaps other better methods of increasing loading times of my current live setup ?

running CS Cart V4.10.3.SP1 


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11847 posts

Posted 28 October 2014 - 04:29 PM #5

I do not have any suggestions other than to have the appropriate server for the size of your site and the visitor count you expect. Personally, I"m about "keep it simple". It does not make logical sense to me to cache data in the same database that you are trying to avoid accessing. Separate DB, maybe, but it should be served by a completely sepaate instance of mySQL (or preferably a different DB server entirely if it's going to reside on the same server).... As far as all the optimizers go, until there is true page caching, I think you're picking at zits.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 29 October 2014 - 11:58 AM #6

As far as all the optimizers go, until there is true page caching, I think you're picking at zits.


How damaging would it be in your opinion then to optimize the database as you can do within the backend administration of CS-Cart ?

running CS Cart V4.10.3.SP1 


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11847 posts

Posted 29 October 2014 - 06:59 PM #7

I'm not understanding your question. The DB is pretty well optimized though the queries are many times less than optimal because they need to account for addons and other adjustments to them.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 835 posts

Posted 30 October 2014 - 06:57 PM #8

Out of the box, CS-Cart doesn't include any Cache Control in the .htaccess file.
Just looking at the screen shot you posted I can see that you could dramatically increase your GTMetrix score by addressing the items they list under Recommendations. Several are easy to fix.
1. Leverage Browser Caching: Important for your traffic's browsing experience. Your customers fetch your graphics, JS, CSS and HTML ONCE and cache it.
2. Specify a Vary: Accept-Encoding header: I thought this was enabled by default in the original .htaccess file.
3. Enable gzip compression: the single greatest accelerator you are going to implement.

This a complete copy of my .htaccess file for v4 running on a LAMP server. It completely replaces the one provided with the cart. It fixes the three items I listed above. And also implements mod_deflate.:

DirectoryIndex index.html index.php
<IfModule mod_headers.c>
Header append Vary: Accept-Encoding
Header set X-Content-Type-Options "nosniff"
<Files .htaccess>
  order allow,deny
  deny from all
</Files>
FileETag None
<FilesMatch "\.(ttf|ttc|otf|eot|woff|css)$">
  Header set Access-Control-Allow-Origin "*"
</FilesMatch>
<IfModule mod_expires.c>
  Header unset ETag
  ExpiresActive on
  ExpiresDefault	  "access plus 1 month"
  #CSS
  ExpiresByType text/css	 "access plus 1 year"
  #Data interchange
  ExpiresByType application/json	"access plus 0 seconds"
  ExpiresByType application/ld+json   "access plus 0 seconds"
  ExpiresByType application/vnd.geo+json   "access plus 0 seconds"
  ExpiresByType application/xml	"access plus 0 seconds"
  ExpiresByType text/xml	 "access plus 0 seconds"
  #Favicon (cannot be renamed!) and cursor images
  ExpiresByType image/x-icon	"access plus 1 year"
  #HTML components (HTCs)
  ExpiresByType text/x-component	"access plus 1 month"
  #HTML
  ExpiresByType text/html	 "access plus 1 month"
  #JavaScript
  ExpiresByType application/javascript   "access plus 1 year"
  #Manifest files
  ExpiresByType application/manifest+json   "access plus 1 year"
  ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
  ExpiresByType text/cache-manifest   "access plus 0 seconds"
  #Media
  ExpiresByType audio/ogg	 "access plus 1 month"
  ExpiresByType image/gif	 "access plus 1 month"
  ExpiresByType image/jpeg	"access plus 1 month"
  ExpiresByType image/png	 "access plus 1 month"
  ExpiresByType video/mp4	 "access plus 1 month"
  ExpiresByType video/ogg	 "access plus 1 month"
  ExpiresByType video/webm	"access plus 1 month"
  #Web feeds
  ExpiresByType application/atom+xml   "access plus 1 hour"
  ExpiresByType application/rss+xml   "access plus 1 hour"
  #Web fonts
  ExpiresByType application/font-woff   "access plus 1 month"
  ExpiresByType application/font-woff2   "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject  "access plus 1 month"
  ExpiresByType application/x-font-ttf   "access plus 1 month"
  ExpiresByType font/opentype	"access plus 1 month"
  ExpiresByType image/svg+xml	"access plus 1 month"
  #CSS w/gzip
  <FilesMatch .*\.css.gz$>
   ExpiresDefault "access plus 1 year"
   ForceType text/css
   Header set Content-Encoding: gzip
   Header set Cache-control: private
  </FilesMatch>
  #JavaScript w/gzip
  <FilesMatch .*\.js.gz$>
   ExpiresDefault "access plus 1 year"
   ForceType text/javascript
   Header set Content-Encoding: gzip
   Header set Cache-control: private
  </FilesMatch>
</IfModule>
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
Options -MultiViews
#Redirects go here
#RewriteCond %{REQUEST_URI} .*\/SEO_URL\.html
#RewriteRule ^.*$ http://www.domainname.com/NEW_SEO_URL.html [L,R=301]
AddEncoding gzip .gz
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} \.(js|css)$
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [QSA,L]
RewriteCond %{REQUEST_URI} ^api/(.*)$ [or]
RewriteCond %{REQUEST_URI} .*/api/(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*api/(.*)$ api.php?_d=$1&ajax_custom=1 [L,QSA]
RewriteCond %{REQUEST_URI} \.(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff|yml|xml)$ [or]
RewriteCond %{REQUEST_URI} store_closed.html$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)\/(.*)$ $2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]

</IfModule>

As a Webmaster you should be familiar with Cache Control, gzip and .htaccess files. This is not "Developer" level optimization.
You should also make certain that gzip is enabled on your server.

CS-Cart Ultimate ver 4.11.3


 
  • bytraper
  • Member
  • Members
  • Join Date: 27-Oct 09
  • 150 posts

Posted 03 November 2014 - 03:43 PM #9

Don, thanks for sharing this. My site went from:
E-53% and C-74%
to
D-63% and B-82%

Just from using your htaccess file!
For gtmetrix that's not bad at all, as we are hosted in Australia on Australian Servers, the site is always slower when running international tests. I'm really surprised that it made so much of a difference from the standard cs-cart one, so I just had to jump on to say thanks!

 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 03 November 2014 - 08:01 PM #10

Don I tried your file and it did some good but I guess on my site and server more has to be done to get anywhere below D. But still many thanks for sharing your file.
gtmetrix_afterchangehtaccesfile.JPG

running CS Cart V4.10.3.SP1 


 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 03 November 2014 - 08:23 PM #11

As for gzip compression being abled.. it has been before I posted this thread.gzip_enabled.JPG

running CS Cart V4.10.3.SP1 


 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 835 posts

Posted 03 November 2014 - 09:09 PM #12

If gzip module is running, is it being used?
If you have cPanel, log into your cPanel account and click Optimize Website under Software/Services. Choose "Compress all content" and update settings.
According to your GTMetrix score, gzip is not being used for all content - probably just for the .css.gz and .js.gz files included with CS-Cart.

Also, there are several websites that offer js Minifiers. All you have to do is to paste the contents of an existing js file into the Minifier, run the process, copy the output and paste it over your current file's contents. I do directly on the server so my local copy is a backup of the original. I had a few scripts that didn't function correctly after minification: tabs.js, and another, so I just uploaded the original and moved on.

CS-Cart Ultimate ver 4.11.3


 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 835 posts

Posted 03 November 2014 - 09:12 PM #13

Don, thanks for sharing this. My site went from:
E-53% and C-74%
to
D-63% and B-82%

Just from using your htaccess file!
For gtmetrix that's not bad at all, as we are hosted in Australia on Australian Servers, the site is always slower when running international tests. I'm really surprised that it made so much of a difference from the standard cs-cart one, so I just had to jump on to say thanks!


Your welcome.

CS-Cart Ultimate ver 4.11.3


 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 03 November 2014 - 09:56 PM #14

If gzip module is running, is it being used?
If you have cPanel, log into your cPanel account and click Optimize Website under Software/Services. Choose "Compress all content" and update settings.
According to your GTMetrix score, gzip is not being used for all content - probably just for the .css.gz and .js.gz files included with CS-Cart.

Also, there are several websites that offer js Minifiers. All you have to do is to paste the contents of an existing js file into the Minifier, run the process, copy the output and paste it over your current file's contents. I do directly on the server so my local copy is a backup of the original. I had a few scripts that didn't function correctly after minification: tabs.js, and another, so I just uploaded the original and moved on.


Don,

I did a follow up at first with figuring out how to really enable compression and I found this code below on the site of GTmetrix.com -
http://gtmetrix.com/...ompression.html

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

I added that code to the new .htaccess file that you posted here in this thread.

The results now are already so much better


afteramending_htaccessfile2.JPG

running CS Cart V4.10.3.SP1 


 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 03 November 2014 - 10:40 PM #15

If gzip module is running, is it being used?

Now it is used, yes as you can see by the results above. Thanks for asking.

If you have cPanel, log into your cPanel account and click Optimize Website under Software/Services. Choose "Compress all content" and update settings.
According to your GTMetrix score, gzip is not being used for all content - probably just for the .css.gz and .js.gz files included with CS-Cart.

I finished that last part just now - see also the new results below

Also, there are several websites that offer js Minifiers. All you have to do is to paste the contents of an existing js file into the Minifier, run the process, copy the output and paste it over your current file's contents. I do directly on the server so my local copy is a backup of the original. I had a few scripts that didn't function correctly after minification: tabs.js, and another, so I just uploaded the original and moved on.


I may have to pass on that, that is currently a bit beyond my comrpehension. That is to say I pass for now, the time being. Lot's of work still to do now on part of the SSL issue I posted elsewhere on this forum.

Still many thanks Don and thanks to the Internet for making it so easy to find the things you need to know.

PS I also added some code in the .htaccess file

<ifmodule mod_expires.c>
<Filesmatch "\.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$">
    ExpiresActive on
    ExpiresDefault "access plus 2 days"
</Filesmatch>
</ifmodule>

running CS Cart V4.10.3.SP1 


 
  • johnbol1
  • Never Re
  • Members
  • Join Date: 23-Feb 10
  • 4833 posts

Posted 04 November 2014 - 09:23 AM #16

Make sure to check your sitemap generates correctly after making your changes.

John

Custom printed hi visibility clothing sale the UK's online hivis safety shop
v4.5.2


 
  • Mongoose
  • Senior Member
  • Members
  • Join Date: 08-Mar 13
  • 1001 posts

Posted 04 November 2014 - 10:25 AM #17

Make sure to check your sitemap generates correctly after making your changes.

John


I did John but thanks for asking/ reminding. Sitemap is working fine at the moment.

Anthony

running CS Cart V4.10.3.SP1 


 
  • Rafass
  • Senior Member
  • Members
  • Join Date: 16-Jan 14
  • 304 posts

Posted 12 November 2014 - 05:34 PM #18

here my numbers in gtmetrix:

Posted Image

If you have any question about my files and configuration just let me know.

8)

 

Posted 12 November 2014 - 05:37 PM #19

here my numbers in gtmetrix:

Posted Image

If you have some question about my files and configuration just let me know.

8)


All I can say is your page must not have very much on it. 6 requests.

 
  • Rafass
  • Senior Member
  • Members
  • Join Date: 16-Jan 14
  • 304 posts

Posted 12 November 2014 - 05:47 PM #20

All I can say is your page must not have very much on it. 6 requests.


Is beta yet. I'm testing and learning.
anyway is already installed everything I need.
I want to achieve the best speed and optimisation first 8)
.