Question 13
Domain 2: Design Resilient ArchitecturesSebuah aplikasi membutuhkan caching layer dengan kemampuan berikut: **data structures kompleks** (sorted sets, lists, hashes), **pub/sub messaging**, dan **persistence** agar cache tidak kosong saat restart. Antara ElastiCache Redis dan Memcached, mana yang tepat dan kenapa?
Correct answer: C
Explanation
Redis tepat karena mendukung "data structures kompleks" seperti sorted sets, lists, dan hashes, serta "pub/sub messaging". Redis juga menyediakan "persistence" melalui RDB/AOF, sehingga cache tidak kosong saat restart; Memcached hanya cache sederhana tanpa fitur-fitur tersebut.
Why each option is right or wrong
A. Memcached — lebih simpel dan performa lebih tinggi untuk simple key-value
B. Memcached — support multi-threading sehingga lebih efisien untuk high concurrency
C. **Redis** — support complex data structures, pub/sub, persistence (RDB/AOF), scripting dengan Lua, dan bisa digunakan sebagai message broker
Redis is the only fit here because Amazon ElastiCache for Redis supports rich native data types such as lists, hashes, and sorted sets, plus Pub/Sub channels and persistence options. In practice, Redis can be configured with RDB snapshots and/or AOF so data can survive a restart, whereas Memcached is an in-memory key-value cache only and does not provide persistence or messaging features.
D. Keduanya equivalen untuk semua use cases