-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
perf(startup): use WAL journal for sqlite databases in DENO_DIR #23955
Conversation
@@ -42,7 +42,7 @@ impl CacheDBConfiguration { | |||
fn create_combined_sql(&self) -> String { | |||
format!( | |||
" | |||
PRAGMA journal_mode=TRUNCATE; | |||
PRAGMA journal_mode=WAL; |
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 seems we previously disabled this for performance reasons? #18084
I wonder what impact this will have on non-gcp machines (not sure why that machine is so slow because neither my winows, mac, or linux machine have this issue)
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.
Oh, just realized that was done only for startup perf reasons, but we initialize the sqlite caches on blocking threads now.
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 that was in #18401, and we benchmarked almost all of them within a 10th of a ms.
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 just benchmarked WAL and it is much faster on my mac. 176ms down to 142ms.
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.
LGTM
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.
LGTM!
In #23955 we changed the sqlite db journal mode to WAL. This causes issues when someone is running an old version of Deno using TRUNCATE and a new version because the two fight against each other.
While investigating poor cold start performance on my GCP VM (32 cores, 130GB SSD), I found that writing to the various sqlite databases in DENO_DIR was quite slow. The slowness seems to primarily be caused by excessive latency from a number of
fsync()
calls.The performance difference is best demonstrated by deleting the sqlite databases from DENO_DIR while leaving the downloaded sources in place.
The benchmark (see notes below):
Notes:
eatmydata
(which is a tool to neuterfsync()
calls)The script that got benchmarked: