2018-12-13 14:47:20 -05:00
---
layout: doc_page
title: "Druid Redis Cache"
---
2018-11-13 12:38:37 -05:00
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
2018-12-12 23:42:12 -05:00
# Druid Redis Cache
2017-08-24 10:53:51 -04:00
2019-04-19 18:52:26 -04:00
To use this Apache Druid (incubating) extension, make sure to [include ](../../operations/including-extensions.html ) `druid-redis-cache` extension.
2017-08-24 10:53:51 -04:00
A cache implementation for Druid based on [Redis ](https://github.com/antirez/redis ).
# Configuration
2018-08-09 16:44:59 -04:00
Below are the configuration options known to this module.
2017-08-24 10:53:51 -04:00
2019-02-28 21:10:39 -05:00
Note that just adding these properties does not enable the cache. You still need to add the `druid.<process-type>.cache.useCache` and `druid.<process-type>.cache.populateCache` properties for the processes you want to enable the cache on as described in the [cache configuration docs ](../../configuration/index.html#cache-configuration ).
2018-08-09 16:44:59 -04:00
2019-02-28 21:10:39 -05:00
A possible configuration would be to keep the properties below in your `common.runtime.properties` file (present on all processes) and then add `druid.<nodetype>.cache.useCache` and `druid.<nodetype>.cache.populateCache` in the `runtime.properties` file of the process types you want to enable caching on.
2018-08-09 16:44:59 -04:00
|`common.runtime.properties`|Description|Default|Required|
2017-08-24 10:53:51 -04:00
|--------------------|-----------|-------|--------|
|`druid.cache.host`|Redis server host|None|yes|
|`druid.cache.port`|Redis server port|None|yes|
|`druid.cache.expiration`|Expiration(in milliseconds) for cache entries|24 * 3600 * 1000|no|
|`druid.cache.timeout`|Timeout(in milliseconds) for get cache entries from Redis|2000|no|
|`druid.cache.maxTotalConnections`|Max total connections to Redis|8|no|
|`druid.cache.maxIdleConnections`|Max idle connections to Redis|8|no|
|`druid.cache.minIdleConnections`|Min idle connections to Redis|0|no|
# Enabling
To enable the redis cache, include this module on the loadList and set `druid.cache.type` to `redis` in your properties.
# Metrics
In addition to the normal cache metrics, the redis cache implementation also reports the following in both `total` and `delta`
|Metric|Description|Normal value|
|------|-----------|------------|
2018-08-09 16:44:59 -04:00
|`query/cache/redis/*/requests`|Count of requests to redis cache|whatever request to redis will increase request count by 1|