2

On the slide you can see very rough architecture of booking system. It's very concurrent environment, where many users at once may try to book the same hotel/room.

At bottom we have NoSQL database, for quick response/request there is distributed cache and application which requests data.

The idea of this slide is that when you use NoSQL + Distributed Cache you'll get sync problems, means data consistency problems. You need to sync distributed cache with NoSQL db.

Question: What the solutions/techniques already exists for such case besides IMDG? That could be both frameworks or/and best practices. Is there any specific distributed caches that solves this problem?

Question2[updated]: What are the reasons we do write to the NoSQL db instead of cache? Are that transactions, node fail possibility or anything else?

P.S. That's not my slide, and author claimed that is a great use case for IMDG.

enter image description here

Community
  • 1
  • 1
VB_
  • 45,112
  • 42
  • 145
  • 293

1 Answers1

2

Do you really need the distributed cache? NoSQL solutions are by nature very performant, approaching the performance of stand-alone caches (like memcached).

I can get ~10ms access times out of Cassandra, which is not much slower than most caches.

I'll bet that by the time you put in cache validation overhead, and network overhead of missed cache hits, you are going to be better off going straight to your database.

You can still use caches for things that are less transient, like room types, prices, etc.

Rob Conklin
  • 8,806
  • 1
  • 19
  • 23
  • thanks for reply! May you explain pls your last statement? Why do I should use caches for rooms, prices etc but not for hotels? Also can you please try to answer the second question (I just added it) – VB_ Feb 20 '15 at 16:52
  • I'm saying the stuff that is changing super fast (like room availability) probably shouldn't be cached. I'd keep room definitions separate from room availability. So probably store a doc for each room, and separate docs for each day, with a list of available rooms in it (the availability doc). The room-doc would be cacheable, as the stats of the room, photos, etc, won't change. The availability doc you would want to retrieve for each query. – Rob Conklin Feb 20 '15 at 17:51
  • Caches are caches, not data-stores. A cache does not have a requirement for things like persistent durability (surviving a crash, etc). It doesn't even require temporal durability. They generally are a fixed size, and can't store more than that size. Now, you can (and many people do) use data-stores as caches, but caching is a description of an operation, not a technology. But generally, cache tech does not implement durable or consistent reads/writes. They sacrifice this for speed, which is their purpose. – Rob Conklin Feb 20 '15 at 17:54