Jump to content

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

Using Redis For Both Back End Cache And Sessions Rate Topic   - - - - -

 
  • buging
  • Member
  • Members
  • Join Date: 12-Jan 11
  • 332 posts

Posted 19 December 2016 - 04:33 AM #1

I tried to use the recommended setting to use APCu for cache, and redis for sessions (using PHP 7 with multivendor 4.3.10). However, the store crawls and it takes about 2-3 seconds for a page to load. I switched to using redis for both and the page load time improved dramatically. 

 

Now I have 2 questions

 

1. Has anyone encountered performance issues with APCu for cache and how was it fixed?

2. Any potential issue using Redis for both? I have a VPS with 4GB RAM.

 

Thanks in advance!



 
  • mazter
  • Senior Member
  • Members
  • Join Date: 04-Apr 12
  • 258 posts

Posted 10 January 2017 - 02:39 AM #2

I can't talk about the performance because it is extremely difficult to measure the difference. I can tell you though there is a problem with Redis and it is causing my website to have session problems. They fixed Redis in next version but Redis 3.x and PHP 7 has problem.

 

Here is what I get in my error_log. I had to switch over to Database.

 

PHP Catchable fatal error:  session_regenerate_id(): Failed to create(read) session ID: user (path: app/Tygh/Web/Session.php on line 326



 
  • mazter
  • Senior Member
  • Members
  • Join Date: 04-Apr 12
  • 258 posts

Posted 02 February 2017 - 08:36 PM #3

I had to switch back to PHP 5.6 because of this error but it is really problematic. PHP 7.0 is at least 30% faster than 5.6 and it makes a big difference.

 

Does anybody have this issue with their system?



 
  • abolshakov
  • Architect
  • CS-Cart Architects
  • Join Date: 20-Aug 14
  • 93 posts

Posted 02 February 2017 - 09:15 PM #4

Hi! 

 

there is a problem with Redis and it is causing my website to have session problems.

Redis 3.x and PHP 7 has problem.

 

 

Can you please tell more details about the problem you've faced? Is it only fatal error or something else?

 

 

1. Has anyone encountered performance issues with APCu for cache and how was it fixed?

 

 

We, developers team, haven't. But this may be related to incorrect configuration of APCu, I mean shared memory limits.

Also, such problems require APCu cache hit/miss rate monitoring, there're a lot of one-file scripts on the internet that can be used for this purpose.

 

 

2. Any potential issue using Redis for both? I have a VPS with 4GB RAM.

 

 

It's all about Redis configuration.


Alexander Bolshakov
CS-Cart Architect Team


 
  • mazter
  • Senior Member
  • Members
  • Join Date: 04-Apr 12
  • 258 posts

Posted 03 February 2017 - 12:07 AM #5

Hi Alexander,

 

Please see these articles:

 

https://github.com/p...edis/issues/818

https://github.com/p...on/issues/12234

https://github.com/p...edis/issues/658

 

It is very similar to these issues. It is random. I have 175 x 500 Server error message in my apache logs that means people got "Server Failed" message.

 

 

Redis just came up with 3.1.1 and I upgraded redis on our server so I'm hoping it will fix it at least for redis.

 

This is something that you must look at since all other people reported says something to do with how the code is handling sessions. It happens with PHP 7.0.x and I have php running as php-fpm.

 

PHP Catchable fatal error:  session_regenerate_id(): Failed to create(read) session ID: user (path: /www/home/public_html/) in /www/home/public_html/app/Tygh/Web/Session.php on line 326



 
  • mazter
  • Senior Member
  • Members
  • Join Date: 04-Apr 12
  • 258 posts

Posted 03 February 2017 - 11:25 AM #6

I can report that even with Redis 3.1.1, the issue still persists. I still have tons of 500 Server error in my log file. I'm having to return back to PHP 5.6 which really sucks.

 

Can you please fix the problem with the code?



 
  • poppedweb
  • Authorized Reseller
  • Members
  • Join Date: 02-Aug 16
  • 431 posts

Posted 09 February 2017 - 03:25 PM #7

I can report that even with Redis 3.1.1, the issue still persists. I still have tons of 500 Server error in my log file. I'm having to return back to PHP 5.6 which really sucks.

 

Can you please fix the problem with the code?

 

I'd suggest downgrading to Redis 3.0.6 as this is the latest version known to be stable. 


PoppedWeb | sales@poppedweb.com | https://poppedweb.com
TurnKey Website Design | Add-Ons | Performance Audits | Dedicated Server Management
24/7 Support | Response within an hour (during working hours).

 
  • fdo
  • Member
  • Members
  • Join Date: 12-Aug 15
  • 42 posts

Posted 16 February 2017 - 09:26 PM #8

This is a PHP7 issue that causes various platforms/frameworks around the web to fail for certain saved sessions. The temp solution is to force strings even when FALSE is provided by PHP7. This issue thread talks about it, and the magento fix works for CS too: https://github.com/I...mment-165618172

 

In app/Tygh/Session.php find "public static function read($sess_id)" and look for its return.

 

Change "return $data;" into "return (string)$data;" to enforce a string when returning session data.

 

It seems to have fixed it on our shops. Please let us know in this topic if it doesn't work or you still see it happening somewhere else.



 
  • kaavain
  • Senior Member
  • Members
  • Join Date: 22-Nov 14
  • 1124 posts

Posted 01 May 2018 - 08:11 AM #9

Hi
Does anybody knows the fix? Has the similar problem, but login and chart is working for me and most users..

PHP Catchable fatal error: session_regenerate_id(): Failed to create(read) session ID: user (path: /home/admin/tmp) in /home/admin/web/stencil-library.ru/public_html/app/Tygh/Web/Session.php on line 326

Line 326 says

session_regenerate_id(true);

 
  • kaavain
  • Senior Member
  • Members
  • Join Date: 22-Nov 14
  • 1124 posts

Posted 01 May 2018 - 10:03 AM #10

I've got the trick as I see:

PHP Catchable fatal error: session_regenerate_id(): Failed to create(read) session ID: user (path: /home/admin/tmp) in /home/admin/web/stencil-library.ru/public_html/app/Tygh/Web/Session.php on line 326

326 - where the error occurs in in function session_regenerate_id() which gets not ID but Boolean FALSE.

read($sess_id) - this function generates FALSE if session does not exist. So we must change NOT the line 326 BUT the return of the function which read session ID.

In 4.3.6 is is app/Tygh/Web/Session.php line 676 in public function read($session_id)

Am I right?