CSCI 470
Web Science
Spring 2013

Montana Tech
Computer Science & Software Engineering



Assignment #8 - Memcached lab
Due: 10PM, Thurs 3/28.
This is a lab assignment you will be installing some software (MySQL and memcached) on the lab machines. You will be doing some performance analysis using code that has been provide. To earn your 15 points for the lab, send me your table of results by the above due date.


Overview. Your manager loves your single-player Dungeon game so much, he wants you to make it into a multi-player online game. Since it is a game, your manager is not really worried about high availability but it should be horizontally scalable. Your manager has heard this memcached thingy has helped major web sites like YouTube, Flicr, and Craigslist scale. So you should base your state management system around using memcached.

Memcached. Memcached is a high-performance, distributed, memory caching system. Clients can contact the memcached daemon via TCP/UDP. It is a key/value store based on hashing. It doesn't do anything very sophisticated compared to a SQL database. Multiple instance of memcached can be running on the same server or on multiple servers. A particular key/value pair is stored in a single location in the pool of memcache daemons. Clients determine the server location based on a hashing the key and contacting the appropriate daemon. Each daemon then finds the value by hashing the key as well.

Part 1: Installing memcached and MySQL. We can install the memcached server using Ubuntu's package management system. You also need to install the PHP module so your web pages can get and set things in memcached. You may also need to install MySQL if it is not already installed. Part 2: Benchmarking state management alternatives. Being a good engineer, you decide to empirically test various state management options rather than just taking your manager's opinion on faith. You will use ab to test incrementing 1000 unique keys using Apache file-based session state, MySQL, and memcached. The file counter.zip has the PHP source code for the three benchmark pages. Examine the code in counter_memcached.php to see how to use the memcached API. You can find more details about the available memcached PHP function here. You should probably have a look at the description for (at least) the get, set and check-and-set (CAS) methods.
Submission. Send me your table of results by the deadline.

Page last updated: May 15, 2013