Skip to content
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

SQLite not WAL mode making it 3+x slower #9290

Open
ignatz opened this issue Nov 18, 2024 · 0 comments
Open

SQLite not WAL mode making it 3+x slower #9290

ignatz opened this issue Nov 18, 2024 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@ignatz
Copy link

ignatz commented Nov 18, 2024

Describe the Bug

Disclaimer: I'm not a payload user so I might be using the wrong lingo

Just tried out the latest version of payload with the sqlite beta. I set up a few collections and benchmarked the REST APIs. I very quickly noticed that you're not creating new databases with a WAL but rather with the legacy default.

sqlite3 <database>.db
sqlite> PRAGMA journal_mode;
delete

Updating the db with my own settings,

PRAGMA journal_mode       = WAL;
PRAGMA journal_size_limit = 200000000;

As expected, I got a significant performance boost not having to checkpoint after every insert. In case of my benchmark it was 3+x.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload

Reproduction Steps

Spin up payload with sqlite

sqlite3 <database>.db
sqlite> PRAGMA journal_mode;
delete

Which area(s) are affected? (Select all that apply)

db-sqlite

Environment Info

Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.7.0
Relevant Packages:
  payload: 3.0.0-beta.134
  next: 15.0.0
  @payloadcms/live-preview-react: 3.0.0-beta.134
  @payloadcms/next/utilities: 3.0.0-beta.134
  @payloadcms/payload-cloud: 3.0.0-beta.134
  @payloadcms/plugin-form-builder: 3.0.0-beta.134
  @payloadcms/plugin-nested-docs: 3.0.0-beta.134
  @payloadcms/plugin-redirects: 3.0.0-beta.134
  @payloadcms/plugin-search: 3.0.0-beta.134
  @payloadcms/plugin-seo: 3.0.0-beta.134
  @payloadcms/richtext-lexical: 3.0.0-beta.134
  @payloadcms/ui/shared: 3.0.0-beta.134
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Debian 6.9.10-1 (2024-07-19)
  Available memory (MB): 30786
  Available CPU cores: 16
@ignatz ignatz added status: needs-triage Possible bug which hasn't been reproduced yet v3 validate-reproduction labels Nov 18, 2024
@denolfe denolfe removed the v3 label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants