Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Cm_RedisSession improve the performance? Here is my benchmark. #45

Closed
ADDISON74 opened this issue Aug 22, 2014 · 7 comments
Closed

Comments

@ADDISON74
Copy link

I have a serious issue related to Cm_RedisSession. I read a lot of articles about this great extension and in most of them performance is improved when working. Sadly, I did not see that in my configuration. A little bit or the same like using session in file system.

Here is my hardware configuration
VMWare
4 Cores 4 Ghz, 16 Gb RAM DDR, SSD

Here is my software configuration
Debian 7.6
Nginx 1.6.1 + PHP-FPM + MySQL (basic configuration just making Magento working, no tuning)
Magento 1.9.0.1 (out of the box, no other extensions or customization)
Redis 2.8.13
PHPRedis (active listed in modules version 2.2.5)
CmRedis active true, enable in Admin, code copy&paste from this website in local.xml
Redis-cli shows keys correctly, I can flush, seeing them back

Here is my benchmark using siege: siege -b -c100 -t3m http://localhost/

(without RedisSessions)
Transactions: 2986 hits
Response Time: 5.91 sec
Transaction rate: 16.62#

(with RedisSessions)
Transactions: 3133 hits
Response Time: 5.65 sec
Transaction rate: 17.44#

As you can see moving sessions from file disk to Redis is not improving at all. Reading this article it seems the improvement is big, not like in my case:

http://pi.iluvltd.co.uk/2014/05/magento-1-9-1-nginx-extras-redis-server-solr-memcached-benchmarks-and-tests/

What I am doing wrong?

@parhamr
Copy link
Contributor

parhamr commented Aug 22, 2014

Your test case is invalid, but it has indeed measured a 4.4 percent improvement in response times. Concurrency of 100 threads is stressing PHP so thoroughly that your test scenario is above the server's configured capacity.

Reduce the concurrency to a count that matches your hardware capacity; you have only 4 cores. Your setup likely hits a negative inflection point at concurrency levels above 6 threads per core (I've seen this in load tests).

What does your .siegerc file look like? What does app/etc/local.xml contain? This isn't just a "flip a switch" improvement—better scaling comes through good configurations.

@colinmollenhour
Copy link
Owner

The article doesn't mention system specs. I see you have SSD, so SSD would favor an improvement in the file backend and would not benefit Redis much so perhaps the article referenced has slow disks. Anyway, I don't expect Cm_RedisSession to be faster than filesystem so I think your performance is probably as it should be. As stated on the other ticket, it is when you go multi-server that the benefits of Redis are realized.

@ADDISON74
Copy link
Author

Will this change anything? http://www.fabrizio-branca.de/redis-optimization.html

I will come back with .siegerc file content. It is standard, no changes inside. Also local.xml is standard Magento 1.9.0.1 but adding the code found here (copy & paste).

I am little confused because I am stressing my mind with this Redis trying to improve the server performance. I read hundreds of articles about how great is Redis with Magento, some kind of a "must have". But after doing the same thing in configuration the results are the same, no improvement. Having SSD there is no need to use Redis for session. This will be the same situation for all the other "old" solutions APC/Memcache.

I will follow your idea decreasing the concurrency to 20 or 50 to see what is happening. Maybe I should improve server configuration with some tuning in parameters. pm.max_children is 200 and it is taking only 2.4Gb from RAM, no warning inside /var/log/php5-fpm.log.

@parhamr
Copy link
Contributor

parhamr commented Aug 22, 2014

A much more valid testing model is to step up through various concurrency levels; two or three data points do not make for conclusive evidence. A 4-core system cannot effectively run 200 php5-fpm processes.

Again: your tests are invalid.

@colinmollenhour
Copy link
Owner

Fabrizio's optimization will only improve the situation if you have a low memory issue which I doubt you have. To be sure you can just disable persistence and run your test again. If it improve then you have identified an issue but I don't expect it to.

Redis is an excellent backend for both cache and sessions in Magento, but when you are running a single server with lots of RAM and a fast SSD then it is hard to compete with the filesystem. Redis will help you maintain that fast performance when you go from single-server to multi-server while still having a correctly functioning system (people running file cache on multiple nodes are making a huge mistake). You didn't post your avg response time, but I'm guessing it is about as good as you'll get without a full-page cache module.

So in short, Redis is great for helping you scale, but on a healthy single-server system don't expect it to do anything magical. Note, I strongly recommend Cm_Cache_Backend_File over Zend_Cache_Backend_File in any case.

If you really want to reduce your page load time focus on full page cache (shameless plug: see colinmollenhour/Cm_Diehard)

@colinmollenhour
Copy link
Owner

To Reid's point, I've already done extensive testing at different concurrency levels: http://goo.gl/NDXan

@ADDISON74
Copy link
Author

I will come back to you with some thoughts after testing.

For decreasing the page load time I have in test Lesti::FPC and Cm_Diehard.

I am struggling with Turpentine/Varnish configuration too which really boots from 15 requests/sec to 253 requests/sec. Page load time from 300 ms to only 6 ms. But there are lots of issues with side blocks being cached (cart, tags, poll, recently view, compare). Unfortunately ideas did not come faster like here. For this I have to thank you both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants