Memcached Interview Questions and Answers
Intermediate / 1 to 5 years experienced level questions & answers
Ques 1. Explain how Memcached works.
Memcached stores key-value pairs in memory to reduce the need for repeated database queries. It uses a simple and efficient hashing algorithm for distributed caching across multiple servers.
Ques 2. How does Memcached handle data expiration?
Memcached uses a time-based expiration mechanism. Each key-value pair has a specified expiration time, and once the time is reached, the data is automatically evicted from the cache.
Ques 3. Explain the concept of Memcached slab allocation.
Memcached uses slab allocation to efficiently manage memory. It categorizes memory into slabs based on size, and each slab contains items of a specific size range.
Ques 4. Explain Memcached CAS (Check and Set) operation.
CAS is a mechanism in Memcached that allows for atomic updates. It checks if the value has been modified since it was retrieved, and updates it only if no changes occurred in the meantime.
Ques 5. Explain Memcached slabs and classes.
Memcached slabs represent chunks of memory allocated for items, and classes are sets of slabs with similar-sized items. Slabs are organized into classes to efficiently manage memory usage.
Ques 6. What is Memcached replication?
Memcached replication involves creating copies of data on multiple Memcached servers. It provides redundancy and high availability in case a server goes down.
Ques 7. Explain Memcached memory optimization techniques.
Memory optimization in Memcached can be achieved through techniques like slab reassignment, adjusting item size, and optimizing key storage.
Ques 8. What is the Memcached LRU algorithm?
LRU (Least Recently Used) is a caching eviction algorithm used by Memcached to remove the least recently accessed items from the cache when it reaches its memory limit.
Ques 9. How can you monitor Memcached performance?
Memcached performance can be monitored using tools like memcached-tool, telnet, or specialized monitoring software. Key metrics include hit rate, miss rate, and memory usage.
Ques 10. Explain Memcached connection pooling.
Memcached connection pooling involves reusing existing connections instead of creating new ones for each request. This helps reduce overhead and improve performance.
Ques 11. Explain Memcached UDP support.
Memcached supports UDP (User Datagram Protocol) for fast and lightweight data transfer. It is often used for non-critical operations like cache updates.
Ques 12. What is Memcached key hashing?
Memcached uses a consistent hashing algorithm to determine the server responsible for a particular key. This ensures even distribution of keys across multiple servers.
Ques 13. Explain Memcached slab growth factor.
The slab growth factor in Memcached determines how much the memory allocation size should grow when the existing slabs are full. It helps in efficient memory management.
Most helpful rated by users: