Memcachedbecomesmoreandmorepopulw.wadays. Itiswidelyusedbymanyheavyloadedsites. Whydoesitsucceed? Well, ofcoursethefirstandthemostimportantreasonisthatitmeetstheneedforspeedoftheweb2.0sites, bycachi
Memcached becomes more and more popular nowadays. It is widely used by using heavy loaded sites. Why does it succeed? Well, of course the first and the most important reason is that it meets the need for speed of the web 2.0 sites, by cachi
Memcached becomes more and more popular nowadays. It is widely used by using heavy loaded sites. Why does it succeed?
Well, of course the first and the most important reason is that it meets the need for speed of the web 2.0 sites, by caching data and objects in memory. however, from the point of view of a server developer, what I want to emphasize is that it is the simplicity of memcached's protocol design makes it more successful. take a look at memcached's protocol:
Storage: ("set", "add", "replace", "append", "prepend", "cas ")
[Noreply] rn
Cas [Noreply] rn
Reply: ("ERRORrn", "CLIENT_ERROR Rn "," SERVER_ERROR Rn ",
"STOREDrn", "NOT_FOUNDrn", "EXISTSrn", "NOT_FOUNDrn ")
Retrieval: ("get", "gets ")
Get Rn
Gets Rn
Reply: ("ENDrn ",
"VALUE [ ] Rn Rn ")
Deletion:
Delete [ ] [Noreply] rn
Reply: ("DELETEDrn", "NOT_FOUNDrn ")
Increment/decrement: ("incr", "decr ")
Incr [Noreply] rn
Decr [Noreply] rn
Reply: ("NOT_FOUNDrn ",
" Rn ")
Statistics: ("stat ")
Statsrn
Stats rn
Reply: ("STAT Rn ",
"STAT items: : Rn"
"ENDrn ")
Other:
Flush_all
Reply: ("OKrn ")
Versionrn
Reply: ("VERSION Rn ")
Verbosity
Reply: ("OKrn ")
Quit
With the textual protocol as shown above, memcache can be easily supported and implemented in various programming ages. no wonder dozens of different memcache clients appear. and then it consequently boosts memcached's use. simple thing usually will withstand the test of time. the old simple textual protocols, e.g ., HTTP, FTP, SMTP and POP3 are still in use on the modern Internet. not only because textual protocols can be easily parsed and extended, but also they are convenient for human being to read and debug. this is where the UNIX philosophy shines.
In conclusion, always prefer textual protocol when designing your own application. It wocould turn out to be really a wise demo.
Original article address: Learn from Memcached's Success. Thank you for sharing it with me.