using SQLite in Django in production?

后端 未结 6 688
温柔的废话
温柔的废话 2020-12-05 17:55

Sorry for this question, I dont know if i\'ve understood the concept, but SQLite is Serverless, this means the database in in a local machine, and it\'s stored in one file,

6条回答
  •  暖寄归人
    2020-12-05 18:20

    Different databases manage concurrency in different ways, but in sqlite, the method used is a global database-level lock. Only one thread or process can make changes to a sqlite database at a time; all other, concurrent processes will be forced to wait until the currently running process has finished.

    As your number of users grows; sqlite's simple locking strategy will lead to increasingly great lock contention, and you will need to migrate your data to another database, such as MySQL (Which can do row level locking, at least with InnoDB engine) or PostgreSQL (Which uses Multiversion Concurrency Control). If you anticipate that you will get a substantial number of users (on the level of say, more than 1 request per second for a good part of the day), you should migrate off of sqlite; and the sooner you do so, the easier it will be.

提交回复
热议问题