Speeding Up Cs-Cart (Attempts)

[size=4]Reading through forum, it is always parts and pieces of information about speeding up CSCart installation but I haven't seen a definitive answer other than Smartoptimizer stuff. I will share my struggle with trying to optimize CS-Cart and offer less than 500 ms response time.[/size]



[size=4]I have been using a fairly unknown CS-cart addon called WEBO Site Speed for CS-Cart up until 4.x. As you know, CS-Cart changed directory structure with 4.x and this addon has not been updated to be compatible with 4.x. This addon was actually excellent to lower the load time and increase the page speed. It was not advertised enough to where it could be used by many CS-Cart stores and it seems like developers lost the motivation in the project. In my experience, it was almost one of the best addons that was made for CS-Cart. [size=4]It offered many functions but the most important function was to save HTML pages on the server as file or Memcache. It offers client side cache settings via .htaccess, DB cache, server side cache (save HTML Files) and many other small functions. [/size][size=4]If you are not on 4.x, I would definitely recommend using [/size]WEBO Site Speed for CS-Cart[size=4] instead of going through the hassle to speed up by the means of server optimization. You can see all the features in the attached screenshot.[/size][/size]





[size=4]To give you a bit of background, [size=4]I have CSCart 4.1.2 on Hostgator Shared Hosting ([/size]Business Plan[size=4]) with response time average 1750-1800 ms. [/size][size=4]In order to test the optimization ideas, I purchased the lowest package VPS from ovh.com and setup cPanel trial version on it. Note: [/size][size=4]The response time is not to suggest the page load time. I use 'response time' to explain how long it takes to receive a response after server runs cs-cart/index.php[/size][/size]



[size=4]Using apachebooster, I installed nginx-varnish-apache trinity. [size=4]In this setup, nginx becomes the webserver and forwards requests to Varnish. If Varnish doesn't have it stored in its cache, it requests from Apache and stores it in its cache.[/size][/size]



