-
Notifications
You must be signed in to change notification settings - Fork 892
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
Conversation
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.
r.flushLogsTimer.Reset(r.logBufferInterval) | ||
return | ||
} | ||
if len(r.queuedLogs) > 100 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
This should improve overall build performance, and especially under load.
It removes the old
id
column on theprovisioner_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.