Method 1: Install directly
1. Download the stable version of memcache for Windows and decompress it to a disk, for example, in C:/memcached
2. Enter "C:/memcached/memcached.exe-D install" on the terminal (that is, the CMD command interface) to install
3. Enter "C:/memcached/memcached.exe-d start" to start. (In the future, memcached will be used as a Windows service to automatically start every time it is started. In this way, the server has been installed .)
Basic settings of memcached:
-P listening port
-L connected IP address. The default value is local
-D start: Start the memcached service.
-D restart: restart the memcached service.
-D stop | Shutdown the running memcached Service
-D install the memcached Service
-D uninstall memcached Service
-U runs as the identity (only valid when running as root)
-MB maximum memory usage, in MB. The default value is 64 MB.
-An error is returned when M memory is used up, instead of deleting items.
-C: Maximum number of simultaneous connections. The default value is 1024.
-F block size growth factor, default value: 1.25
-N: minimum allocation space. The default value of key + value + flags is 48.
-H Show Help
Method 2: create a service process. This method can create multiple cache processes.
C:/memcached> SC create memcache000012 binpath = "/" C: /memcached/memcached.exe/"-D runservice-M 1024-C 2048-P 11212" Start = auto displayname = "cache process (11212 )"
Start the service
C:/memcached> SC start memcache11212
Stop Service
C:/memcached> SC start memcache11212
Delete a service
C:/memcached> SC Delete memcached
View the cache block and configure the-F parameter in the analysis result.
Telnet fig 11212
View cache statuses
Stats
==========================================
View the slabs allocated by the cache
Stats Slabs
==========================================
Clear statistics
Stats reset ==========================================
Whether to display detailed operation records (the number of times each key value is get, set, hit, and del)
Stats detail on, record detailed operations
Stats detail dump, detailed operations not recorded
==========================================
Display the number of items in each slab and the age of the oldest item (the number of seconds from the last visit)
Stats items
==========================================
Displays the list of the first limit_num keys in an slab. The format is as follows:
Stats cachedump slab_id
References
Generally, a memcahced process divides itself into several slabs. Each slab has several pages, and each page has multiple chunks, if we think of the three Doon objects as objects, this is a one-to-many relationship. Generally speaking, the number of slab instances is limited to a few, dozens, or dozens. This is related to the memory configured by the process. The default page size for each slab is 1 MB. That is to say, if an slab occupies 100 MB of memory, the number of pages owned by this slab is by default, and Chunk is the final place where we have to store data. Chunk_size indicates the size of data storage blocks, chunks_per_page indicates the number of chunks in a memory page, and total_pages indicates the number of pages in each slab. Total_chunks indicates the total number of chunks in the slab (= total_pages * chunks_per_page). used_chunks indicates the number of chunks used in the slab. free_chunks indicates that the slab can also use the number of Chun.