News for hackers. Stuff that matters.
Re:Don't Bet on Moore Saving Your Ass by abstractbill on Wednesday January 07, 2009 @02:46PM (#423836)
You are working way too hard. Let the OS figure out what needs to be in ram - it does it automatically anyway, and it does a better job that you an since it's caches what actually used, and not what you think should be used.

So why does memcached exist?

Re:Don't Bet on Moore Saving Your Ass by ars on Wednesday January 07, 2009 @03:03PM (#423862)
> So why does memcached exist?

To cache the results of complicated joins (or queries without indexes).

It's pretty much pointless if all you are doing is caching the result of a simple query using an index.

Re:Don't Bet on Moore Saving Your Ass by abstractbill on Wednesday January 07, 2009 @03:54PM (#423941)
It's pretty much pointless if all you are doing is caching the result of a simple query using an index.

Not if your database is under heavy load, and you can easily shift some of that load by putting frequently accessed things in memcached instead.

Re:Don't Bet on Moore Saving Your Ass by ars on Wednesday January 07, 2009 @05:00PM (#424033)
That's if you have two machines. The comparison was vs keeping stuff in a hash table in memory, and I was saying databases are no worse.
Re:Don't Bet on Moore Saving Your Ass by abstractbill on Wednesday January 07, 2009 @07:17PM (#424220)
The comparison was vs keeping stuff in a hash table in memory, and I was saying databases are no worse.

But that's clearly not true. In the most extreme case, that hash table is referenced simply by a variable in your program - it's already in your program's address-space! There's no way a database can come close to that.

Re:Don't Bet on Moore Saving Your Ass by gnaritas on Wednesday January 07, 2009 @07:23PM (#424226)
Not to mention that you can hash arbitrary objects in a hash table with no mapping of any kind.

    hash at: key put: anObject
Databases are vastly more complicated and require me to completely disassembly the object graph anObject may contain into a set of tables and rows to store it, and then reassemble the graph from tables and rows back into their object form when fetching.

The second one commits to using a relational database, one often easily triples the size of the code base. There's nothing simple about that.

Re:Don't Bet on Moore Saving Your Ass by gnaritas on Wednesday January 07, 2009 @06:11PM (#424137)
> To cache the results of complicated joins (or queries without indexes).

Not true at all. The purpose of Memcached is to completely avoid a call to the database because the database, even if it keeps everything in memory can't touch the read speed of a distributed hash table. Memcached allows you to spread the reads across farms of boxes instead of sending them all to what is usually a single database server.

Re:Don't Bet on Moore Saving Your Ass by blasdel on Thursday January 08, 2009 @04:06AM (#424664)
Because the kernel's cache is for things accessed via the VFS layer. It is extremely good at caching file accesses.

The kernel can cache the FS calls that the DB makes, but it can't cache calls to the DB!