[PATCH] net/pcap: reduce time for stopping device
Stephen Hemminger
stephen at networkplumber.org
Wed Aug 31 18:42:19 CEST 2022
On Mon, 29 Aug 2022 11:50:29 +0000
"Zhou, YidingX" <yidingx.zhou at intel.com> wrote:
> I draw a diagram to describe it more clearly
>
> fwrite fclose/fflush fclose/fdatasync
> --------->| libc buffer |----------------> | disk cache in RAM |---------------------> |disk|
> | 4096 Bytes | | size is determined by OS | | |
>
> When the libc buffer is full, the system will automatically sync it to the disk cache.
> It is easily full as it's only 4096 B size. so there is no need to call 'fflush()' every time.
> The real time consuming action is syncing the disk cache to disk.
> Because the disk cache is very large, it will take a long time to sync all at one time during 'fclose()',
> so need to call 'fdatasync()' periodically to amortize the time.
If you want to speed up this, then get rid of stdio and use a faster
API like io_uring. What you tried can help but using a better API
would make bigger gains.
More information about the dev
mailing list