Oracle 5.0 Reference Manual page 1366

Table of Contents

Advertisement

15.6.2.4.
memcached
The
memcached
multi-server configurations to determine which host should be used when setting or getting data from
a given
memcached
key and then used to select a host from the list of configured servers. Because the hashing mechanism
uses the supplied key as the basis for the hash, the same server is selected during both set and get
operations.
You can think of this process as follows. Given an array of servers (a, b, and c), the client uses a
hashing algorithm that returns an integer based on the key being stored or retrieved. The resulting
value is then used to select a server from the list of servers configured in the client. Most standard
client hashing within
number of configured
@memcservers = ['a.memc','b.memc','c.memc'];
$value = hash($key);
$chosen = $value % length(@memcservers);
Replacing the above with values:
@memcservers = ['a.memc','b.memc','c.memc'];
$value = hash('myid');
$chosen = 7009 % 3;
In the above example, the client hashing algorithm chooses the server at index 1
and store or retrieve the key and value with that server.
You can see a graphical representation of this below in
Figure 15.5.
The same hashing and selection process takes place during any operation on the specified key within
the
memcached
Using this method provides a number of advantages:
• The hashing and selection of the server to contact is handled entirely within the client. This
eliminates the need to perform network communication to determine the right machine to contact.
• Because the determination of the
be selected automatically regardless of the operation being executed (set, get, increment, etc.).
Hashing/Distribution Types
client interface supports a number of different distribution algorithms that are used in
instance. When you get or set a value, a hash is constructed from the supplied
clients uses a simple modulus calculation on the value against the
memcache
servers. You can summarize the process in pseudocode as:
memcached
Note
This selection and hashing process is handled automatically by the
client you are using; you need only provide the list of
use.
Hash Selection
memcached
client.
Using
memcached
Figure 15.5,
server occurs entirely within the client, the server can
memcached
1346
(7009 % 3 =
memcached
servers to
memcached
"memcached
Hash
Selection".
1),

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents