enwikipedia-acc / waca

English Wikipedia Account Creation Interface
https://accounts.wmflabs.org/internal.php
The Unlicense
33 stars 43 forks source link

Sessions occasionally lock each other excessively #421

Open stwalkerster opened 7 years ago

stwalkerster commented 7 years ago

https://secure.php.net/manual/en/function.session-write-close.php

session data is locked to prevent concurrent writes only one script may operate on a session at any time

You can reduce the time needed [...] by ending the session as soon as all changes to session variables are done.

session_write_close() ends the session and releases the lock. While this won't help with individual page loads, it should help when multiple pages are loaded at once.

Approaches we could take:

stwalkerster commented 7 years ago

image

Page load started while a different long page load was in progress.

stwalkerster commented 7 years ago

We have quite a few examples of this now from production:

image

image

image

image

stwalkerster commented 4 years ago

I did some work on this to move sessions to redis, but there were definite concurrency issues at play.