Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor lustate handling to be much more efficient #419

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

neilcook
Copy link
Collaborator

Previously luastates were stored in an array. Worker threads accessed luastates by simply retrieving the "next" state in the array, regardless of whether that state was in use or not. This commit instead uses a pool approach, where worker threads pop the state off the aray while the state is in use, then return the state once it's no longer needed (automatically via destructor). A read-only copy of the entire array is maintained for the console/ control thread which needs to be able to call all luastates.

Previously luastates were stored in an array. Worker threads
accessed luastates by simply retrieving the "next" state in the
array, regardless of whether that state was in use or not.
This commit instead uses a pool approach, where worker threads
pop the state off the aray while the state is in use, then return
the state once it's no longer needed (automatically via destructor).
A read-only copy of the entire array is maintained for the console/
control thread which needs to be able to call all luastates.
@neilcook neilcook requested a review from chbruyand March 27, 2024 13:29
Copy link

Test Results

  2 files  ±0    2 suites  ±0   32m 9s ⏱️ ±0s
 70 tests ±0   70 ✅ ±0  0 💤 ±0  0 ❌ ±0 
140 runs  ±0  140 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit b2b1146. ± Comparison against base commit acbdfd9.

Copy link
Member

@chbruyand chbruyand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@neilcook neilcook merged commit 4141a4a into PowerDNS:master Apr 3, 2024
12 checks passed
@neilcook neilcook deleted the luastate branch April 3, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants