file.d
file.d copied to clipboard
Feature: new eventPool based on sync.Pool
Proposal of the new events pool based on sync.Pool
Current events pool implementation has o problem with too high memory consuption: current reset mechanism does not account for actual memory usage, instead we use AvgEventSize from the config, but actual event size may be different, depends on current server load.
Instead, I propose use sync.Pool for events. New implementation should also implement capacity logic and slow wait when capacity exceeded. Also, we should support two different pools implementations (old and new) for gradual migration if case of new implementation corner cases.