Welcome Guest, Not a member yet? Register   Sign In
Session usage with Redis is slow
#1

I'm migrating my application with CodeIgniter 3 to use Redis as a session manager, but as it makes many requests in AJAX I noticed that they tend to take longer, 11 requests that in all took 300ms now take 11s.

I made some code changes to get all sessions at the beginning of each controller, put the values in a model and after that I run
Code:
session_write_close()
.

The request time even improved, lowering the time to an average of 3 - 5s, but far from ideal.

Reading the CodeIgniter documentation I saw this:


Quote:CodeIgniter’s Session library does NOT use the actual ‘redis’ session.save_handler.  
With that I decided to disable the autoload of the native CodeIgniter session and directly use the
Code:
session_start()
at the beginning of the Controllers before getting the session values and feeding my Model.

To my surprise, the application read the data again in less than 300ms.
And even not using
Code:
session_write_close()
anymore, it still continued at the same speed.

What could be happening with CodeIgniter that makes it take longer to connect and read the session in Redis?
Reply
#2

Did you configure your PHP to use Redis handler?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB