Repository: incubator-htrace Updated Branches: refs/heads/master 47b889c4c -> 898eaf8b9
HTRACE-332. htraced: optionally enable leveldb LRU cache (cmccabe) Project: http://git-wip-us.apache.org/repos/asf/incubator-htrace/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-htrace/commit/898eaf8b Tree: http://git-wip-us.apache.org/repos/asf/incubator-htrace/tree/898eaf8b Diff: http://git-wip-us.apache.org/repos/asf/incubator-htrace/diff/898eaf8b Branch: refs/heads/master Commit: 898eaf8b9bd1e3beee114423dd7f2c3171774e96 Parents: 47b889c Author: Colin P. Mccabe <[email protected]> Authored: Mon Dec 14 13:16:25 2015 -0800 Committer: Colin P. Mccabe <[email protected]> Committed: Mon Dec 14 13:16:25 2015 -0800 ---------------------------------------------------------------------- htrace-htraced/go/src/org/apache/htrace/conf/config_keys.go | 4 ++++ htrace-htraced/go/src/org/apache/htrace/htraced/loader.go | 2 ++ 2 files changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/898eaf8b/htrace-htraced/go/src/org/apache/htrace/conf/config_keys.go ---------------------------------------------------------------------- diff --git a/htrace-htraced/go/src/org/apache/htrace/conf/config_keys.go b/htrace-htraced/go/src/org/apache/htrace/conf/config_keys.go index 9f3bc61..16790d8 100644 --- a/htrace-htraced/go/src/org/apache/htrace/conf/config_keys.go +++ b/htrace-htraced/go/src/org/apache/htrace/conf/config_keys.go @@ -100,6 +100,9 @@ const HTRACE_HRPC_IO_TIMEOUT_MS = "hrpc.io.timeout.ms" // MB in leveldb 1.16. See leveldb's options.h for more details. const HTRACE_LEVELDB_WRITE_BUFFER_SIZE = "leveldb.write.buffer.size" +// The LRU cache size for leveldb, in bytes. +const HTRACE_LEVELDB_CACHE_SIZE = "leveldb.cache.size" + // Default values for HTrace configuration keys. var DEFAULTS = map[string]string{ HTRACE_WEB_ADDRESS: fmt.Sprintf("0.0.0.0:%d", HTRACE_WEB_ADDRESS_DEFAULT_PORT), @@ -117,6 +120,7 @@ var DEFAULTS = map[string]string{ HTRACE_NUM_HRPC_HANDLERS: "20", HTRACE_HRPC_IO_TIMEOUT_MS: "60000", HTRACE_LEVELDB_WRITE_BUFFER_SIZE: "0", + HTRACE_LEVELDB_CACHE_SIZE: fmt.Sprintf("%d", 100 * 1024 * 1024), } // Values to be used when creating test configurations http://git-wip-us.apache.org/repos/asf/incubator-htrace/blob/898eaf8b/htrace-htraced/go/src/org/apache/htrace/htraced/loader.go ---------------------------------------------------------------------- diff --git a/htrace-htraced/go/src/org/apache/htrace/htraced/loader.go b/htrace-htraced/go/src/org/apache/htrace/htraced/loader.go index cb5ada7..5914004 100644 --- a/htrace-htraced/go/src/org/apache/htrace/htraced/loader.go +++ b/htrace-htraced/go/src/org/apache/htrace/htraced/loader.go @@ -115,6 +115,8 @@ func NewDataStoreLoader(cnf *conf.Config) *DataStoreLoader { } } dld.openOpts = levigo.NewOptions() + cacheSize := cnf.GetInt(conf.HTRACE_LEVELDB_CACHE_SIZE) + dld.openOpts.SetCache(levigo.NewLRUCache(cacheSize)) dld.openOpts.SetParanoidChecks(false) writeBufferSize := cnf.GetInt(conf.HTRACE_LEVELDB_WRITE_BUFFER_SIZE) if writeBufferSize > 0 {
