Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using SQLite in Django in production?

Tags:

sqlite

django

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, this file is only accessible on one mode: if one client reads it, it's made only for reading mode for other clients, and if a client writes, then all clients have the write mode, so only in one mode at once! so imagine that i've made a django application, a blog for example; then how is this made using sqlite? since if a client enters to the blog he gots the reading mode to see the page and the blog entries, and if a registred client tries to add a comment then the file will be made as write mode, so how can sqlite handle this? so, does SQLite is here just like the BaseHTTPServer (the server shipped with django), for testing and learning purpose?

like image 244
Abdelouahab Avatar asked Aug 02 '11 14:08

Abdelouahab


People also ask

Is Django SQLite good for production?

If multiple apps(database clients) is not the case, SQLite is a great production choice in 99% of cases.

Can you use SQLite with Django?

By default, the configuration uses SQLite. If you're new to databases, or you're just interested in trying Django, this is the easiest choice. SQLite is included in Python, so you won't need to install anything else to support your database.

Which database is best for Django production?

The three most widely used Database Management Systems for Django are SQLite, MySQL, and PostgreSQL. The Django community and official Django documentation state PostgreSQL as the preferred database for Django Web Apps. The official Django documentation states the following about PostgreSQL.

Is SQLite good for big projects?

Sqlite is ok for mobile application and small applications but I would avoid it for larger projects. Go for something like MySQL, SQL Server (Windows) or Postgre. SQLite can be really slow in big projects. It depends on what are your wanting to do and what a "large project" in your view is.


1 Answers

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.

like image 74
SingleNegationElimination Avatar answered Oct 19 '22 16:10

SingleNegationElimination