• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redis/db session drivers causing deadlocks (MySQL 5.6, CI 3.0.6)

#1
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?
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
3 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.