Is Memcached a Good or Bad Sign for MySQL?
gigaom.com
gigaom.com
If you just use Memcache to cache the same results you get out of a DB, of course you might as well just throw that RAM at the DB. With any sane DBMS this will result in the same performance improvement.
The problem with that is that it limits you to the amount of RAM you can throw into the DB. The biggest Memcache clusters reach well into the multi-terabyte range.
Secondly, you can use Memcache to store constructed objects which could take many DB calls (or CPU time) to generate. Now you're getting one Memcache hit instead of several DB hits, which is a distinct bonus.
Since it's shared-nothing, Memcache also gives you the ability to massively parallelize queries to many cache servers at once, and get a much quicker overall response than just hammering one DB into the ground.
If my understanding of memcache is correct, throwing more ram at the db won't provide the same performance improvements that memcache will provide.
Linux and other operating systems tend to use any free memory for disk cache which will end up caching the whole database if needed.
Innodb has a key cache.
Memcached probably helpful on the database server but it's really designed to be ran somewhere else so that database server has as much memory as possible of it's own.
That is obviously false.
A memcache hit is much cheaper than a DBMS query, even if the DBMS query is accessing data that resides in the DB's buffer cache. If the DB query we're comparing against memcache is a trivial one (a single b-tree lookup), a memcache lookup is still faster; if the DB query is at all non-trivial, the memcache performance advantage is larger.
(of course more complex queries will be slower, but I covered that in my second point)
Regarding your 2nd point, latency != 1/throughput when you have parallel queries.
My personal projects use memcached recently, but not for anything interesting. At the day job, we have a particular case where we render a per-user sidebar. The data for the sidebar is volatile, but unpredictably volatile -- i.e. it should be unchanging for the length of a user session except when it isn't, but when it isn't the user requires us to know Right The Heck Now (TM). That data is actually stored on another system, and accessing it requires hitting a web service on the other system. Accessing the web service is, obviously, an overhead, and the service it calls is very heavy. Obviously, big win for us if we can avoid hitting that service on every request for a webpage with a sidebar.
Enter memcached. It is a fairly simple way to keep the sidebars for 3+ app servers synced with each other, and the other system can force-expire the cache if it wants to. This isn't a knock against the database running on the other system -- it doesn't and shouldn't care about what format we use their data in, just that they're keeping the contract about providing it when we ask and pinging us when it needs expiry.
The combination of MySQL + Memcached is a great solution to for many small companies to scale.
MySQL is not representative of all relational databases.