algernon icon indicating copy to clipboard operation
algernon copied to clipboard

One LuaState for one User?

Open linkerlin opened this issue 2 years ago • 2 comments

LuaState is very expensive for creating. And if we treat user as a game player and a webpage as a NPC, we can offer only one lua-state for one logined user. So we can use a coroutine for one user:webpage pair, the context of talking is auto-saved in the coroutine's context. Every lua-state can save to a key-value store, when it timeouted. What about it ?

linkerlin avatar Jun 30 '22 01:06 linkerlin

By the way, we can use the concurrent-map for managing lua-states.

linkerlin avatar Jun 30 '22 01:06 linkerlin

This is a good idea! Thanks for reporting.

xyproto avatar Jul 02 '22 14:07 xyproto