freno can be instructed to write aggregated metrics to memcache. This allows clients to get data directly from memcached without even hitting freno HTTP. This, in turn, decouples read load from freno.
Instruct freno to write aggregated metrics to memcache via MemcacheServers in the config file. List all memcache servers like so:
{
"MemcacheServers": [
"memcache.server.one:11211",
"memcache.server.two:11211",
"memcache.server.three:11211"
],
}Optionally set MemcachePath (default is "freno"):
{
"MemcacheServers": [
"memcache.server.one:11211",
"memcache.server.two:11211",
"memcache.server.three:11211"
],
"MemcachePath": "freno-production",
}freno will write entries to memcache as follows:
- The key will be of the form
<prefix>/<store-type>/<store-name><prefix>can be set via theMemcachePath, and defaults tofreno- An example key might be
freno/mysql/main1
- The value will be of the form
<epochmillis>:<aggregated-value>.- As example, it might be
1497418678836:0.54where1497418678836is the unix epoch in milliseconds, and0.54is the aggregated value. - Embedding the epoch within the value allows the app to double-check the validity of the value, or go into more granular validation.
- As example, it might be
The HTTP API provides the GET /config/memcache service, which returns the json representation of the memcache configuration in use:
{
"MemcacheServers": [
"memcache.server.one:11211",
"memcache.server.two:11211",
"memcache.server.three:11211"
],
"MemcachePath": "freno-production",
}If freno is not configured to publish metrics to memcache, the following defaults will be returned:
{
"MemcacheServers": [],
"MemcachePath": "freno",
}