我试图找出为什么我的卡夫卡流应用程序运行内存不足。我已经发现了rocksDB会消耗大量的本机内存,我试图用下面的配置限制它:
# put index and filter blocks in blockCache to avoid letting them grow unbounded (https://github.com/facebook/rocksdb/wiki/Block-Cache#caching-index-and-filter-blocks)
cache_index_and_filter_blocks = true;
# avoid evicting L0 cache of filter and index blocks to reduce performance impact of putting them in the blockCache (https://github.com/facebook/rocksdb/wiki/Block-Cache#caching-index-and-filter-blocks)
pinL0FilterAndIndexBlocksInCache=true
# blockCacheSize should be 1/3 of total memory available (https://github.com/facebook/rocksdb/wiki/Setup-Options-and-Basic-Tuning#block-cache-size)
blockCacheSize=1350 * 1024 * 1024
# use larger blockSize to reduce index block size (https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide#difference-of-spinning-disk)
blockSize=256 * 1024
但还是内存使用率似乎无限地增长,我的容器最终被OOMKilled。
我用jemalloc来剖析内存使用(就像这里描述),结果清楚地表明,rocksDB负责,但我不知道如何来进一步限制rocksDB的内存使用情况。
我不知道这是否是有用的,但为了完整性这里是从正在运行的rocksdb实例收集的统计数据:
我很高兴的任何提示
我发现了什么是造成这一点。
我认为我的卡夫卡流应用程序将只有一个rockDB实例。但有一个实例每个流分区。所以这个配置:
blockCacheSize=1350 * 1024 * 1024
并不一定意味着rocksDB内存限制为1350MB。如果应用程序具有分配它例如8流的分区也具有8个blockCaches并且因此可能需要多达1350×8 =〜11GB的存储器。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句