Integrate a self-hosted Memcached instance
This topic describes how to connect a self-managed Memcached instance to Cloud Monitor 2.0. The integration component is based on the Memcached adapter for aio-exporter. It uses the stats command family of the text-based protocol to collect metrics such as liveness, hit rate, stored items, connections, evictions, and command rates. No username or password is required. You only need to provide the host:port address. This feature supports deployment in ACK clusters and on ECS instances in a VPC. After you connect the instance, Cloud Monitor automatically generates Memcached instance entities and a built-in dashboard.
Requirements
Before you connect, confirm that the target instance meets the following prerequisites. Failure to meet these prerequisites may result in data collection failures or missing metrics.
|
Condition |
Requirement |
|
Version |
Memcached 1.4+. Version 1.5 or later is required for slab/LRU related metrics (end-to-end tested on version 1.6). |
|
Deployment type |
Only self-managed Memcached is supported. ApsaraDB for Memcache, which requires username and password authentication, is not supported. Use the |
|
Authentication |
No authentication is supported. SASL username and password authentication and TLS are not supported. The target instance must allow unauthenticated access. |
|
Protocol |
Executes |
|
Network connectivity |
In an ACK environment, the target Memcached instance must be accessible from within the selected ACK cluster network. In an ECS (VPC) environment, the vSwitch CIDR block of the managed agent must be able to access the target ECS instance. |
Prerequisites
-
Managed Service for Prometheus is activated.
-
To connect to a CS environment, the target ACK cluster must be connected to Cloud Monitor 2.0 and running, and the target Memcached service must be accessible within the cluster network.
-
For ECS (VPC) environments: A target ECS instance that runs Memcached must be accessible from the vSwitch CIDR block of the managed agent.
Billing
-
Billing is based solely on the volume of metric data generated in Billing overview.
Integration methods
Step 1: Confirm authentication-free access
This plugin does not require a username or password. Confirm that the target Memcached service does not have Simple Authentication and Security Layer (SASL) enabled and that the network where the Exporter is located can run the stats command.
This plugin cannot be used with ApsaraDB for Memcache because it requires username and password authentication. Instead, install the cloud-acs-memcache plugin.
Step 2: Select the integration environment
This plugin supports two environment types, CS and ECS(VPC), which function differently. Select the environment based on the deployment location of your Memcached instance:
Container Service for Kubernetes (ACK)
-
The Exporter is installed in the target ACK cluster, and the existing data collector in the cluster is used to collect metrics.
-
The monitored object is the ACK cluster.
-
Network requirements: The target Memcached service must be accessible from the cluster network. For example, the service can be deployed within the cluster or in a VPC that the cluster can access over a private network.
ECS (VPC)
-
After you select the ECS instance where the target Memcached service is deployed, the system uses the VPC information of the ECS instance to deploy a fully managed data collector.
-
No processes are installed on the ECS instance.
-
The monitored object is the ECS instance.
-
Network requirements: The vSwitch CIDR block of the fully managed data collector must be allowed to access the target ECS instance. For example, you must configure security group rules and access control lists (ACLs) to allow access.
|
Environment |
Exporter deployment location |
Installing a process on the application server |
Monitored object |
Network requirements |
|
CS |
User-specified ACK cluster |
No. The Exporter is deployed in the cluster, not on the hosts of your application pods. |
ACK cluster |
Memcached is accessible from the cluster network. |
|
ECS (VPC) |
Fully managed data collector deployed by the system based on the VPC. |
No. No processes are installed on the ECS instance. |
ECS instance |
The managed agent's vSwitch CIDR block can access the target ECS instance. |
Step 3: Configure the integration
-
Log on to the Cloud Monitor console, select a workspace, click Integration Center in the navigation pane on the left, and then click Memcached.
-
Select the access environment (CS or ECS (VPC)), and from the drop-down list, select Observation Object.
-
Configure the required parameters and click OK.
Configuration item
Required
Description
Memcached service endpoint
Yes
For a CS environment, enter the in-cluster endpoint. For an ECS (VPC) environment, enter the internal or public endpoint.
Memcached service port
Yes
Default: 11211
Cloud vendor / Deployment source
No
This value is written to the
providerlabel of the metric. For self-built instances, select "Self-hosted" (self-hosted/memcached). The options do not include the Alibaba Cloud managed version.Metric collection interval (seconds)
Yes
Default: 15
Custom tags
No
Additional tags to be injected into the metrics.
Use public image repository address
No
Disabled by default. Enable this option if the internal image repository is inaccessible.
-
After the integration is successful, you can view the integrated entities and their observable data in Entity Explorer.
Data usage
Entities
After the integration is connected, Cloud Monitor periodically discovers Memcached instances from the labels of metrics such as memcached_up. Cloud Monitor then generates middleware entities.
|
Dimension |
Description |
|
Domain |
middleware |
|
Entity type |
middleware.memcached |
|
Entity filter condition |
|
|
Associated entity |
For Container Service for Kubernetes (ACK) environments: |
Entity fields are derived from collected labels and are not affected by the number of installations.
|
Field |
Description |
|
instance_id |
Instance identity. This field is obtained from the |
|
provider |
Deployment source, such as |
|
port |
Service port. |
|
region_id |
Region. |
|
env_type |
Deployment environment type (CS or ECS) |
|
cluster_id |
The ID of the cluster. |
You can retrieve instances in the Entity Explorer or Middleware Insight application using the fields listed above.
Built-in dashboards
|
Dashboard name |
Access point |
Description |
|
Memcached Overview (Instance Overview) |
The Instance Overview tab on the entity details page. |
A UModel dashboard where variables are automatically bound based on the instance context. |
|
Memcached Overview |
Grafana dashboard list. |
A Grafana dashboard. Both Chinese and English versions are provided. |
Core metrics
The following table lists the 20 metrics for the middleware.metric.memcached entity dataset. You can use these metrics directly in entity details, dashboards, and alerts.
|
Metric name |
Type |
Unit |
Display name |
Description |
|
memcached_up |
gauge |
- |
Memcached active |
Indicates whether the Memcached service is reachable. A value of 1 indicates that the service is active. A value of 0 indicates that the service is unavailable. |
|
memcached_uptime_seconds |
counter |
s |
Runtime |
The runtime in seconds since the service started. |
|
memcached_current_items |
gauge |
- |
Current items |
The number of cache items currently stored in the instance. |
|
memcached_current_bytes |
gauge |
bytes |
Current bytes used |
The number of bytes currently used to store cache items. |
|
memcached_limit_bytes |
gauge |
bytes |
Storage limit |
The maximum number of bytes that the service can use for storage. |
|
memcached_memory_usage |
gauge |
% |
Storage usage |
The storage usage, calculated as `current_bytes` / `limit_bytes`. |
|
memcached_current_connections |
gauge |
- |
Current connections |
The number of currently open connections. |
|
memcached_max_connections |
gauge |
- |
Maximum connections |
The maximum number of client connections allowed. |
|
memcached_connections_rate |
counter |
times per second |
Connection rate |
The rate of new connections established per second. |
|
memcached_get_hits_rate |
counter |
hits/s |
Get hit rate |
The rate of get command hits per second. |
|
memcached_get_misses_rate |
counter |
Times per second |
Get miss rate |
The rate of get command misses per second. |
|
memcached_hit_ratio |
gauge |
% |
Hit rate |
The get command hit rate, calculated as hits / (hits + misses). |
|
memcached_commands_rate |
counter |
commands/s |
Command execution rate |
The execution rate of commands, categorized by type, such as get, set, and delete. |
|
memcached_set_rate |
counter |
commands/s |
Set rate |
The rate of set commands per second. |
|
memcached_items_evicted_rate |
counter |
counts per second |
Eviction rate |
The rate at which valid cache items are evicted to free up memory. |
|
memcached_items_reclaimed_rate |
counter |
items/s |
Reclamation rate |
The rate at which memory is reclaimed from expired items. |
|
memcached_items_total_rate |
counter |
Times per second |
Write rate for storage items |
The rate at which cache items have been stored during the instance lifetime. |
|
memcached_read_bytes_rate |
counter |
Byte |
Network Read |
The number of bytes read from the network by the service per second. |
|
memcached_written_bytes_rate |
counter |
Byte |
Network Out |
The number of bytes sent to the network by the service per second. |
|
memcached_connections_listener_disabled_rate |
counter |
times/s |
Listener disabled rate |
The rate at which the service temporarily disables the listener because the connection limit is reached. This is a signal of connection saturation. |
In addition to the aggregated MetricSet metrics listed above, the raw metrics collected by the exporter, such as memcached_*, are also written to Prometheus storage. You can query these metrics directly using Prometheus Query Language (PromQL).
Example queries
# Active
memcached_up
# Hit rate
rate(memcached_commands_total{command="get",status="hit"}[5m])
/ clamp_min(rate(memcached_commands_total{command="get"}[5m]), 1)
# Current connections
memcached_current_connections
Alert templates
This integration component does not have built-in alert rules. In the Alert Center, you can configure custom alerts based on the metrics listed above. For example, you can create alerts for scenarios where the memcached_up metric is not equal to 1, or where the number of connections or the amount of message accumulation exceeds a threshold.
Storage policies
After you integrate Memcached, Cloud Monitor creates a corresponding storage instance to store observable data.
|
Data type |
Default storage location |
Notes |
|
Metrics |
Prometheus instance: RegionShare:{{workspaceName}}:{{regionId}} |
Associated dataset: |
Manage or remove the integration
To modify or cancel the integration, go to the Integration Management page of Integration Center, find the corresponding integration policy, and then click Edit or Delete. When you delete the integration policy, the Exporter and the collection configuration are removed together. Historical metrics that have already been written are retained based on the lifecycle policy of the storage.