Make sql requests asynchonous #14

Open
opened 2023-05-27 02:01:14 +02:00 by quentinlegot · 0 comments
Owner

Each sql request currently block the main thread, a "slow" request (network are always slow compared toEach sql request currently block the main thread, a "slow" request (network are always slow compared to others IO, even on LAN) can really slower the TPS, and it could be a serious problem with many players.

Multiple solutions:

  1. Each requests are made on a single separated thread
  2. threadpool, using tasks module
  3. async using Kotlin

The last solution is my least prefered, still blocking the thread when awaiting for the result but with a separate thread or threadpool, we cannot exploit the result easily (need a message passing method).

But waiting for the result require to block the main thread.
The issue is to resync on main thread (create a new sync task) when the request is terminated and exploit it, so we don't block uselessly the main thread others IO, even on LAN) can really slower the TPS, and it could be a serious problem with many players.
The issue is to resync on main thread (create a new sync task) when the request is terminated and exploit it, so we don't block uselessly the main thread.

Each sql request currently block the main thread, a "slow" request (network are always slow compared toEach sql request currently block the main thread, a "slow" request (network are always slow compared to others IO, even on LAN) can really slower the TPS, and it could be a serious problem with many players. Multiple solutions: 1. Each requests are made on a single separated thread 2. threadpool, using tasks module 3. async using Kotlin The last solution is my least prefered, still blocking the thread when awaiting for the result but with a separate thread or threadpool, we cannot exploit the result easily (need a message passing method). But waiting for the result require to block the main thread. The issue is to resync on main thread (create a new sync task) when the request is terminated and exploit it, so we don't block uselessly the main thread others IO, even on LAN) can really slower the TPS, and it could be a serious problem with many players. The issue is to resync on main thread (create a new sync task) when the request is terminated and exploit it, so we don't block uselessly the main thread.
quentinlegot added this to the Release 5.1.0 or 6.0.0 milestone 2023-05-27 02:08:03 +02:00
quentinlegot removed this from the Release 5.1.0 or 6.0.0 milestone 2023-05-27 02:08:23 +02:00
quentinlegot added this to the Release 5.1.0 or 6.0.0 milestone 2023-05-27 02:08:25 +02:00
quentinlegot added the
enhancement
Breaking
labels 2023-05-27 02:08:47 +02:00
quentinlegot self-assigned this 2023-05-27 02:09:29 +02:00
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: quentinlegot/Toolbox#14
No description provided.