I am in the process of implementing a small web application using memcached for
ID: 650536 • Letter: I
Question
I am in the process of implementing a small web application using memcached for caching objects and sql server for database persistence.
In all the projects I have done before I have done inserts/updates in the web thread itself. In this project I want to implement asynchronous inserts and updates. I will use memcached http://en.wikipedia.org/wiki/Memcached to capture changes and an external service (windows service) to persist the changes in db.
I understand premature performance tuning is evil but this is just a test project to learn memcached.
Has anybody done this before. What are the disadvantages of using this ?
Explanation / Answer
This approach greatly changes the ACID guarantees of your application. If your memcached server goes down, you lose all changes since your last database synch with no way of recovering them. Out of the box, memcached will throw out old values when it runs out of RAM. If your app is write-heavy, this could mean losing data between synchronization.
You can improve the chances of data making it into the database by adding redundancy to your memcached layer, but it still doesn't create a solution with the same guarantees as a relational database. This isn't always a disadvantage. Some NoSQL approaches are consciously trading ACID guarantees for performance and scalability. There's even some math behind it in Brewer's CAP Theorem.
Regardless, most non-ACID NoSQL solutions guarantee eventual consistency. That's something your current approach doesn't provide and most users won't live without. If you lose my order, enlightening blog post, or witty comment, I'll likely find a different software provider.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.