IT Community - Software Programming, Web Development and Technical Support

memcache commands and behavior

This is a discussion on memcache commands and behavior within the Database Support forums, part of the Web Development category; Hi pals, here i have given few commands about memcache Memcache Memcache is high performance, distributed memory caching system. it ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-26-2007, 12:07 AM
prasath prasath is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: Chennai
Posts: 173
prasath is on a distinguished road
Post memcache commands and behavior

Hi pals,
here i have given few commands about memcache

Memcache

Memcache is high performance, distributed memory caching system. it improves or alleviating database load.

Thanks,
Prasath.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-26-2007, 02:54 AM
prasath prasath is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: Chennai
Posts: 173
prasath is on a distinguished road
Post Re: memcache commands and behavior

Hi techies,

Working principle of memcache

First, you start up the memcached daemon on as many spare machines as you have. The daemon has no configuration file, just a few command line options, only 3 or 4 of which you'll likely use:

# ./memcached -d -m 2048 -l 10.0.0.40 -p 11211

This starts memcached up as a daemon, using 2GB of memory, and listening on IP 10.0.0.40, port 11211. Because a 32-bit process can only address 4GB of virtual memory (usually significantly less, depending on your operating system), if you have a 32-bit server with 4-64GB of memory using PAE you can just run multiple processes on the machine, each using 2 or 3GB of memory

Thanks,
Prasath.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-26-2007, 04:32 AM
prasath prasath is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: Chennai
Posts: 173
prasath is on a distinguished road
Post Re: memcache commands and behavior

Hi,
Another tips

Advantages

Very fast. It uses libevent to scale to any number of open connections (using epoll on Linux, if available at runtime), uses non-blocking network I/O, refcounts internal objects (so objects can be in multiple states to multiple clients), and uses its own slab allocator and hash table so virtual memory never gets externally fragmented and allocations are guaranteed O(1).

Thanks,
Prasath.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-27-2007, 12:05 AM
prasath prasath is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: Chennai
Posts: 173
prasath is on a distinguished road
Post Re: memcache commands and behavior

Hi,
Here another tricks...

Mysql triggers and Memcache

Mysql has certain user defined function that interactive with memcache.here how to automative the cache maintenance by calling these functions from triggers.
This all requires running MySQL 5 with dynamically loaded UDF code -- but of course you don't have to upgrade the whole database farm to MySQL 5, just a single replication slave to run the triggers. On this one slave, create AFTER DELETE and AFTER UPDATE triggers that will delete a record from memcache whenever it gets changed or deleted in the database, like this:

CREATE trigger cache_expire_delete AFTER DELETE on table1 FOR EACH ROW DO memcache_delete("memcache_host:11211",OLD.pk) ;

Here are the details.

First, build Sean Chittenden's libmemcache. (On a GNUish operating system, you need to use BSD make rather than GNU make for this). Then build Jan's UDF (there are notes on doing this in my previous post), and place the udf_memcache.so loadable shared object file into /usr/local/lib/.

Next, log into a dynamically-linked MySQL server (e.g. the mysql-max distribution) as root, and execute Jan's create-function-memcache script. The script contains four CREATE FUNCTION statements, like this:

CREATE FUNCTION memcache_delete RETURNS INTEGER SONAME 'udf_memcache.so';
CREATE FUNCTION memcache_set RETURNS INTEGER SONAME 'udf_memcache.so';


CREATE FUNCTION loads in the shared object file, links the SQL function to the UDF code, and creates a record in the mysql.func system table. If you get error 1126 here, it means that the server could not find the .so file.

Thanks,
Prasath.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-27-2007, 01:04 AM
prasath prasath is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: Chennai
Posts: 173
prasath is on a distinguished road
Post Re: memcache commands and behavior

Hi,
Another tips

Working Flow of Memcache

Steps:
 The application requests keys foo, bar and baz using the client library, which calculates key hash values, determining which Memcached server should receive requests.
 The Memcached client sends parallel requests to all relevant Memcached servers.
 The Memcached servers send responses to the client library.
 The Memcached client library aggregates responses for the application.

Refer the below link u can understand the above steps....
http://www.linuxjournal.com/articles...451/7451f1.png

Thanks,
Prasath.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete memcache? Kamalakannan PHP Programming 11 10-26-2007 12:30 AM
Phpaccelerator & Memcache sivaramakrishnan PHP Programming 0 08-31-2007 08:59 AM
Which technique we use to achieve polymorphic behavior of an object? anbuchezhians VB.NET Programming 1 08-01-2007 11:51 PM
Can anybody tell me Browser Differences in window.opener Behavior kingmaker HTML, CSS and Javascript Coding Techniques 2 07-24-2007 12:52 AM
memcache in PHP DuraiBabu PHP Programming 6 07-18-2007 01:43 AM


All times are GMT -7. The time now is 08:57 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0