Is this insane?

Allen Gilliland allen.gilliland at sun.com
Mon Dec 4 07:46:18 UTC 2006



Paul T wrote:
> In reality fetching from, say, mysql (even by primary
> key) is orders of magnitude slower than fetching from
> memcached. Networking part is different, price for
> opening (and keeping) the connection is different e
> t.c. 

I have never run any raw benchmarks between memcached and a db, but I 
would be *very* surprised if the difference between memcached.get(key) 
and "select column from table" was orders of magnitude different.


> 
> For example, memcached makes no calls to filesystem.
> Basically, it is mostly OS that gets in the way.

Why would your db be going to the filesystem?  Sure, for write 
operations it is going to disk, but not for reads, as long as you have 
it configured properly.  A properly tuned db should be able to have all 
the data cached in memory.

-- Allen


> 
> Rgds.Paul.
> 
> PS. BTW, was there any mainstream relational database
> designed to run on a cluster? I doubt.
> 
> --- Allen Gilliland <allen.gilliland at sun.com> wrote:
> 
>>
>> mike wrote:
>>> I'm looking at strategies to cache some data, and
>> I just want to run
>>> this by people to see how they use it or if what
>> I'm thinking is just
>>> insanity.
>>>
>>> Does it sound crazy to have 30-50 gets per page
>> load? I'm thinking of
>>> caching each row in a database basically treating
>> it as an object
>>> based on the primary key. Then fetching the cached
>> information based
>>> on a list of IDs (basically saving a query of
>> SELECT allthedata FROM
>>> allthetables WHERE PK IN(key1,key2,key3))
>> I don't really think that 30-50 gets per page load
>> is a problem, 
>> particularly if they are gets from a cache, but I
>> would be more worried 
>> about the application infrastructure you are talking
>> about in order to 
>> design that solution.
>>
>> Perhaps I don't understand the problem well enough,
>> but I don't see why 
>> you want to replicate your database in your cache. 
>> Your database should 
>> be offering you excellent performance when doing
>> single row lookups by a 
>> primary key, that's what the database is designed
>> for.
>>
>> -- Allen
>>
>>
>>> I mean, not all pages will have this - but pages
>> with lists of data
>>> would; and each item in the list would basically
>> be a row of precached
>>> data in the database; it would have to be
>> sorted/ordered and such
>>> differently, so it wouldn't necessarily make sense
>> to just cache the
>>> entire result set as-is, I'm thinking row-based
>> would be the most
>>> effective way.
>>>
>>> Thoughts?
>>>
>>> Thanks,
>>> mike
> 
> 
> 
>  
> ____________________________________________________________________________________
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail beta.
> http://new.mail.yahoo.com


More information about the memcached mailing list