Memcached Interview QuestionsA list of top frequently asked Memcached interview questions and answers are given below. 1) What is Memcached?Memcached is a general-purpose free and open source, high performance, distributed memory object caching system. It is used to speed up database-driven websites by caching data and objects in RAM. In simple words, you can say that Memcached is a component which stores data temporally for 1hour/ 6 hour/ 12 hours/ 1 day, etc. and you can integrate this component with your applications to increase their performance. 2) In which language Memcached is written and who is the author?Memcached is written in "C language". It was developed by Brad Fitzpatrick in 2003. Initially, it is developed for LiveJournal, but now it is used by Wikipedia, Twitter, Facebook, Flickr, Netlog, YouTube, etc. 3) How Memcached works?See the following steps to understand how Memcached works:
4) When was the first version of Memcached launched?The first version of Memcached was launched on May 22, 2003. 5) What is the usage of Memcached? In which types of websites, it is generally used?Memcached is used to increase the speed of dynamic database driven websites. It caches data and objects in RAM to reduce the execution time. It is generally used:
6) What is the best usage of Memcached?Best usage of Memcached:
7) What are the drawbacks/ limitations of Memcached?A list of the limitations or drawbacks of Memcached:
8) In which conditions cache cannot retain the stored information?The cache cannot retain the stored information in following conditions:
9) What is the difference between Memcache and Memcached?Difference between Memcache and Memcached: Table:
10) Can we share a single instance of Memcache between multiple projects?Yes, we can share a single instance of Memcache between multiple projects because being a memory storage space, Memcache can be run on one or more servers. In Memcache, you can also configure your client to speak to a particular set of instances. We can also run two different Memcache processes on the same host being completely independent and without any interference. If you partition your data, it is important to know from which instance to get the data from or to put into. 11) Explain the differences between SAP HANA and Memcached?SAP HANA is an in-memory RDBMS and mostly used for accelerating SAP applications while Memcached is a key/value caching system and used for accessing both RDBMS and NoSQL databases. 12) How to connect Memcached server with telnet command?By using telnet hostname portNumber command, you can connect Memcached server with telnet command. SyntaxExampleThe given example shows that how to connect to a Memcached server and execute a simple set and get command. Let's assume that the server of Memcached is running on host 127.0.0.1 and port 11211. 13) How to get the value of key?By using the get command, you can get the value of the key. SyntaxExampleIn the given example, we use javatpoint as the key and store Memcached in it with an expiration time of 900 seconds. 14) How to set the value of key?By using set command, you can set the value of the key. SyntaxExampleIn the given example, we use javatpoint as the key and set value Memcached in it with an expiration time of 900 seconds. 15) How to add value in the key?By using add command, you can add value in the key. SyntaxExampleIn the given example, we use "key" as the key and add the value Memcached in it with 900 seconds expiration time. 16) How to replace the value of the key?By using replace command, you can replace the value of the key. SyntaxExampleIn the given example, we use "key" as the key and add the value Memcached in it with 900 seconds expiration time. After this, the same key is replaced with the "redis". 17) How to append the value of the key?By using append command, you can append the value of the key. SyntaxExampleIn the given example, we are trying to add some data in a key that does not exist. Hence, NOT_STORED is returned by Memcached. After this, we set one key and append data into it. 18) How to prepend value of key?By using prepend command, you can prepend value of the key. SyntaxExampleIn the given example, we are trying to add some data in a key that does not exist. Hence, NOT_STORED is returned by Memcached. After this, we set one key and prepend data into it. 19) How to delete the key?By using delete command, you can delete the key. SyntaxExampleIn the given example, we use javatpoint as a key and add the value Memcached in it with 900 seconds expiration time. After this, it deletes the stored key. 20) How to show the stats?By using stats command, you can show the stats. SyntaxExample21) How to get the versions?By using Version command, you can get the versions. 22) How to close the connection?By using the Quit command, you can close the connection. 23) How would you update Memcached when data changes?There are two methods to update Memchached when data changes:
24) What is Dogpile effect? How can you prevent this effect?If the cache expires, and websites are hit by multiple requests made by the client at the same time, this effect is known as Dogpile effect. This effect can be prevented by using a semaphore lock. In this system when value expires, the first process acquires the lock and starts generating new value. 25) What happens to the data stored in Memcached when server accidentally gets shut down?In Memcached, data is not permanently stored. It is not a durable data so, if the server is shut down or restarted, all the data stored in Memcached will be deleted. 26) If you have multiple Memcache servers and one of the Memcache servers fails which has your data, will it ever try to get key data from that one failed server?The data in the failed server won't get removed, but there is a provision for auto-failure, which can be configured for multiple nodes. Fail-over can be triggered during any socket or Memcached server level errors and not during normal client errors like adding an existing key, etc. 27) How can you minimize the Memcached server outages?Following are the methods to minimize the Memcached server outage:
|