mysql memcached

382 Views Asked by At

I have some queries regarding mysql memcached such as :

1 . What is the main difference between mysql cache and memcached ?mainly I want to ask what caching techniques are adopted in both of these?

2 .What is the benefit of using memcached over mysql cache and What addiional functionality does memcached provide over mysql cache??
3 .Can I use memcached in my existing java application without making any modifications to my existing JDBC code and if not then what necessary modifications do I need to make in my JDBC code.?? please explain with an example that how can i do this .

4. Is it good to use mysql memcached for frequently updating tables?

5 . I want to use memcached in my java application but I am unable to find relevant examples so please provide me some examples showing that how can I use it ??

I have searched for the answers on web but was unable to find the relevant examples. So please provide the answers with a detailed explanation and some examples. Thanks in anticipation.

1

There are 1 best solutions below

0
On
  1. Depending on engine used, MySQL will typically outperform memcached. Reasoning and extended explanation found at the link

  2. Probably none, if anything you can very well end up wasting RAM for no significant benefit. There is no reason why connecting to memcached bears less strain than connecting to MySQL - both should be equally fast/slow, and many languages and frameworks implement connection pooling so that concurrent requests are served over established MySQL connections, therefore the performance loss due to connecting to MySQL is circumvented.

  3. N/A

  4. How would you use memcached for frequently updated tables? The data must be written to the disk, how will memcached help there? MySQL's cache is faster than memcached so I don't see how memcached helps you at all in this scenario.

  5. N/A

I didn't refer to points 3 and 5 because there are googlable examples all over the net.

Long story short, you don't need to use memcached with MySQL if you use MySQL properly (proper dedicated server, with adequate InnoDB / TokuDB configuration, using prepared statements to alleviate SQL lexing on frequent queries).