Question

Our project utilizes a static database (no writes). With many users we don't actually have a problem per se reading it. If a database "locks" per read request by any user, then would it not be more efficient (though perhaps unnoticeable) to have multiple databases that each user connects to individually?

We are database noobs. Apologies in advance if this is in the wrong place. We are planning on using BoltDB or LMDB for our project, but personally I was intrigued by this idea.

Was it helpful?

Solution

Unless your database is measured in Terabytes and your concurrent user count is astronomical, don't bother.

Modern databases are very fast, especially for reading.

You should wait until you actually have the problem then measure to confirm you have the problem before you try to fix anything.

If you run multiple read-only databases in parallel, you now have the maintenance problem of ensuring they are in fact identical. Debugging the situation when they're not can be painful.

OTHER TIPS

You should read your chosen database's documentation more carefully. In LMDB, readers are entirely lockless and wait-free, so your entire "if a database locks" premise is invalid.

From the database side no locks are held for SELECT statements.

Proposing to have multiple static databases is like proposing to use files like (spreadsheets or plain text) to have the data available to each user.

The whole concept of the database is to have a centralized repository for all users to "share" the same data-base.

If you database is huge and you will have an enormous amount of concurrent users you may have to think about clustering. But in your case, I think that's not an option.

If you read a little about LMDB and BoltDB, you'll see that they behave like mainframes, and the point there is to have a single repository, even more, a single file to hold all of your data.

When thinking about databases, think about centralizing the data and distributing the workload.

Hope this helps you clear out some clouds.

Licensed under: CC-BY-SA with attribution
scroll top