MongoDB vs. Apache Cassandra - Who Wins? | Systems Design Interview 0 to 1 with Ex-Google SWE
Vložit
- čas přidán 26. 07. 2024
- Cassandra is probably the closest thing I have to a girlfriend at this point (well maybe the second closest)
- Věda a technologie
Can you please explain at 3:06, how are Gossip protocol and Consistent Hashing connected? I understand that in gossip protocol basically we designate the start note and we propagate state updates to the rest of the nodes, but how does consistent hashing come into play?
We thank you for having no life and making these videos 🙂. Loved this one too.
Cassandra's data integrity can be made better by configuring quorums.
However, due to hinted handoff-> it still cannot provide any transactional/strong consistency guarantees
True, thanks!
@7:36 you mentioned btree databases write it to disk first. However with WAL in combination of btress, do DBs still writes go to disk ? I was under impression that with WAL they first write to WAL and then asynchronously they flush from memory to btress on disk. Please correct me if i am wrong.
I imagine this one is implementation specific but I do think that some B-tree pages get cached in memory so in this case it's certainly possible!
@2:20 Your information is wrong there. I think you wanted to say that there are Partition keys (at least one) and Cluster keys (0 or more). Together they form the Primary key. Please review the video as it is misinforming thousands of people.
Oops, typo on my part. If this were a bigger deal I'd revise the video, but I don't think anyone is losing their job due to using the wrong terminology on cassandra key names.
Hey Jordan, let's say we have 5 partitions of Cassandra each storing some data. Is there a way to find out the oldest entry from those partitions , considering there are multiple keys for partition(like senderid, receiver I'd)
Unless you want to use something like a version vector, your easiest bet is probably just a timestamp lol
Is there any downside of MongoDB's ACID guarantees on de-normalized data, i.e. are writes slower than MySQL? It seems almost too good to be true, esp. say if a write has many duplicated locations it needs to transactionally update
Also I knowCassandra's commonly used for chat applications as you mentioned, but I'm having trouble understanding why it's strictly preferential to say a document store. Say you had cluster key = chatID, sortKey = timeStamp, and one more column chatMessage = message contents. Yes the chatMessages have good locality, but many of COS other benefits (encoding compression, dictionary compression) aren't really relevant on content as variable as chat messages
I think you just have a pretty large degree of writes with chat messages due to all of the fan-out, so LSM trees and leaderless replication may be preferred.
Can't see off the top of my head how mongo writes compare to SQL ones, but I don't think the metrics that you'd find would account for data being especially denormalized - that would just mean you have to do *more* writes
Nice video.
I have a question. I read somewhere that "While transactions in MongoDB can span multiple documents within a shard, they cannot span multiple shards within a sharded cluster.". This limits us in comparing this to traditional SQL isn't it ?
Interesting - if that's the case then I'd agree, I suppose you could always build two phase commit on top of it yourself though
Cassandra only used for chat application? or is there any other benefits? Because if read throughput is poor, then historical chat data retrieval would take a hit on overall latency isn't it ?
Read throughput is still good if you only read from one partition and take advantage of the sort key
If Mongodb is providing facilities as MySQL, then why everyone is not using it?
Because everyone is used to the relational data model and there's not really any reason to switch.
Unrelated to the video, but I'm surprised that you're still able to consistently make content for youtube. Figured you would actually have no life with the new job.
Ah I basically do lol, to be honest if I was lifting less I'd have a decent amount of free time
Amazing summary.
1. Can you do a similar video on dynamo db and compare it to Cassandra or other No sql db .
Separately what’s the notepad software you are using .
Microsoft one note - to be honest DynamoDB is closed source so I don't know the exact design lol
Web scale
Cluster key and sort key are the same thing. You meant to say partition key and clustering key.
Derp, nice catch