SQLite for client-server

2019-04-22 18:39发布

I've seen a couple of SQLite performance questions here on Stackoverflow, but the focus was on websites, and I'm considering using this DB in a client-server scenario:

  • I expect 1-10 clients for one server for now, could go up to 50 or more in the future.
  • slightly more reads than writes
  • the DB would sit behind a server process (i.e: not using direct DB access through a network)

Would using SQLite make the app less responsive as opposed to using PostgreSQL? My intuition tells me that it should be ok for these loads, but maybe someone has some practical experience with this kind of scenario.

3条回答
迷人小祖宗
2楼-- · 2019-04-22 19:13

You didn't mention what operating system and Postgres versions you are using. However, before considering change of database engine, try to do some logging and benchmarking your current database with typical usage, then optimize "heaviest" questions. And maybe your backend processing load makes DB question time irrelevant? As SQLite is a file-based DBMS, concurrent access from multiple processes will degrade performance when client number grows up (edited after comment)

Following question may be helpful: How Scalable is SQLite?

查看更多
仙女界的扛把子
3楼-- · 2019-04-22 19:14

I would confirm to S.Lott's answer.

I dont know how SQLite performs in comparison to PostgreSQL, since I don't know any newer meassurements, but my own experience with SQLite in a rather similar environment is rather good.

The only thing that might cause troubles in my view is that you have rather many writes. But it all depends on the total number per second I would say.

Also your setting to have one server process is optimal for SQLite in my opinion -- so you circumvent its weakness in multi-tasking.

查看更多
smile是对你的礼貌
4楼-- · 2019-04-22 19:28

I did use SQLite for a major client/server product used with ~10 concurrent users and I deeply regret that decision. In my opinion - PostgreSQL is much more suitable for client/server scenarios than SQLite due to its fine locking granularity.

You simply can't get very far when the entire database is locked whenever someone needs to write something ..

I like SQLite very much (I even wrote a commercial utility for comparing SQLite databases - SQLite Compare but I don't think it fits the bill when you have client/server scenarios.

Even SQLite's author says that it should be used as a replacement for custom file formats and not as a full blown database server. I wish I took his advice more seriously..

查看更多
登录 后发表回答