go-redis: high memory usage + solution
Hi,
I noticed that the memory usage was very high in my project.
I did a memory profiling with inuse_space, and 90% of my memory is used by go-redis in WriteBuffer.
If I understand correctly, each connection in the pool has its own WriteBuffer.
My projects runs 80 goroutines (on 8 CPUs) and each goroutine SET Redis keys.
My Redis keys are large: several MB. (less than 100 MB)
So, it’s very easy to understand why the memory usage is very high.
I think I have a solution, but it requires changes in go-redis internals.
We could use a global sync.Pool of WriteBuffer instead.
WDYT ?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 24 (10 by maintainers)
Here is a quick POC: