Memcached monitoring integration

The Memcached integration reports data from your Memcached instance to New Relic Infrastructure. This document explains how to install and configure the Memcached integration and describes the data collected.

Access to this feature depends on your subscription level. Requires Infrastructure Pro.

This on-host integration has been contributed to the New Relic GitHub under an MIT license.

Features

The Memcached on-host integration collects and sends inventory and metrics from your Memcached instance to the New Relic platform, where you can aggregate and visualize key performance metrics. Data is collected on both the instance and slab levels.

Compatibility and requirements

To use the Memcached integration, ensure your system meets these requirements:

Install

On-host integrations do not automatically update. For best results, you should occasionally update the integration and update the Infrastructure agent.

To install the Memcached integration:

  1. Follow the instructions for installing an integration, using the file name nri-memcached.
  2. Via the command line, change directory to the integrations folder:
    cd /etc/newrelic-infra/integrations.d
  3. Create a copy of the sample configuration file by running:
    sudo cp memcached-config.yml.sample memcached-config.yml
  4. Edit the memcached-config.yml configuration file using the configuration settings.
  5. Restart the infrastructure agent.

It is also possible to manually install integrations from a tarball file. For more information, see Install manually from a tarball archive.

Configure

Use the Memcached integration's memcached-config.yml configuration file to put required login credentials and configure how data is collected. For an example configuration, see the example config file.

Commands

The memcached-config.yml file provides these commands:

  • all_data: collects both inventory and metrics for the Memcached instance.
  • inventory: collects only the inventory (configuration) data for the Memcached instance.
  • metrics: collects only the metrics data for the Memcached instance.

Arguments

The memcached-config.yml commands accept the following arguments:

  • username: The username for the Memcached connection. Default: no authentication

  • password: The password for the Memcached connection. Default: no authentication

  • hostname: The hostname for the Memcached connection. Default: localhost.

  • port: The port on which the Memcached instance is running. Default: 11211.

Example memcached-config.yml file configuration:

Example configuration
integration_name: com.newrelic.memcached

instances:
  - name: memcached
    # Command can be all_data, metrics, or inventory
    command: all_data
    arguments:
      # Hostname of the memcached instance.
      # Defaults to localhost.
      host: memcached_host
      # Port memcached is running on.
      # Defaults to 11211
      port: 11211
      # Memcached SASL username. Only required if 
      # authentication is enabled.
      username: cacheuser
      # Memcached SASL password. Only required if 
      # authentication is enabled.
      password: password

Find and use data

To find your integration data in Infrastructure, go to infrastructure.newrelic.com > Third-party services and select one of the Memcached integration links.

In New Relic Insights, Memcached data is attached to the following Insights event types:

For more on how to find and use your data, see Understand integration data.

Metric data

The Memcached integration collects the following metric data attributes.

These attributes can be found by querying the MemcachedSample event types in Insights.

Metric Description

avgItemSizeInBytes

The average size of an item.

bytesReadServerPerSecond

Rate of bytes read from the network by this server.

bytesUsedServerInBytes

Current number of bytes used by this server to store items.

bytesWrittenServerPerSecond

Rate of bytes written to the network by this server.

casHitRatePerSecond.

Rate at which keys are compared and swapped and found present.

casMissRatePerSecond

Rate at which keys are compared and swapped and not found present.

casWrongRatePerSecond

Rate at which keys are compared and swapped where the original value did not match the supplied value.

cmdFlushRatePerSecond

Rate of flushall commands.

cmdGetRatePerSecond

Rate of get commands.

cmdSetRatePerSecond

Rate of set commands.

connectionRateServerPerSecond

Rate at which connections to this server are opened.

connectionStructuresAllocated

Number of connection structures allocated by the server.

currentItemsStoredServer

Current number of items stored by the server.

deleteCmdNoneRemovedPerSecond

Rate at which delete commands result in no items being removed.

deleteCmdRemovedPerSecond

Rate at which delete commands result in items being removed.

evictionsPerSecond

Rate at which valid items are removed from cache to free memory for new items.

executionTime

Fraction of user time the CPU spent executing this server process.

getHitPercent

Percentage of requested keys that are found present since the start of the memcache server.

getHitPerSecond

Rate at which keys are requested and found present.

getMissPerSecond

Rate at which keys are requested and not found.

limitBytesStorage

Number of bytes this server is allowed to use for storage.

openConnectionsServer

Number of open connections to this server.

pointerSize

Default size of pointers on the host OS (generally 32 or 64).

serverMaxConnectionLimitPerSecond

Rate at which the server has reached the max connection limit

storingItemsPercentMemory

Amount of memory being used by the server for storing items as a percentage of the max allowed.

threads

Number of threads used by the current Memcached server process.

totalItemsStored

Total number of items stored by this server since it started.

uptimeInMilliseocnds

Number of seconds this server has been running.

usageRate

Fraction of time the CPU spent executing kernel code on behalf of this server process.

These attributes can be found by querying the MemcachedSlabSample event types in Insights.

Metric Description

activeItemsBumpedPerSecond

Rate at which active items were bumped within HOT or WARM.

activeSlabs

Total number of slab classes allocated.

casBadValPerSecond

Rate at which Check-And-Set (CAS) commands failed to modify a value due to a bad CAS ID.

casModifiedSlabPerSecond

Rate at which CAS commands modified this slab class.

chunkSizeInBytes

The amount of space each chunk uses.

chunksPerPage

How many chunks exist within one page.

cmdSetRateSlabPerSecond

Rate at which set requests stored data in this slab class.

decrsModifySlabPerSecond

Rate at which decrs commands modified this slab class.

deleteRateSlabPerSecond

Rate at which delete commands succeeded in this slab class.

entriesReclaimedPerSecond

Rate at which entries were stored using memory from an expired entry.

evictionsBeforeExpirationPerSecond

Rate at which items had to be evicted from the Least Recently Used (LRU) before expiring.

evictionsBeforeExplicitExpirationPerSecond

Rate at which nonzero items which had an explicit expire time set had to be evicted from the LRU before expiring.

expiredItemsReclaimedPerSecond

Rate at which expired items reclaimed from the LRU which were never touched after being set.

freeChunksEnd

Number of free chunks at the end of the last allocated page.

freedChunks

Chunks not yet allocated to items or freed via delete.

getHitRateSlabPerSecond

Rate at which get requests were serviced by this slab class.

incrsModifySlabPerSecond

Rate at which incrs commands modified this slab class.

itemsCold

Number of items presently stored in the COLD LRU.

itemsColdPerSecond

Rate at which items were moved from HOT or WARM into COLD.

itemsDirectReclaimPerSecond

Rate at which worker threads had to directly pull LRU tails to find memory for a new item.

itemsFreedCrawlerPerSecond

Rate at which items freed by the LRU crawler.

itemsHot

Number of items presently stored in the HOT LRU.

itemsOldestInMilliseconds

Age of the oldest item in the LRU.

itemsRefcountLockedPerSecond

Rate at which items found to be refcount locked in the LRU tail.

itemsSlabClass

Number of items presently stored in this slab class.

itemsTimeSinceEvictionInMilliseconds

Seconds since the last access for the most recent item evicted from this slab class, shown as milliseconds.

itemsWarm

Number of items presently stored in the WARM LRU.

itemsWarmPerSecond

Rate at which items were moved from COLD to WARM.

memAllocatedSlabsInBytes

Total amount of memory allocated to slab pages.

memRequestedSlabInBytes

Number of bytes requested to be stored in this slab.

outOfMemoryPerSecond

Rate at which the underlying slab class was unable to store a new item shown as error.

selfHealedSlabPerSecond

Rate at which memcache self-healed a slab with a refcount leak.

totalChunksSlab

Total number of chunks allocated to the slab class.

totalPagesSlab

Total number of pages allocated to the slab class.

touchHitSlabPerSecond

Rate of touches serviced by this slab class.

usedChunksItems

Number of chunks allocated to items.

usedChunksPerSecond

Rate at which chunks have been allocated to items.

validItemsEvictedPerSecond

Rate at which valid items evicted from the LRU which were never touched after being set.

Inventory data

The Memcached integration captures the configuration parameters of the memcached instance. The data is available on the Infrastructure Inventory page, under the config/memcached source. For more about inventory data, see Understand integration data.

The integration captures data for the following Memcached configuration parameters:

Memcached Inventory

Metric Description

auth_enabled_sasl

Indicates whether SASL authentication is enabled.

binding_protocol

Sets the default protocol support for client connections. Options: ascii, binary, or auto/. Default: Auto

cas_enabled

Indicates whether Check-And-Set (CAS) is enabled.

chunk_size

The amount of space each chunk uses. One item will use one chunk of the appropriate size.

detail_enabled

Indicates whether stats detail is enabled.

domain_socket

The path to the UNIX socket to listen on.

dump_enabled

Indicates whether stats cachedump and lru_crawler metadump is enabled.

evictions

Indicates whether evictions are enabled. If so, returns an error on memory exhausted instead of evicting.

flush_enabled

Indicates whether flush_all command is enabled.

growth_factor

The chunk size growth factor.

hash_algorithm

The hash table algorithm.

hashpower_init

An integer multiplier for how large the hash table should be. Normally grows at runtime.

hot_lru_pct

Percent of slab memory to reserve for HOT LRU.

hot_max_factor

Set idle age of HOT LRU to COLD age multiplied by this value.

idle_timeout

Timeout for idle connections.

inline_ascii_response

Save up to 24 bytes per item.

inter

The interface to listen on.

item_size_max

The maximum size for an item.

lru_crawler

Enable the LRU crawler background thread.

lru_crawler_sleep

Microseconds to sleep between items.

lru_crawler_tocrawl

Max items to crawl per slab per run.

lru_maintainer_thread

Split LRU mode and background threads.

lru_segmented

Enable segmented LRU mode.

maxbytes

The maximum number of bytes allowed in the cache.

maxconns

The maximum number of clients allowed.

maxconns_fast

Immediately close new connections after limit is reached.

num_threads

Number of threads to use.

num_threads_per_udp

Number of threads to use per UDP.

oldest

The age of the oldest honored object.

reqs_per_event

Maximum number of requests per event.

slab_automove

Indicates whether slab page automover is enabled.

slab_automove_ratio

Ratio limit between young/old slab classes.

slab_automove_window

Internal algorithm tunable for automove.

slab_chunk_max

Specifies the maximum size of a slab. Items larger than the set max are split over multiple slabs.

slab_reassign

Enable or disable slab reassignment.

stat_key_prefix

The prefix used for stats keys.

tail_repair_time

Time in seconds for how long to wait before forcefully killing LRU tail item.

tcp_backlog

The backlog queue limit.

tcpport

The TCP port to listen on.

temp_lru

Boolean value, indicates if temporary_ttl uses temp_lru.

temporary_ttl

Items set with a TTL lower than this value will go into TEMP_LRU and be unevictable until they expire or are deleted or replaced. If TTL is set to zero, TEMP_LRU is disabled.

track_sizes

Enable dynamic reporters for 'stats sizes' command.

udpport

The UDP port to listen on.

umask

Access mask for UNIX socket, in octal.

verbosity

Set the verbosity level of the logging output. 0 = none, 1 = some, 2 = lots.

warm_lru_pct

Percent of slab memory to reserve for WARM LRU.

warm_max_factor

Set idle age of WARM LRU to COLD age multiplied by this value.

watcher_logbuf_size

Size in kilobytes of per-watcher write buffer.

worker_logbuf_size

Size in kilobytes of per-worker-thread buffer.

For more help

Recommendations for learning more:

  • See the Docs site's landing page for Infrastructure integrations documentation.
  • Browse New Relic's Explorers Hub for community discussions about New Relic Infrastructure integrations.
  • Use your preferred search engine to find other New Relic resources.