Eli : Memcached, MySQL, Highcharts

Memcached - 3

Memcached - 3

memcached-logo.jpg

Free & open source, high-performance, distributed memory object caching system

phpMemcachedAdmin 1.2.0 beta released

New version of memcached monitoring administration is released and available from http://code.google.com/p/phpmemcacheadmin/

A lot of things have been improved in this version :

  • Look & feel
  • Multiple cluster support
  • Search for a key in Memcached for a key & Telnet command options
  • And many more ...

Check the complete release notes here : http://code.google.com/p/phpmemcacheadmin/wiki/Roadmap

phpmemcachedadmin-1.2.0beta_livestats.png

If you have any suggestion or bug, you can contact me by mail

Other Memcached Resources

You can find a lot of Memcached resources on this Memcached resources page.


Friday, December 24 2010

Understanding Memcached stats cachedump command

This is an undocumented feature, meaning this command is not supported by the Memcached team, it still exists in 1.4.5 but can possibly be removed in any version.

stats cachedump command

Telnet command : stats cachedump <slabs_id> <limit>\r\n

Parameters :

  • <slabs_id> : slab id from where you want to retreive the keys
  • <limit> : result limit, 0 mean no limit

Be aware that this function return is limited to 1MB (or maybe 2MB, this is not clear actually)

Example :

stats cachedump 4 0
ITEM key_7abc8b445c35d211046a856f946dde96a8b48bf8 [172 b; 1293184017 s]
ITEM key_da39a3ee5e6b4b0d3255bfef95601890afd80709 [173 b; 1293183894 s]
ITEM key_b858a87c07b04c4568f51b0dce655f78d73c02b3 [178 b; 1289314215 s]
ITEM key_eadcd9bd2a09c75aef04954e6799e50278ee124a [173 b; 1293186833 s]
ITEM key_fa3a0c6f483fb9e1cf9b5d7e4aa224c541dcf618 [167 b; 1289314215 s]
END


stats cachedump command return

It return items with the template
ITEM <item_key> [<item_size> b; <expiration_timestamp> s]

Parameters :

  • <item_key> : The item key
  • <item_size> : Item size (including key) in bytes
  • <expiration_timestamp> : Expiration timestamp in second

To understand the timestamp, we need to make a stats command on the server

stats
stats
STAT pid 1879
STAT uptime 4222347
STAT time 1293536562
STAT version 1.4.5
[...]

If the timestamp is equal to stats(time - uptime) then the item have got an infinite expiration else the item will expire when the timestamp is reached.

In our example, 1293536562 - 4222347 = 1289314215, two items have an infinite expiration

Other Memcached Resources

You can find a lot of Memcached resources on this Memcached resources page.


Friday, October 15 2010

Various versions of Memcached for Windows

This post contains various binaries versions of Memcached for Windows as finding some of them may be difficult.

Memcached 1.2.X

Memcached 1.2.4 for Windows (32 Bits) : memcached 1.2.4 win32.zip

Memcached 1.2.5 for Windows (32 Bits) : memcached 1.2.5 win32.zip

Memcached 1.2.6 for Windows (32 Bits) : memcached 1.2.6 win32.zip

Memcached 1.4.X

Memcached 1.4.2 for Windows (32 Bits) : memcached 1.4.2 win32.zip

Memcached 1.4.4 for Windows (32 Bits) : memcached 1.4.4 win32.rar

Memcached 1.4.5 for Windows (32 Bits) : memcached 1.4.5 win32.zip

Memcached 1.4.5 for Windows (64 Bits) : memcached 1.4.5 win64.zip

Credits

All credits goes to Jellycan for 1.2.5 and 1.2.6 and Northscale (now Membase) for 1.4.X.

Other Memcached Resources

You can find a lot of Memcached resources on this Memcached resources page.


Wednesday, August 25 2010

Memcached 1.4.5 for Windows



Update 2013 : Memcached Windows Build from 1.2 to 1.5

You can find other various build of Memcached for Windows on this post




NorthScale has built and posted packages of Memcached server version 1.4.5 for Windows to the community.

New Features of version 1.4.5

  • reclaimed : This stat reports the number of times an entry was stored using memory from an expired entry.
  • sasl_pwdb : For more simple auth deployments


Download

You can download it from Northscale Labs http://labs.northscale.com/memcached-packages/ :

Memcached 1.4.5 Windows (64-bit) memcached-1.4.5-amd64.zip
Memcached 1.4.5 Windows (32-bit) memcached-1.4.5-x86.zip


Friday, May 21 2010

Memcached telnet command summary

Here a summary of Memcached commands usable in telnet
If you need to install or set up Memcached as a service on Windows, follow this link

Connecting to Memcached server with telnet

telnet <hostname> <port>


In the following \r\n mean you have to type enter in telnet console
If Memcached server send ERROR or CLIENT_ERROR, something is false with the command, if it's SERVER_ERROR, server itself is in trouble

Retrieval Commands

Parameters :
<key> : the key of the data stored to retrieve
<key>* mean you can request value of multiple keys separated by whitespace

These commands return :
VALUE <flag> <bytes>\r\n<data> (see the following for explanation of <bytes> and <flag>)
END indicate the end of response

Get

Get value from key
Telnet command : get <key>*\r\n

get key
VALUE key 0 4
data
END

Gets

Get value from key along with a cas token (to use with cas command)
Telnet command : gets <key>*\r\n

get key
VALUE key 0 4
data
END


Storage Commands

