-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
BlockOnBusy backoff period is long #75
Comments
Seems reasonable. I think I copied these values from somewhere in the SQLite source without much thought. |
Just FYI. The SQLite implementation does use those numbers, but they're milliseconds, not seconds:
So SQLite (by default, in all modern systems) never sleeps in increments of more than 100ms. |
Whoops, then that was definitely an error on my part. Thanks all! |
Thanks for the quick turnaround! |
You and @ncruces make a fair point. I've removed the values above 100ms. That will be incorporated in the next release.
You're very welcome! I am glad that is your experience. 😊 |
I'm in the process of porting a codebase to use this library for its sqlite interactions.
We have a very highly concurrent workload and some tests that assert that the application doesn't start returning busy errors under load.
When I ported these tests over, they started taking over 3 mins to complete, while in the current implementation they take 1s at most.
I managed to trace down the difference to the backoff times used in the
BlockOnBusy
handler:go-sqlite/sqlite.go
Lines 338 to 351 in 5c555a3
The shortest wait period is 1s, and it increases very rapidly from there.
If we compare this with the backoff used in the default
BusyTimeout
handler:https://gitlab.com/cznic/sqlite/-/blob/master/lib/sqlite_darwin_amd64.go?ref_type=heads#L121226
This one starts 1ms and waits up to 100ms at most.
I think there's too much difference between these two: a backoff of a few ms will suffice for most well behaved applications to resolve the lock.
In any case, it makes the current default behaviour of this library unusable in my project, it will tank throughput. I can revert to using a busy timeout, but I like the
BlockOnBusy
design: it removes a hard to guess tunable from the equation.If you are not willing to change these backof timeouts, would you consider making them tunable with a config option?
The text was updated successfully, but these errors were encountered: