Gad D Lord
Gad D Lord

Reputation: 6762

Is SQLite suitable for web site usage?

I have a database of 50 MB size in SQLite 3. All db objects are accessed through a web service. Is SQLite a good choice for an concurrent online usage of about 500 parallel users?

Note: Users will use same tables, but not the same rows. Each user can see/update/delete only his/her data.

Upvotes: 10

Views: 22885

Answers (4)

Peter Dunne
Peter Dunne

Reputation: 57

I run a few web servers on a VPS and locally on Raspberry Pi computers. These all run on Ubuntu Linux using MySQL or MariaDB.

For web servers, you must have transaction management to ensure writes from multiple users function properly.

SQLite is intended for low usage, single instance database, and you are likely to suffer data integrity problems, write failures and other issues with it.

SQLite is not suitable for web servers.

You will also have to learn about web security and issues such as cross site scripting and SQL injection attacks or you risk having you site trashed within days.

I suggest you install a local web server suite, known as WAMP on Windows and LAMP on Linux meaning Windows (Linux), Apache, MySQL, and PHP.
phpMyAdmin is a great tool for database management on web servers and is generally included with WAMP, LAMP setups.
This is always a good starting point for anybody learning about web hosting.

Upvotes: -1

tster
tster

Reputation: 18237

According to Wikipedia, SQLite will fail a write if there are any concurrent accesses to the database. This alone makes me think it is not usable for 500 concurrent users.

Unless there are hardly any updates going on that is. I think 500 concurrent users is certainly enough to warrant a full blown DBMS.

Note, it looks like that the Wikipedia article is wrong (pretty common on Wikipedia really). Anyway, if those 500 users are going to be updating a lot, I would still be weary of 500 concurrent users with 0 concurrent writes. While the numbers in the thread referenced by Nifle sound good, those are most likely from tests which are engineered to make SQLite look good. I doubt you will get the same mileage with all queries, all table sizes, all cache states, etc.

Upvotes: 4

Peter Dunne
Peter Dunne

Reputation: 57

MySQL is a far better choice for web servers.
SQLite is not installed by default on most servers whereas MySQL is often installed.
MySQL has transaction management so it is suitable for multiple concurrent writes.

Upvotes: -4

Nifle
Nifle

Reputation: 11923

SQLite usually will work great as the database engine for low to medium traffic websites (which is to say, 99.9% of all websites). The amount of web traffic that SQLite can handle depends, of course, on how heavily the website uses its database. Generally speaking, any site that gets fewer than 100K hits/day should work fine with SQLite. The 100K hits/day figure is a conservative estimate, not a hard upper bound. SQLite has been demonstrated to work with 10 times that amount of traffic.

(Source)

Upvotes: 21

Related Questions