Status: Closed (View Workflow)
[22:04:36] <mbox> hello.. i have a suggestion for the unique_id() function, to improve performance on MyISAM. it's this... reverse the order of the two set_config lines so that the timestamp is set in the database before the random seed.
[22:05:23] <mbox> this stops it from getting out of control when there's high contention on the phpbb_config table
[22:06:19] <mbox> when it would get 10 seconds behind for any reason, any new unique_id call is generating 2 calls... first, setting the value... then setting the timestamp
[22:07:58] <mbox> i can't think of how to explain it better, but the result was more and more threads being created and contending for that lock, but they had to get it twice before their timestamp got set. setting it first will greatly reduce the number of threads trying to seed it.
[22:11:00] <mbox> it was bringing down my database server.
[22:47:40] <mbox> this poorly made diagram should help explain the race condition i mentioned earlier: http://i.imgur.com/wR3S3.png
[22:47:46] <mbox> hope it helps someone other than me. enjoy.
- is related to
PHPBB3-1877 rand_seed changed serveral times per second