473,327 Members | 1,930 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

unclear on memcached ?


I understand that memcached can store objects on different servers
using hashing, and I've seen typical things such as storing query
results.

Say at line 100 in module 'A', I want to render some content so I
check the memcache. If previously I had rendered this from this same
line of code and it's in the cache, then I use that. However, what if
module B changed one of the records on the database and that was in
the cache ? It must be up to me to have a scheme worked out that I
will delete the object from the cache that is referenced from module A
because I changed the database.

Mar 16 '07 #1
3 1428
surfivor wrote:
>
I understand that memcached can store objects on different servers
using hashing, and I've seen typical things such as storing query
results.

Say at line 100 in module 'A', I want to render some content so I
check the memcache. If previously I had rendered this from this same
line of code and it's in the cache, then I use that. However, what if
module B changed one of the records on the database and that was in
the cache ? It must be up to me to have a scheme worked out that I
will delete the object from the cache that is referenced from module A
because I changed the database.
Hi,

Sorry if I sound stupid because I never worked with memcache, BUT isn't this
excactly the kind of thing where you need a database?
A database will handle your concurrency, possible changed tuples, etc just
fine.

You can even store the results of a query in the database if you want, and
just update that when needed (= when the underlying data changes).

Regards,
Erwin Moller
Mar 16 '07 #2
Erwin Moller wrote:
You can even store the results of a query in the database if you want, and
just update that when needed (= when the underlying data changes).
Yes, but memcache is a lot faster than any SQL engine. The only thing
that could match the speed would be a memory storage engine as
implemented in MySQL - for simple pkey indexing I think it still
couldn't match memcache.

So RDBS gives you much more flexibility and scalability but at the cost
of complexity you might not need.

However in this case I would go for MySQL + memory storage engine.

--
Cz.
Mar 16 '07 #3
On Mar 16, 5:21 am, Czapi <c...@ask.mewrote:
Erwin Moller wrote:
You can even store the results of a query in the database if you want, and
just update that when needed (= when the underlying data changes).

Yes, but memcache is a lot faster than any SQL engine. The only thing
that could match the speed would be a memory storage engine as
implemented in MySQL - for simple pkey indexing I think it still
couldn't match memcache.

So RDBS gives you much more flexibility and scalability but at the cost
of complexity you might not need.

However in this case I would go for MySQL + memory storage engine.

--
Cz.

Thanks, but I asked the question as a hypothetical to try to
understand how memcached works. At this point, I am not sure all the
possible scenarios we may use it in, but I have seen many examples on
the web where it caches SQL query results.
It's my impression that the examples of memcached where the cache is
set to expire in 10 seconds will work if there is an update somewhere
else, say that part of what you are saving is data and the data is
upated someplace else where a new record is added to the database. A
page that is rendered within the 10 seconds may not show the new data,
but it's ok because after 11 seconds, any rendering will reflect the
new data. However, It occured to me that if a record was deleted and
then a page was rendered 5 seconds later that showed the old record.
If it was say on a blog and someone tried to update a comment based on
the old record, there will be a problem because now it is gone. This
seems to imply in some cases you can let the old pages expire, in
others you may have to expire them yourself which is more complex.
Ideally you might like to find as many cases that favor the other
approach.

Memcached seems like the best general solution to caching that I have
come across in that it is very low level. In some cases it may be
overkill and be slightly slower for moderate caching than other
approaches, but it is probably more extendable to the case where you
experience a moderate amount of traffic initially which then grows
into greatly increased traffic. You may have to monitor traffic
patterns and make changes, but your general caching archetecture may
not change. Some other caching schemes seem high level, but if there
is a bug or you create a problem by customizing the open source code
of some product or using various plugins with Wordpress, you could
break some of the other caching schemes such as the caching plugin
that wordpress has.


Mar 16 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Little Twin Star | last post by:
Hello all A questions from 10,000ft: I'm looking to use memcached as a Cache::Cache. Looks like I'll need to wrap Cache::Memcached to conform to the Cache::Cache interface...? Has this been...
1
by: Gilles Ganault | last post by:
Hello I'd like to play with MemcacheD and see how it improves read access to data, but I'm a bit lost at how to get from a working Apache2 + PHP5 + MySQL5 server on FreeBSD 6.3. I've never...
3
by: bigqiang | last post by:
Memcached is a high-performance, distributed memory object caching system. its website is http://www.danga.com/memcached/ . How to use Memcached in Classic Asp? Help thanks .
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.