[size=4]On OVH VPS, [size=4]I was able to lower the response time from [/size]1200 ms[size=4] to [/size]1000 ms[size=4]. with Apache MPM Event - PHP-FPM and xCache configuration only (using this tutorial [/size]http://www.techsoar…-best-settings/[size=4]) [/size][/size]



[size=4]xCache[/size]

[size=4][size=4]I was very hopeful about getting good results using xCache for PHP opcode cache but it made only %10-15 difference in terms of response time. I made the configurations on xCache to the best so that the cache misses would be lowest. It seems like the ideal xcache.size should be more than 64M. CSCart is not taking advantage of xCache internal cache to store data so no need for xcache.var_size.[/size][/size]



[size=4]nginx-Varnish-Apache[/size]

[size=4]After nginx-varnish-apache setup, it came down from 1100 ms to 400 ms. This is huge!! More then %50! [size=4]I tested the whole website with a crawler and it is loading perfectly fine without any stupid 404-403 etc. errors. You can see how it looks before-after from the screenshot.[/size][/size]



[size=4]However, CS-Cart ecommerce functions need testing. I don't know if add to cart, creating a new product from admin panel, updating settings, customer login-checkout etc. is working properly or not. In other words, I'm not sure if CS-Cart and nginx-Varnish is compatible for dynamic elements.[/size]



[size=4]Problems with nginx-Varnish-Apache:[/size]

[size=4][size=4]-CS-Cart 4.x is very dedicated to a 'weird' optimization method. When template is compiled, it saves .css and .js files as .gz files then using .htaccess, CSCart redirects .css requests into .gz requests. This might work in a stand-alone environment but it fails with the setup I am trying to make. The only solution is to run a cron job and unzip the file. I also tested dev_js and dev_css configurations in config.local.php but no avail.[/size][/size]

[size=4]-captcha is not working. CS-Cart is using index.php?dispatch to generate captcha and either varnish or nginx is not recognizing this as image so it needs some configuration here.[/size]



[size=4]memcache[/size]

[size=4]One last note for those who might be researching, CSCart is not compatible with memcached-memcache so installing-configuring a memcache instance will not yield any result. Also memcache is different then xCache-APC-eAccelerator. Memcache is not PHP opcode cache. In other words, it won't cache the compiled version of your PHP files, it is only made to alleviate load of Database servers by caching most accessed data.[/size]



[size=4]At this point, I'm continuing with my tests on nginx-Varnish-Apache to make sure it is ready for live site and then I'll switch to that setup.[/size]



[size=4]If you have any thoughts or experience on using Litespeed, Varnish, nginx, memcache, xcache, APC or any other methods, I would be very happy to hear your comments.[/size]

varnish-before-after.jpg

WEBO.jpg

Did you try pagespeed module for nginx? I see that you still have troubles with compressing images and this mod should help. You can read more about it here.

Hi Jacek,



I setup this website as a test platform so I didn't look into identifying the issues on the website. My main focus was to get the best response time from CS-Cart.



Regarding Pagespeed, I used Pagespeed module for Apache. It's very painful. It modifies pretty much everything on the page and makes it almost impossible to identify when there is problem. For example, I was trying to add Google Remarketing code to the website. Google didn't recognize its own code because Pagespeed module changed the javascript code. After disabling Pagespeed, I was able to get it to work.



I'm more inclined to do everything this module does myself instead of Pagespeed.



Thanks for the input.

[quote name=‘mazter’ timestamp=‘1412345682’ post=‘193344’]



I setup this website as a test platform so I didn’t look into identifying the issues on the website. My main focus was to get the best response time from CS-Cart.



[/quote]



Tryed cs ‘built-in’ Redis? (I have not got it to work) :-(

I didn't test with Redis. The articles I read online didn't seem to be in favor of Redis so I focused on the others that are already established and have some good guides on.



Did you try any other software? How about varnish?

I tried Redis, but switched back to file cache. Redis quickly eat up your memory, thus slow down page loading speed. If you are a shared hosting or VPS with limited memory, it's not a good choice.

Seems to me that Varnish or LiteSpeed Cache is a must for medium to large sites. The largest benefit of LiteSpeed Cache is that it allows you to define usergroups and serve up a guest cache. Which frees up a lot of server resources.



LiteSpeed 5 also has SPDY and HHVM support. Google's SPDY protocol increases page load over 60%. Facebook's HHVM makes PHP 9 times faster. LSWS 5 is at RC2 now.



Unfortunately I have not found support for LiteSpeed & CS-Cart yet.

[size=3][color=#000000][font=LucidaGrande]I'm glad to answer your questions and give some tips on performance boost. The speed of the web service depends greatly on your project – there is no silver bullet. [/font][/color][/size][color=#000000][font=LucidaGrande][size=3]There are several common techniques to increase the performance of the CS-Cart store: use KeepAlive, split static content from the dynamic one, use gzip/deflate data compression, use expires headers, use opcode caching, store user sessions in Redis, configure MySQL correctly, etc. The results[/size][/font][/color][color=#000000][font=LucidaGrande][size=3] depends on correct server settings.[/size][/font][/color]



[size=3][color=#000000][font=LucidaGrande]Google ModPagespeed is good, but many built-in filters are incompatible with CS-Cart. Anyway, you can also make changes manually: compress and minify scripts and styles, optimize your images, etc.[/font][/color]



[color=#000000][font=LucidaGrande]Unfortunately, we have not tested CS-Cart with LiteSpeed. By the way, generally we do not recommend to use cache on HTTP-server where CS-Cart is installed because it can cause unexpected errors in display content.[/font][/color]



[color=#000000][font=LucidaGrande]SPDY is great. SPDY is different from HTTP in many ways, but its primary advantage comes from being able to multiplex many requests/responses from client to server over a single (or few) TCP-connection. [/font][/color][color=#000000][font=LucidaGrande]Previous benchmarks promised great benefits ranging from making pages load 2x (two times) faster to making mobile sites 23% faster than clear HTTP using SPDY and HTTPS. However, real-life tests showed that SPDY is only a little bit faster than HTTPS and is slower than HTTP.[/font][/color]



[color=#000000][font=LucidaGrande]HHVM is nice too, but we don't have any experience in using it in production and cannot be sure that it will work well for our customers. [/font][/color]



[color=#000000][font=LucidaGrande]You can ask more questions and I'll try to give you a clear answer.[/font][/color][/size]

Goncharov, have you considered adding support for memecache? On my main page I have tabbed block with news/bestsellers/promotions/gifts and I’ve noticed that it consumes lots of requests. It would be great if I could cache the content of specific block in block settings. Additional support for category pages would be also nice :-)

[color=#000000][font=LucidaGrande]Hello, Jacek.



Thanks for your question. Unfortunately, we have no plans to integrate memcache(d) with CS-Cart. However, we will try to add XCache and APC-cache support in one of the next releases. At the moment you can use Redis as cache storage if you have enough RAM on your server.[/font][/color]

[quote name='goncharov' timestamp='1413488927' post='194387']

[size=3][color=#000000][font=LucidaGrande]I'm glad to answer your questions and give some tips on performance boost. The speed of the web service depends greatly on your project – there is no silver bullet. [/font][/color][/size][color=#000000][font=LucidaGrande][size=3]There are several common techniques to increase the performance of the CS-Cart store: use KeepAlive, split static content from the dynamic one, use gzip/deflate data compression, use expires headers, use opcode caching, store user sessions in Redis, configure MySQL correctly, etc. The results[/size][/font][/color][color=#000000][font=LucidaGrande][size=3] depends on correct server settings.[/size][/font][/color]



[size=3][color=#000000][font=LucidaGrande]Google ModPagespeed is good, but many built-in filters are incompatible with CS-Cart. Anyway, you can also make changes manually: compress and minify scripts and styles, optimize your images, etc.[/font][/color]



[color=#000000][font=LucidaGrande]Unfortunately, we have not tested CS-Cart with LiteSpeed. By the way, generally we do not recommend to use cache on HTTP-server where CS-Cart is installed because it can cause unexpected errors in display content.[/font][/color]



[color=#000000][font=LucidaGrande]SPDY is great. SPDY is different from HTTP in many ways, but its primary advantage comes from being able to multiplex many requests/responses from client to server over a single (or few) TCP-connection. [/font][/color][color=#000000][font=LucidaGrande]Previous benchmarks promised great benefits ranging from making pages load 2x (two times) faster to making mobile sites 23% faster than clear HTTP using SPDY and HTTPS. However, real-life tests showed that SPDY is only a little bit faster than HTTPS and is slower than HTTP.[/font][/color]



[color=#000000][font=LucidaGrande]HHVM is nice too, but we don't have any experience in using it in production and cannot be sure that it will work well for our customers. [/font][/color]



[color=#000000][font=LucidaGrande]You can ask more questions and I'll try to give you a clear answer.[/font][/color][/size]

[/quote]

Goncharov,



Will CS-Cart 4.2.2 work with the latest version of LightSpeed?

And LiteSpeed Cache?

That would make a world of difference.

Goncharov can you please answer P-Pharma's question as well as ours? Will CS-Cart 4.2.2 / 4.2.3 work with the latest version of the LightSpeed server and LiteSpeed cache?

[color=#282828][font=arial, verdana, tahoma, sans-serif]The usual forum presence span of any CS-Cart support staff is about 1 day.[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]Then it may be weeks before they pop up in a thread again. If Goncharov shows[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]up again shortly then consider yourself blessed.[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]My view is that providing solutions in a thread for 100's to see will mean that[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]CS-Cart support will miss out on 1000's of support credits in income.

CS-Cart is a commercial enterprise after all.[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]Still sucks though.[/font][/color]

Termalert,

Do you run a company?

If yes, then you know there is more then one thing to do.

I understand, waiting is not fun.

They do there best for 100% and if you want it faster then make a ticket(respons 1 day).

richardfmm.

I guess your cart is humming along nicely with no problems at all

and that if anything goes wrong then you are more than capable

of solving the problem yourself.

Half your luck.

Run a company ?

Do you mean something like a new car dealership where they almost lose

everytime they sell a new vehicle BUT make a killing on compulsory servicing

and parts.

Termalert,

No, if have problems to, but i can wait.

There is more then one customer and as a company, you can never make 100% happy.

Nothing more to say.

[quote name='mayanetwork' timestamp='1413909669' post='194749'] Goncharov, Will CS-Cart 4.2.2 work with the latest version of LightSpeed?[/quote]



[size=4][font=lucida sans unicode,lucida grande,sans-serif][color=#000000]Unfortunately, LiteSpeed integration is not planned to be included in standard CS-Cart. By the way, you can post your suggestion to the CS-Cart forum at UserVoice. The detailed information and explanation why the feature is important to be implemented will help it to earn more votes and probably be among the top features that might be added to CS-Cart. [/color][/font][/size]


[quote name='P-Pharma' timestamp='1413909870' post='194750']And LiteSpeed Cache? That would make a world of difference. [/quote]



[size=4][font=lucida sans unicode,lucida grande,sans-serif][color=#000000]As far as I understand, you mean the cashing on the web-server. It is dangerous to cash CS-Cart not only on the web-server side including LiteSpeed. With every new visit of the CS-Cart store Cookies are installed, consequently, the only way to form cache is to form it for each user and guest, consequently, even it will be impossible to load the first visit from the web-server cache.[/color][/font][/size]



[size=4][font=lucida sans unicode,lucida grande,sans-serif][color=#000000]After that, for example, if you add a new “Cart content” block to your page, the data in it should display the real state, not the cashed one for some period. Otherwise, there is a risk to get old data. If this data is not current is one thing, if this leads to incorrect processing of the order cost is a different matter. [/color][/font][/size]


[quote name='termalert' timestamp='1414129870' post='195096'] [color=#282828][font=arial, verdana, tahoma, sans-serif]The usual forum presence span of any CS-Cart support staff is about 1 day.[/font][/color][/quote]



[size=4][color=#000000][font=LucidaGrande]Yes, you are right, the technical support service gives answers within one business day. But the forum is the place for communicating. There is no fixed frames for answers to questions.[/font][/color][/size]

[quote name='goncharov' timestamp='1414161312' post='195153']

[size=4][font=lucida sans unicode,lucida grande,sans-serif][color=#000000]Unfortunately, LiteSpeed integration is not planned to be included in standard CS-Cart. By the way, you can post your suggestion to the CS-Cart forum at UserVoice. The detailed information and explanation why the feature is important to be implemented will help it to earn more votes and probably be among the top features that might be added to CS-Cart. [/color][/font][/size]

[/quote]



Hi Gleb,



Thanks for bringing in CS-Cart's official view on this subject. You have lots of companies who work very closely with CS-Cart from Russia. I would highly recommend or even almost urge you to ask them to write guides and tutorials to speed up CS-Cart. Default installation is way too slow and to this date, there were only two official addon or extension to speed up the website:

-Alt-Team's custom cache extension with memcache for $500

-WEBO which was around $100 but they no longer support CS-Cart 4.x



As CS-Cart team, you don't have to do all the leg work. You could have people who could write guides and tutorials on how to make CS-Cart work with Varnish etc. We could find temporary solutions to immediate needs and move forward when you guys have new releases.



You may consider 'caching on the web-server' as a dangerous thing but it is really not. It sounds dangerous with CS-Cart mainly because you guys want to do everything “CS-Cart way”. To be honest, this is ridiculous and I believe CS-Cart losing big time because of this.



If you look at overall picture, an ecommerce website's only %10-15 is dynamic, login-add-to-cart and checkout. Rest of the content is static, that remains the same for long time including category pages, product pages etc. These portions could be easily cached and served from cache. Even saving them as “.html” and setting an expiration timeout would work just fine.



You had mentioned about developing official 'xcache' or 'APC' support for the next releases. In my experience, opcache adds really nothing to speeding up the website unless you start saving DB queries in xcache var section.



If you would like to speed up CS-Cart, what you need is very basic:

-DB query cache

-Static content cache (option to save .html on server)

-TPL cache via memcache



If you guys implement this, it will make the response time of a regular CS-Cart installation fly.



We are not even talking about Typo3, nginx rules, Varnish integration etc. Having something very basic just like “WP Super Cache” or “W3 Total Cache” from Wordpress world will suffice to speed up CS-Cart performance greatly.



Please, please, please do not take this CS-Cart way and make everything immensely complicated. You can just take basic steps to make your software a lot faster. WEBO had already done it back in 2010 and you guys should be able to do a lot more. I believe their software is open source and worked with CS-Cart before.So why not take their work and extend it?

I have posted it in uservoice here:

http://cscart.uservo…rt-with-litespe


[quote name='goncharov' timestamp='1414161312' post='195153']

[color=#000000]As far as I understand, you mean the cashing on the web-server. It is dangerous to cash CS-Cart not only on the web-server side including LiteSpeed. With every new visit of the CS-Cart store Cookies are installed, consequently, the only way to form cache is to form it for each user and guest, consequently, even it will be impossible to load the first visit from the web-server cache.[/color][/font][/size]

[/quote]

This should not be the case. There are many other database driven applications which can handle guests and members without cookie problems. LiteSpeed cache and Varnish have usergroups especially to handle this. You should consider talking to Michael from LiteSpeedTech www.litespeedtech.com

CS-Cart and its customers has so much to gain from an integration.



For other projects I could reduce 3 servers to only 1, after LiteSpeed Cache was applied to database driven software. Page load went from slow to very fast. Server load went way down.