Description
I've been trying to use these SQLite bindings for Golang and been observing that my queries pause frequently for a significant amount of time. Given enough contention accessing the database, the whole app grinds to a halt.
I thought I had a deadlock somewhere, but I think the cause is simpler and this online post http://beets.io/blog/sqlite-nightmare.html helped me track it down.
Basically, it seems to me that sqlite is being compiled without usleep support, which means that any backoff during contention incurs a significant penalty. Inspecting the code, I do not see HAVE_USLEEP=1
being defined anywhere in this codebase.
Setting -DHAVE_USLEEP=1
in the #cgo
stanza of sqlite3.go
should be sufficient, though I don't know if that's going to break any supported platform.