Welcome Guest, Not a member yet? Register   Sign In
Redis/db session drivers causing deadlocks (MySQL 5.6, CI 3.0.6)
#1

(This post was last modified: 04-27-2016, 05:24 PM by spjonez.)

In our app we have certain actions that cause significant concurrent requests and are using the MySQLi driver with an Amazon RDS database (MySQL compliant). Locally we run the community edition 5.6 of MySQL so this issue is not specific to RDS.

Using the files session library no deadlocks occur during these operations. Using the database or redis session libraries this happens occasionally and seems to be tied to the number of requests running. We thread additional calls through subdomains to bypass the 2 concurrent per domain limit in most browsers.  In one action, a request is sent to create an object. In the callback of this request another call is made to update the object after some changes have been made. Randomly this will cause database deadlocks on updating the record that was created in the first call. Since the second call is made from the callback of the first the two cannot be running at the same time.

The average response time for the first call is ~200ms. The average response time for the second call is ~150ms. I am calling session_write_close at the start of both methods since neither use session data (library is auto-loaded).

Do non-file based divers have an inherent lock time? Why am I seeing different results with different drivers? Using the files session library is not an option in production as we're load balanced and sticky sessions will drop when we roll updates through each node.
Reply
#2

I have pretty same problem but with memcached, check my question here http://forum.codeigniter.com/thread-65249.html
Maybe will someone provide right answer  Confused
Reply
#3

The deadlocks were caused by something specific to our code base. We use a wrapper to AJAX calls so we can abort them in certain situations. In some cases the call was reaching the server before abort was called so it was in fact running twice. It was a problem with our code and not CI.
Reply
#4

We have the similar situation with Amazon Aurora.

We see too many `SELECT GET_LOCK('xxx', 300) AS ci_session_lock` queries in the processlist.
And MySQL reaches the max connections.

Any advice to get a clue?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB