sonic-swss icon indicating copy to clipboard operation
sonic-swss copied to clipboard

Periodic flush record files instead of flushing them on std::endl.

Open mint570 opened this issue 2 years ago • 2 comments

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 avatar May 17 '23 18:05 mint570

@mint570 , @prsunny , this seems like a big improvement. @mint570, can you explain a little more on why such change would have 8% performance improvement?

lguohan avatar Aug 22 '23 08:08 lguohan

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.

mint570 avatar Aug 28 '23 16:08 mint570