druid icon indicating copy to clipboard operation
druid copied to clipboard

[Performance] will a decompressed bytebuffer cache help?

Open litao91 opened this issue 7 years ago • 6 comments

The flame-graph sampled from our production cluster shows that a large portion of CPU time has spent on LZ4Decompression (probably 60%+ of all querying related methods), as shown in the following picture.

image

I wonder would a (probably on disk) LRUCache on de-compressed data help?

It seems it would not be hard to implement. A, say, BufferedGenericIndexd can be created with a generated UUID, and then we can use <uuid>-bufferNumber as the cache key.

But I'm not sure about the effectiveness. It does introduce extra cost of cache miss penalty, random disk IO, etc.

That's why I would like to raise a discussion here and find out is it a feasible solution.

Thanks

litao91 avatar Jun 18 '19 12:06 litao91

I'm not familiar with this profiler. How certain are you the time is spent in the decompression logic vs waiting for page cache to load from disk?

drcrallen avatar Jun 18 '19 16:06 drcrallen

An alternative to this would be to just leave the data uncompressed (which is supported at indexing time currently), then let the kernel manage the page cache on its own. That way we wouldn't need to do special buffer handling.

drcrallen avatar Jun 18 '19 16:06 drcrallen

An alternative to this would be to just leave the data uncompressed (which is supported at indexing time currently), then let the kernel manage the page cache on its own. That way we wouldn't need to do special buffer handling.

This is the only way that really makes sense to do what is suggested in the issue to me, unless I'm missing something.

clintropolis avatar Jun 18 '19 19:06 clintropolis

agree with @drcrallen on just keeping data uncompressed if you have more memory to spare, page cache would itself be effective cache.

himanshug avatar Jun 19 '19 03:06 himanshug

Thanks guys. It seems I need more investigation and evidence before dive into implementation.

litao91 avatar Jun 25 '19 02:06 litao91

@litao91 Hi can you tell what was your resolution? We see same issue (in my case using visualvm on historical process) Have you disabled compression to solve this bottleneck?

IgorBerman avatar Mar 13 '24 15:03 IgorBerman