I’m looking to change my application to store PHP Session data in MySQL. The application is ajax intensive but does not utilize long-polling or any other type of persistent connection.
My question is, are there any gotcha’s I need to be aware of when writing this code? For example; I have a page that sends 4 ajax requests to load data (for another topic); will this cause any locking issues if I have to update the session data on every request?
Thanks.
There could be race conditions if you make ajax requests to multiple scripts at once. You can’t verify they will complete in the order you assigned the ajax requests unless you use callbacks, which would prove quite a bit slower.
It should be fine as long as you’re only reading, but if you’re writing when multiple requests are being made you have no way to verify that the reads are taking place on the most recent data.