Skip to content

feat: Add buffering to provisioner job logs #4918

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

Merged
merged 5 commits into from
Nov 7, 2022
Merged

feat: Add buffering to provisioner job logs #4918

merged 5 commits into from
Nov 7, 2022

Conversation

kylecarbs
Copy link
Member

This should improve overall build performance, and especially under load.

It removes the old id column on the provisioner_job_logs table and replaces it with an auto-incrementing big integer to preserve order.

Funny enough, we never had to care about order before because inserts would at minimum be 1ms different. Now they aren't, so the order needs to be preserved.

This should improve overall build performance, and especially under load.

It removes the old `id` column on the `provisioner_job_logs` table
and replaces it with an auto-incrementing big integer to preserve order.

Funny enough, we never had to care about order before because inserts
would at minimum be 1ms different. Now they aren't, so the order needs
to be preserved.
@kylecarbs kylecarbs requested a review from coadler November 6, 2022 19:14
@kylecarbs kylecarbs self-assigned this Nov 6, 2022
@kylecarbs kylecarbs requested a review from a team as a code owner November 6, 2022 19:14
@kylecarbs kylecarbs requested review from BrunoQuaresma and removed request for a team November 6, 2022 19:14
@kylecarbs kylecarbs changed the title feat: Add bufferring to provisioner job logs feat: Add buffering to provisioner job logs Nov 6, 2022
@kylecarbs kylecarbs enabled auto-merge (squash) November 6, 2022 23:16
r.flushLogsTimer.Reset(r.logBufferInterval)
return
}
if len(r.queuedLogs) > 100 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this 100 should be configurable like the buffer interval.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment and left it reconfigurable for now.

@@ -0,0 +1,3 @@
ALTER TABLE provisioner_job_logs DROP COLUMN id;

ALTER TABLE provisioner_job_logs ADD COLUMN id BIGSERIAL PRIMARY KEY;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we guarantee that adding this bigserial column will keep the same order of logs?

Copy link
Member Author

Choose a reason for hiding this comment

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

It likely won't in all cases, but it seems to in most.

Having a safe migration seems unreasonable here, so we settle for pretty great.

@kylecarbs kylecarbs merged commit 3028185 into main Nov 7, 2022
@kylecarbs kylecarbs deleted the bufferlogs branch November 7, 2022 02:50
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants