1

Relatively DB newbie here.

So I'm facing a recurring problem that multiple processes attempts Read-Modify-Write operations to the same DB instance, be it MongoDB, Redis, or SQL.

In Redis, one solution is to leverage the atomicity of the Redis Lua scripting to guarantee atomicity, but may result moving a considerable amount of application logic onto Redis. (whether good or bad?)

In SQL, it seems there are atomic stored procedures that achieves similar results, but also risking moving too much application logic into the DB itself (whether good or bad?)

MongoDB doesn't even really have a concept of internal scripting (the javascript solution seems to be deprecated)

Then in the general sense, as implied above, it might be good (?) to keep the application logic outside of the data store to achieve maximum application logic distribution and scalability across multiple nodes of services.

But making application logic distributed across multiple processes (nodes) and have them concurrently access the shared data store warrants the read-modify-write cycle to be guarded from possible race conditions.

So my questions are:

  1. for Redis or SQL, should I abuse the provided atomic scripting support to totally avoid any possible race, but putting more and more application logic into the data store, or
  2. is the read-modify-write model more common for the majority of the DB concurrency access, and if yes, are there some "standard" guidelines about how to synchronize the concurrent read-modify-write from multiple processes?

Thank!

Community
  • 1
  • 1
Dejavu
  • 1,299
  • 14
  • 24

1 Answers1

0

Nosql databases are not ACID compliant. These are distributed nosql databases. Example - mongodb, redis, cassandra etc These nosql databases satisfy either CP or AP sections of CAP theorem. ACID compliant databases like RDBMS satisfy AC section of CAP theorem.

The usecase for nosql databases are either heavy read , heavy write nit both. Its mostly related to performance i.e speed , high availability.

Hope i am clear

Srini Sydney
  • 564
  • 8
  • 17
  • [Is there any NoSQL data store that is ACID compliant?](https://stackoverflow.com/questions/2608103/is-there-any-nosql-data-store-that-is-acid-compliant) says something else. – bluenote10 Feb 28 '20 at 11:52
  • www.marklogic.com claims to be ACID compliant. Their product are quite popular hence their claims most likely be true – Srini Sydney Feb 28 '20 at 22:45