I am developing an application that uses CherryPy. Now I need to implement a database, and I would very much like it to be embedded with the app, to save users some headache. The obvious first choice is of course SQLite, seeing how it's part of the standard library.
There seems to be a lot of different takes on this. Some saying that you should never use SQLite in a threaded application, some saying it's ok, and with wildly differing estimates of how many writes per second I can expect.
-
Is using SQLite in this way viable, and how slow can I expect writing to the database will be?
-
If viable, what is the best method of implementing it? Subscribing a connection to each start_thread? Start a connection every time a page is exposed, as some seem to do?
-
I've read that turning PRAGMA synchronous=OFF in SQLite can improve performance at the cost of "if you lose power in the middle of a transaction, your database file might go corrupt." What are the probabilities here? Is this an acceptable choice perhaps in conjunction with some sort of backup system?
-
Are there any other embedded databases that would be a better choice?
-
Should I just give up on this and use a PostgreSQL database at the cost of user convenience?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire