--cache not work


i am running cockroach on CENTOS 7.2, just 1 node, insecure mode.
i have setup cache size to 2G, but it not work.

cockroach version info:

Build Tag: v1.0.4
Build Time: 2017/07/27 17:54:36
Distribution: CCL
Platform: linux amd64
Go Version: go1.8.3
C Compiler: gcc 6.3.0
Build SHA-1: 5b757262d33d814bda1deb2af20161a1f7749df3
Build Type: release

@jorise The --cache flag controls the amount of data in the RocksDB block cache, but this sizing isn’t precise. The memory for the RocksDB block cache is allocated using malloc and there is always a bit of slop between the inuse memory and the memory malloc has requested from the OS. Additionally, the RocksDB block cache is not the only usage of memory. See https://www.cockroachlabs.com/blog/memory-usage-cockroachdb/ for additional details. The TL;DR? is that a node with a resident set size of 2.6 GiB when the cache is configured at 2 GiB is reasonable.

I imagine over time we’ll provide better controls over memory usage.

Also what Peter forgot to mention is that CockroachDB allocates memory for other things besides the RocksDB cache. For example SQL memory (--max-sql-memory), and many internal data structures.