0
votes

As SQLite Doc mentioned,

WAL provides more concurrency as readers do not block writers and a writer does not block readers. Reading and writing can proceed concurrently.

Writers merely append new content to the end of the WAL file. Because writers do nothing that would interfere with the actions of readers, writers and readers can run at the same time. However, since there is only one WAL file, there can only be one writer at a time.

I've tried to simulate the scenario by sending multiple requests via JMeter as following:

https://i.stack.imgur.com/HdKBf.png

Nothing went wrong after the simulation. But my concerns are:

  1. Does it mean in WAL mode, SQLite will handle multiple write requests itself?
  2. Did I simulate the scenario in the right way? (Is there any better tool to do it?)

Thanks in advanced.

1

1 Answers

1
votes

To answer your title question: No, SQLite3 in WAL-Mode will not corrupt your Database file.

Write Ahead Logging will enable you to read and write independently, but writes will still be executed one after another, even if you send them to the SQLite Database at the same time.

You can look up more advantages or disdvantages of WAL-Mode in the SQLite-Wiki - WAL