Open ebuildy opened 8 years ago
Hmm... I don't have idea to set limit for reducing CPU usage by this plugin.
How do you think about setting limit by external tools ? Such as https://github.com/matsumoto-r/rcon .
At which end of the pipeline are you trying to limit the message rate?
The Matcher (ie the stuff going INTO rabbitMQ) or the Source (ie the stuff coming OUT of RabbitMQ)?
Theres no simple way to limit the input into RMQ - its based on the rate you're generating events, but it may be possible to rate control the consumption of events from RMQ using some trivial sleeps or other techniques.
I've been having a read; It might be possible to improve performance using message prefetching on the in_amqp source, thereby obtaining messages in batches and performing manual acknowledgements to rabbitmq. I think this might then help reduce the firehose effect from RMQ by ensuring the server knows how many events have been actually processed.
Note; Acknowledgement of proper handling through the fluent workflow is not possible as the underlying service does not make this information avaliable. ( https://github.com/fluent/fluentd/issues/1125 )
How about this....
While we're unable to properly recognise the situation that a given message has been properly handled by the other parts of FluentD (See the issue mentioned above), we could introduce some rudimentary rate control on the consumer and just hope that the rest of the system is operational.
For instance, it may be possible to specify an 'events per second' option on the source which the plugin tries to limit consumption at, perhaps using batch loading once per second rather than streaming...
Not sure if it'll work, but it'd at least reduce the firehose effect...
opinions?
Heres the plan then;
Implement #50 to allow message batching to be configured, and introduce a soft target rate limit which tries to maintain a constant consumption rate over time.
Probably need to consider #48, at least in terms of the documentation as having multi-workers would mean that target-limit either needs to be somehow globally shared or is calcualted per-worker and users need to adjust accordingly.
As I don't want to burn my server (because high CPU), I setup a RabbitMQ in front of fluentd in order to "smooth" rate peaks. Let's say normal rate is 250msgs/s, but peak can be 1000msgs/s.
My problem currently is fluentd is trying to process as fast as it can, then CPU load is increasing terribly, hence my question, is it possible to throttle/limit messages consuming rate?
Many thanks,
Tom