The session has been recorded. The webex file and the webinar are available here.
Here is the Q&A session, with more detailed answers.
Q from Tomasz: You said memcached is integrated with, among others, MySQL. Did you mean integration by e.g. php or direct, automatic integration?
A: Memcached API are available for many enviroments, such as Php, Perl, C/C++, Rails etc. With MySQL, you can use UDF functions or a storage engine. Both are community projects.
Q from Juan: memcached: Facts data size up to 1MB? What size, i dont understand!
A: It's the size of an item associated to a key. When you store an element (item) into memcached, the size of the key is max 250 bytes and the item is max 1MByte.
Q from Frederik: Do memcached save data in RAM or disk?
A: It is RAM based, there is no durability
Q from Niko: Are all these [client] libraries available for Windows as well ?
A: Some of those libraries have been ported to Windows
Q from Robin: Is it possible to define multiple memcached nodes? If so, what is the hashing strategy?
A: Yes, it is. Memcached is distributed by design. The distribution is based on the hash key, depending on the number of servers in the cluster. So, for example, in a cluster with two servers, the item with key 1 will go to server A, key 2 will go to server B, key 3 to server A, key 4 to server B and so forth.
Q from Aron: If i have set data into memcache from db, but after a while the db table changes. How do i trigger to update the memcache? MySQL cache deletes data from cache when a table has changed, how does memcache handle this?
A: There are various mechanisms. First of all, memcached is a generic caching mechanism, therefore you can use it to cache data from the DB, but also HTML pages, images, documents etc. There are various mechanisms to trigger an update. One is to apply a trigger to the table in the database and invalidate/update the cache at any change. Other options may be application specific.
Q from Ran: What are the advantages of using memcached via MySQL, as opposed to directly using the memcached API? Can you expand on using triggers to automatically put/get data from cache?
A: Yes, see my previous answer. In general, if your are going to store DB data, it's a good idea to set this kind of trigger.
Q from Jeroen: How can you store the same item on multiple servers?
A: You simply apply two hash keys that will go to different servers. The typical approach is a key on one server and its next value on another server. Be careful to not use the next value key for another item.
Q from Giulio: Can I setup mysql slave to replicate memcached data?
A: This is a very good approach. If you are not specifically worried by the real time update of the cache, you can create triggers on the slave server (and perhaps you can use a BLACKHOLE storage engine to save storage. In this way, the master will not be affected by any delay caused by the triggers.
Q from Matt: Can memcached be installed as a Debian Package without any configuration needed? i.e. "apt-get install memcached"
A: As far as I know, only the client library can be installed as a Debian package.
Q from Ariel: What about network latency if I have so many Memcached servers?
A: The protocol used to interact with memcached is very lightweight. Naturally, the more you use memcached, the more traffic you will generate. So far, none of the very large installations using memcached have had latency problems.
Q from Eyal: How do you define the structure of the items you store?
A: Simply you don't. Memcached will store a string of bytes and it's up to the application to interpret the content of memcached.
Q from Gregorio: Do Facebook or any of them use any kind of integration between Mysql + Memcached?
A: I am not sure about Facebook, but many web sites do. Fotolog, for example, stores DB data using UDF.
Q from Ariel: Is memcached good for queries that take less 1s to respond?
A: the longer the query takes to respond, the more effective is memcached compared to the execution of the query. If you run several queries that take one second or more, maybe it's a good idea to use memcached.
Q from Marc: How do you handle the slab sizes if they are growing too much and using full size of memory? Also when items expire the slab size stays the same. that's a common problem in memecached.
A: Indeed, this is a know problem. Some optimisation in the use of the storage (memory) has been sacrificed in order to keep the algorithm for storage and eviction pretty simple.
Q from Yariv: a question about memcached distribution, how does it work, i understood that you implement distribution in the code using module (%) maybe i'm wrong, but how does it work when nodes are added or removed from the 'memcached ' cluster?
A: If you add or remove nodes, you end up invalidating the whole cache. Bear in mind that we are talking about a caching mechanism, very fast and simple, therefore with basic capabilities in terms of administration.
Q from Varaprasad: Can I use memcached with MS SQL Server?
A: You can, sure, although I am not aware of any connector or function to integrate MS SQL Server to memcached.
Q from Oren: Isn't the cache purpose to offload complexity from the db? Why then to use the mysql memcached functions, and not do it through the application, bypassing the db?
A: It's not just complexity, it's mainly workload. If you handle a query through memcached instead of engaging the storage engine and the consequent I/O, you still have an advantage. I agree with that if you avoid to involve the DB server completely, it's even better.
Q from Varaprasad: Is memcached opensource?
A: Yes, but as you just see on the slide we will support it under the MySQL Enterprise Gold and Platinum subscription.
Q from Pedro: in the MySQL Cluster is there a limit on the database size?
A: With Version 5.0 we are limited to the available RAM of the available data nodes. With 5.1, you can extend the use of the data on disk.
Q from Paolo: Seems like Memcached can be redundant and HA with little effort, is it right?
A: Yes, sort of. You need to implement the redundancy yourself and in any case it's not so simple to guarantee that you will have consistent data on all the servers.
Q from Jan: All memcached nodes can have a different amount of memory reserved for memcached, am I right? Any best practices?
A: That is correct. The servers with more memory will have less chance to evict old data. Recommendation is to use the same amount of memory for memcached server of the same type, i.e. when the server are used to store the same type of data.
Q from Andrew: Is memcached supported as a storage engine or as a standard memcached instance?
A: It is supported as a standard memcached instance. The storage engine is still at an early stage.
Q from Matz: Consistency? How does the cache know when the data has been updated?
A: It doesn't. The DB through a trigger or the application will inform memcached that the cache must be updated.
Q from Ariel: Is there some library for use Memcached in HA Cluster?
A: Not directly, as far as I know.
Q from Juan: How can I backup memcached?
A: There isn't a simple way to do that and usually it's no a good idea. Memcached is designed to provide high performance and you do not want to slow down the server for a backup. Even more important, cache is temporary data by definition, data that you may or may not find in the cache, so there is no point to backup a cache.
Q from Julian: How does memcached scale beyond a single server? The slide said the size was unlimited..
A: You simply need to define a set of servers to use at a client level and the API will distribute the data on these servers.
Q from John: Does memcached work with DRBD?
A: No, they are different technologies. DRBD replicates file system data, while memcached use RAM to store data.
Q from João: Is memcached available in the free mysql version?
A: memcached is available here: http://www.danga.com/memcached . You can use it with our Community Edition, but of course we do not support it with that edition.
Q from Robin: Are there any reports available yet on the performance gains of using memcached from within mysqld?
A: Not directly from MySQL, but there are many tests published on the Web.
Q from Agoston: Can you give an example on how to append timestamp to a memcached key to achieve automatic invalidation?
A: The automatic invalidation is handled only with the LRU algorithm, however you can handle invalidation programmatically. For example, you can defined a version id to append to your key (Something like "mykey-0001", "mykey-0002" and so on). Another option is to prepend a timestamp to the item; you will retrieve the item but you will not use it if the timestamp is outdated.
Q from David: How frequent the data get updated in memcache once DB record has changed? Is it configurable?
A: The update must be explicit, the client or the server through the UDF should update memcached.
Q from Niranjan: Is there some inherent pooling in memcache if I decide to distribute my cache across different machines ? Or will I have to route requests manually ?
A: The requests are directed to the right server using the key, you do not need to route it manually.
Q from Tristan: At what amount of traffic do you think memcache starts being a good option?
A: It really depends on the requirements than on the traffic. Some applications need real time or near real time performance, some others may accept longer response time. This requirements, combined with the concurrent users, should give you an idea whether it makes sense or not to use memcached.
Labels: memcached, MySQL, MySQL Enterprise
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment