feat(writer): the RollingFileWriter closes files in background when concurrency is set#1571
Conversation
…oncurrency is set Improve the RollingFileWriter close files in the background, improving performance by allowing writes to continue without waiting for the previous file to be fully closed. Key changes: - A JoinSet of all closing futures is now used to manage background closing tasks. - When rolling over, the writer spawns a task to close the previous file and immediately starts writing to a new one. - The close method now waits for all background tasks to complete before returning. - Concurrency can be configured via a parameter to control how many files are closed in parallel.
522c786 to
c7d051c
Compare
c7d051c to
377674b
Compare
|
Thanks @fvaleye for this pr, but I don't think we should do this now. As I said in previous discussion, such kind of optimization typically consumes more memory since an unclosed writer will hold memory in it. This optimization make things difficult to predict and manage when integrated with compute engine. |
Thanks for your feedback @liurenjie1024 ! |
Which issue does this PR close?
RollingFileWriterby closing asynchronously #1551What changes are included in this PR?
My general approach:
max_concurrent_closesto prevent memory exhaustion. By default, the default behavior is kept by having only one background task running.close()The main idea suggested by the issue is to improve the
RollingFileWriterto close files in the background, improving performance by allowing writes to continue without waiting for the previous file to be fully closed.Key changes:
Are these changes tested?
Yes, with unit-testing and local benchmark tests