go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Two process with Two sqlite db file

Open abeiabei opened this issue 3 years ago • 4 comments

There are two program running in one server , and program A create connection to A.db, program B create connection to B.db.

When I use single Jmeter query A program's api and do some calculate in A.db, it can be 10 qps . (Now program B is idle) And when I use single Jmeter query B program's api and do some calculate in B.db, it can be 10 qps too. (Now program A is idle) But when I use **Two Jmeter ** query both A and B , each process only can be 5 qps.

A and B process use different sqlite DB, I don't why is 5qps per program. Please help me, thanks a lot.

abeiabei avatar Dec 13 '22 08:12 abeiabei

Are you actually using this Go library?

Anyway, from your issue description, it sounds like your computer (between the CPU and the storage device) can only perform 10 qps.

rittneje avatar Dec 13 '22 14:12 rittneje

Are you actually using this Go library?

Anyway, from your issue description, it sounds like your computer (between the CPU and the storage device) can only perform 10 qps.

Thanks for your reply.

I use this library indeed.

The example above is simply to describe my question.

Actually, the phenomenon is : · I use in-memory mode to run database (so there seems no limit about hard disk) · I create an object pool which contains several database-link to different in-memory database. · When someone query API, I will get one database-link(we can consider it as an independent in-memory database), and put some data in , do some calculate, and remove them. · When I use this URI "file::memory:?cache=shared&loc=auto" to create each in-memory database, and use Jmeter to test. QPS is 10 but usage of CPU is only 20%-40%. More odd is when I run two process (offer two different port for qury), QPS is 5 per process and CPU usage is 10%-20% for each process. · When I use "file:mdb_#{serial number}.db?mode=memory&_mutex=0&_loc=auto&_sync=0&_journal=0&_cache_size=8000" to create each in-memory database, and use Jmeter to test.QPS can be 200, and usage of CPU is 600%-700% (multi-core CPU)

So the "file::memory:?cache=shared&loc=auto" situation confuse me. But my problem is dealed by second URI. Thanks for reply again.

abeiabei avatar Dec 13 '22 15:12 abeiabei

Why did you enable shared cache mode for the ":memory:" version? Have you tested using the same URI flags for both?

rittneje avatar Dec 13 '22 17:12 rittneje

Why did you enable shared cache mode for the ":memory:" version? Have you tested using the same URI flags for both?

  1. maybe shared cache mode does not work for ":memory:"
  2. I did not test Second URI for both.I think, in this situation, if I run two process in same server, obviously the limit is CPU usage.

abeiabei avatar Dec 14 '22 03:12 abeiabei