I decided to give Lua Multithreading one more chance, so I tried to measure the performance impact of the mutex locking required for the thread safety, considering our current code. For this, I adapted code from my LuaMultiThreaded project ( https://github.com/madmaxoft/LuaMultiThreaded ) and let it measure the overall count of LuaLock calls. The numbers are bad:
Server startup and immediate shutdown: ~430'000 locks
One webadmin page requested: 1'500 - 2'500 locks
Initializing the Core: 5'000 locks
Initializing the Gallery: 24'000 locks
Core's OnTick handler (for the "tps" command"): 68 locks each call
I'm afraid that making this run multithreaded will kill the server performance-wise. The locks are just too much contended. Unfortunately Lua's locking is too fine-grained and thus doesn't scale well.
I have pushed my code to the LuaMultiThreadedLockCount branch; I don't expect it to be merged to master, in fact, I don't even expect it to compile under Linux.
Server startup and immediate shutdown: ~430'000 locks
One webadmin page requested: 1'500 - 2'500 locks
Initializing the Core: 5'000 locks
Initializing the Gallery: 24'000 locks
Core's OnTick handler (for the "tps" command"): 68 locks each call
I'm afraid that making this run multithreaded will kill the server performance-wise. The locks are just too much contended. Unfortunately Lua's locking is too fine-grained and thus doesn't scale well.
I have pushed my code to the LuaMultiThreadedLockCount branch; I don't expect it to be merged to master, in fact, I don't even expect it to compile under Linux.