-
Notifications
You must be signed in to change notification settings - Fork 1
Thread Model
boyism80 edited this page Jul 3, 2026
·
1 revision

Within each Game process:
-
I/O threads handle socket read/write (
boost::asio). - Logic threads run game handlers, map updates, and Lua.
- Received packets are dispatched from I/O to the logic thread that owns the session's map; responses go back through I/O.
Maps are bound to logic threads by map ID:
logic_thread = map.id % N // N = number of logic threadsAll objects on the same map run on the same logic thread, avoiding locks between nearby objects.
Uneven map distribution can overload a single logic thread. Communication between maps on different threads is more complex than within a single map. I/O and logic thread counts are configurable in the server config file.
An additional AMQP thread handles RabbitMQ consume/publish (not shown in the diagram).