Interface
void init(Map<Object, Object> conf) throws Exception; |
JStormCache的实现
- com.alibaba.jstorm.cache.TimeoutMemCache
- com.alibaba.jstorm.cache.RocksDBCache
- com.alibaba.jstorm.cache.RocksTTLDBCache
TimeoutMemCache
TreeMap<Integer, TimeCacheMap<String, Object>> cacheWindows
维持了多个timeout的TimeCacheMap:
- default.cache.timeout default:60
- cache.timeout.list default:null
|
RocksDBCache
使用RocksDB实现的一个key=>value持久化的DB.data_dir = ${storm.local.dir}/nimbus/rocksdb/
RocksTTLDBCache
RocksDBCache的TTL实现,TreeMap<Integer, ColumnFamilyHandle> windowHandlers维持多个timeout的ColumnFamilyHandle
- infinite lifetime
RocksDB.DEFAULT_COLUMN_FAMILY
- cache.timeout.list default:null
protected Entry<Integer, ColumnFamilyHandle> getHandler(int timeoutSecond) { |
NimbusCache
- memCache 内存cache
- dbCache DB cache
若dbCache为内存cache,memCache=dbCache;
public String getNimbusCacheClass(Map conf) { |
配置:
## Two type cache
## "com.alibaba.jstorm.cache.TimeoutMemCache" is suitable for small cluster
## "com.alibaba.jstorm.cache.TimeoutMemCacheRocksDBCache" can only run under linux/mac, it is suitable for huge cluster
## if it is null, it will detected by environment
nimbus.cache.class: null
## if this is true, nimbus db cache will be reset when start nimbus
nimbus.cache.reset: true
cache.timeout.list: null