Skip to content

Commit

Permalink
Auto merge of #614 - Mark-Simulacrum:opt, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Avoid increasing in-memory cache

Our server is currently somewhat memory constrained, and it's easier to let the
OS manage the page cache than try to do so ourselves right now.

Reverts #606.
  • Loading branch information
bors committed Mar 7, 2022
2 parents 3ea629d + 941a1f5 commit a14dda6
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ struct ConnectionCustomizer;
impl CustomizeConnection<Connection, ::rusqlite::Error> for ConnectionCustomizer {
fn on_acquire(&self, conn: &mut Connection) -> Result<(), ::rusqlite::Error> {
conn.execute("PRAGMA foreign_keys = ON;", [])?;
// Increase cache size from ~2 MB (current default) to ~100 MB.
//
// This should help sqlite keep pages in memory rather than needing to
// seek and read. Those typically hit the OS cache, but syscalls are
// still somewhat expensive at these volumes.
conn.execute("PRAGMA cache_size = -100000;", [])?;
Ok(())
}
}
Expand Down

0 comments on commit a14dda6

Please sign in to comment.