Flume-ng Spool directory source polling directory for new files instead of using native WatchService API

StackOverflow https://stackoverflow.com/questions/20908050

  •  24-09-2022
  •  | 
  •  

문제

I was digging into the Flume-ng's SpoolingDirectorySource src and found that it polls the spool directory after the specified POLL_DELAY_MS parameter to generate new events. These events are then handled by ReliableSpoolingFileEventReader in a seperate thread.

I was wondering why ReliableSpoolingFileEventReader does not use WatchService API, which is pretty low level as well as thread-safe. Is there any specific design constraint which favored polling over watcher? \

Thanks.

도움이 되었습니까?

해결책

In general, Flume works better with batches of events. This is because the File channel fsyncs for every batch. Thus, waiting for a period of time is a good trade-off to collect a batch of events.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top