This repository was archived by the owner on Aug 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
fix: Improve DB transaction hangs #425
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #425 +/- ##
==========================================
+ Coverage 48.80% 48.83% +0.03%
==========================================
Files 52 52
Lines 8364 8442 +78
==========================================
+ Hits 4082 4123 +41
- Misses 4282 4319 +37
Continue to review full report at Codecov.
|
* SCHEDULED: the kernel occupies agent resources on DB but the actual container is not created yet
…e are no scheduled sessions
…f manual aioredlock
* Use pg_advisory_lock to protect critical sections in the dispatcher module.
- TODO: we need a mechanism to coalesce burst firing of DoScheduleEvent and
DoPrepareEvent, to prevent exhaustion of the DB connection pool!
* Use the "REPEATABLE READ" transaction isolation level by default,
and retry update queries as necessary.
* Remove several duplicate kernels.status updates.
…sory_lock() actxmgrs
achimnol
added a commit
that referenced
this pull request
May 10, 2021
* Now all DB transactions use the "SERIALIZABLE" isolation level with explicit retries. * Now DB transactions that includes only SELECT queries are marked as "read-only" so that the PostgreSQL engine could optimize concurrent access with the new isolation level. All future codes should use `beegin_readonly()` method from our own subclassed SQLAlchemy engine instance replacing all existing `db` context variables. * Remove excessive database updates due to keypair API query counts and kernel API query counts. The keypair API query count is re-written to use Redis with one month retention. (#421) Now just calling an API does not trigger updates in the PostgreSQL database. * Fix unnecessary database updates for agent heartbeats. * Split many update-only DB transactions into smaller units, such as resource recalculation. * Use PostgreSQL advisory locks to make the scheduling decision process as a critical section. * Fix some of variable binding issues with nested functions inside loops. * Apply event message coalescing to prevent event bursts (e.g., `DoScheduleEvent` fired after enqueueing new session requests) which hurts the database performance and potentially break the transaction isolation guarantees. Backported-From: main Backported-To: 21.03
achimnol
added a commit
that referenced
this pull request
May 10, 2021
* Now all DB transactions use the "SERIALIZABLE" isolation level with explicit retries. * Now DB transactions that includes only SELECT queries are marked as "read-only" so that the PostgreSQL engine could optimize concurrent access with the new isolation level. All future codes should use `beegin_readonly()` method from our own subclassed SQLAlchemy engine instance replacing all existing `db` context variables. * Remove excessive database updates due to keypair API query counts and kernel API query counts. The keypair API query count is re-written to use Redis with one month retention. (#421) Now just calling an API does not trigger updates in the PostgreSQL database. * Fix unnecessary database updates for agent heartbeats. * Split many update-only DB transactions into smaller units, such as resource recalculation. * Use PostgreSQL advisory locks to make the scheduling decision process as a critical section. * Fix some of variable binding issues with nested functions inside loops. * Apply event message coalescing to prevent event bursts (e.g., `DoScheduleEvent` fired after enqueueing new session requests) which hurts the database performance and potentially break the transaction isolation guarantees. Backported-From: main Backported-To: 20.09
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.