AgileApps Support Wiki Pre Release

Configuring memcached

From AgileApps Support Wiki

The MEMory CACHE Daemon is a high-performance, distributed-object caching system that minimizes user response time by caching application data and other elements required by programs running on the application server.

The platform uses memcached to store meta information which so that they can be obtained from the cache without accessing the database e.g. Object and field definitions, layout definitions, data policies etc. (Transactional customer data is not stored in memcached--that data is cached by the database.)

Data is stored in memcached using a lazy read mechanism. When some meta information is required, the platform checks to see if it is available in memcache. If it is available, the data is retrieved. If it is not available, a database read is performed, which in turn populates the entry in memcached. When the meta information changes due configuration changes by the user, the corresponding entry is flushed from memcached.

Warn.png

Important: The configuration for every instance must have the same memcached settings--otherwise, the caches won't be synchronized. Changing the memcached configuration therefore requires a restart of all Application Servers.

Managing memcached Servers
To install memcached
See http://memcached.org/ for installation instructions.
To start memcached
  • Execute the memcached script located in the /bin directory:
./memcached -d start -p 11211 -u root -m 25
where:
  • -p is the port number (11211)
  • -u is the user (root)
  • -m is the amount of memory in MB (25)
(Change the parameters to the values used for your installation.)
To stop memcached
./memcached -d stop</tt>
Configuring Application Servers to Use memcached
To enable memcached
  1. Edit networking.properties
  2. Remove the leading # character from the line
#MemCachedServers=localhost:11211
To change the default port
The default port is 11211. To change the port assignment, modify the value(s) for MemCachedServers in networking.properties.
To configure multiple memcached instances
Multiple memcached instances are recommended, so that cache access is distributed. Do that by specifying the IP address and port for each memcache server in the networking.properties file.

Warn.png

Important: If there are multiple memcached servers, then:

  • Every instance should have an identical list of servers.
  • The servers should be in the same order in each list.
  • If the configuration changes, all application servers should be restarted.
Learn more: Adding Additional memcached Servers
To bring up the servers
After making the changes to the networking.properties files for all Application Servers, (re)start servers in the required Server Restart Sequence.