sonic-swss
sonic-swss copied to clipboard
Periodic flush record files instead of flushing them on std::endl.
What I did Periodic flush record files instead of flushing them on std::endl.
Why I did it For performance purposes. In our testing, this provides 8% end-to-end performance improvement.
How I verified it
Details if related
@mint570 , @prsunny , this seems like a big improvement. @mint570, can you explain a little more on why such change would have 8% performance improvement?
This PR comes together with https://github.com/sonic-net/sonic-sairedis/pull/1241. There are some discussion there.
Flushing a file is expensive (depending on the FS). The original code flush the file on every write. This PR changes to flush every second (or when the buffer is full). This will increase the performance but the downside is that when the program crashes, we might miss some logs.