Parameters :
<key> : the key of the data stored
<flags> : 32-bit unsigned integer that the server store with the data (provided by the user), and return along the data when the item is retrieved
<exptime> : expiration time in seconds, 0 mean no delay, if exptime is superior to 30 day, Memcached will use it as a UNIX timestamps for expiration
<bytes> : number of bytes in the data block
<cas unique> : unique 64-bit value of an existing entry (retrieved with gets command) to use with cas command
[noreply] : optional parameter that inform the server to not send the reply

These commands can return :
STORED to indicate success
NOT_STORED indicate that the data was not stored because condition for "add" or "replace" command wasn't met, or the item is in a delete queue
EXISTS indicate that the item you are trying to store with "cas" command has been modified since last fetch
NOT_FOUND indicate that the item did not exist or has been deleted

Set

Store key/value pair in Memcached

Telnet command : set <key> <flags> <exptime> <bytes> [noreply]\r\n<value>\r\n

set key 0 900 4
data
STORED

Add

Store key/value pair in Memcached, but only if the server doesn't already hold data for this key

Telnet command : add <key> <flags> <exptime> <bytes> [noreply]\r\n<value>\r\n

add key 0 900 2
10
STORED

Replace

Store key/value pair in Memcached, but only if the server already hold data for this key

Telnet command : replace <key> <flags> <exptime> <bytes> [noreply]\r\n<value>\r\n

replace key 0 900 2
10
STORED

Append

Add value to an existing key after existing data
Append does not take <flags> or <exptime> parameters but you must provide them !

Telnet command : append <key> <flags> <exptime> <bytes> [noreply]\r\n<value>\r\n

append key 0 900 2
10
STORED

Prepend

Add value to an existing key before existing data
Prepend does not take <flags> or <exptime> parameters but you must provide them !

Telnet command : prepend <key> <flags> <exptime> <bytes> [noreply]\r\n<value>\r\n

prepend key 0 900 2
10
STORED

Cas

Store data only if no one else has updated since the last fetch, determined with the cas tokem from gets command
Telnet command : cas <key> <flags> <exptime> <bytes> <cas unique> [noreply]\r\n

cas key 0 900 2 <cas unique>
10
STORED


Delete Command

Parameters :
<key> : the key to delete
[<time>] : optional time in second before real deletion of item
[noreply] : optional parameter that inform the server to not send the reply

These command can return :
DELETED to indicate success
NOT_FOUND indicate that the item did not exist or has been deleted

Delete

Store key/value pair in Memcached

Telnet command : delete <key> [<time>] [noreply]\r\n

delete key
DELETED


Increment/Decrement Commands

Parameters :
<key> : the key to delete
<value> : the amount to increase/decrease the item.
[noreply] : optional parameter that inform the server to not send the reply

These command can return :
NOT_FOUND indicate that the item did not exist or has been deleted
<value> increment and decrement return the result

Increment

Increment value associated with key in Memcached, item must exist, increment command will not create it
The limit of increment is the 64 bit mark

Telnet command : incr <key> <value> [noreply]\r\n

incr key 12
56

Decrement

Decrement value associated with key in Memcached, item must exist, decrement command will not create it
If you try to decrement a value bellow 0, value will stay at 0

Telnet command : decr <key> <value> [noreply]\r\n

decr key 12
44


Touch Command

Parameters :
<key> : the key to delete
<exptime> : is expiration time. Works the same as with the update commands (set/add/etc). This replaces the existing expiration time.
[noreply] : optional parameter that inform the server to not send the reply

These command can return :
NOT_FOUND indicate that the item did not exist or has been deleted
TOUCHED to indicate success

Touch

The "touch" command is used to update the expiration time of an existing item without fetching it.

Telnet command : touch <key> <exptime> [noreply]\r\n

touch key 1800
TOUCHED


Statistics Commands

Parameters :
<args> : argument to stats command

These command can return various stats that we will explain in the following

Basic stats

Return general-purpose statistics like uptime, version, memory occupation, ...

Telnet command : stats\r\n

stats
STAT pid 106796
STAT uptime 5696
STAT time 1274397461
STAT version 1.4.5
STAT pointer_size 32
...
STAT total_items 344512124
STAT evictions 0
END

Items stats

Return items statistics, will display items statistics (count, age, eviction, ...) organized by slabs ID

Telnet command : stats items\r\n

stats
STAT items:1:number 1125
STAT items:1:age 426
STAT items:1:evicted 0
STAT items:1:evicted_nonzero 0
STAT items:1:evicted_time 0
STAT items:1:outofmemory 0
STAT items:1:tailrepairs 0
...
STAT items:42:tailrepairs 0
END

Slabs stats

Return slabs statistics, will display slabs statistics (size, memory usage, commands count, ...) organized by slabs ID

Telnet command : stats slabs\r\n

stats
STAT 1:chunk_size 80
STAT 1:chunks_per_page 13107
STAT 1:total_pages 1
STAT 1:total_chunks 13107
STAT 1:used_chunks 1125
...
STAT active_slabs 25
STAT total_malloced 10485600
END


Misc Commands

Flush_all

Flush the server key/value pair (invalidating them) after a optional [<time>] period
It always return OK

Telnet command : flush_all [<time>] [noreply]\r\n

flush_all 10
OK

Version

Return the Memcached server version

Telnet command : version\r\n

version
VERSION 1.4.5

Verbosity

Change the verbosity ouptut of Memcached server
It always return OK

Telnet command : verbosity <level> [noreply]\r\n

verbosity 2
OK

Quit

Server close connection when receiving this command

Telnet command : quit\r\n

quit


For any advanced need Memcached text protocol can be found here about Protocol

Other Memcached Resources

You can find a lot of Memcached resources on this Memcached resources page.


- page 3 of 5 -