pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcap/+/42015?usp=email )
Change subject: server: wr_file: Request up to 8 iofd write buffers if available ......................................................................
server: wr_file: Request up to 8 iofd write buffers if available
Writing to disk is usually slower than handling network traffic, so it's a desirable to increase write buffers to try to submit our write queue to the kernel/VFS as fast as possible, to avoid it growing too much. This should also improve CPU use at the expense of some dozen KBs of extra use, which in the server should be plenty available.
Using up to 8 buffer sounds like a good start, being it a good compromise between memory requirements and batching of msgbs. It also turns outs it's the maximum amount of buffers allowed by osmo_io current implementation ;)
Depends: libosmocore.git 378cf564c8859311415aa70adeb220cedbe56eb3 Change-Id: I167e5f9b7f9d5693b3df05f713288c741031c532 --- M TODO-RELEASE M src/osmo_pcap_wr_file.c 2 files changed, 8 insertions(+), 0 deletions(-)
Approvals: daniel: Looks good to me, but someone else must approve Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved
diff --git a/TODO-RELEASE b/TODO-RELEASE index 0ed7189..b52b9a8 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,3 +7,4 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line +libosmocore >1.12.1 osmo_iofd_set_io_buffers(..., 0) returning maximum available write buffer value. diff --git a/src/osmo_pcap_wr_file.c b/src/osmo_pcap_wr_file.c index d60c5a7..3510c59 100644 --- a/src/osmo_pcap_wr_file.c +++ b/src/osmo_pcap_wr_file.c @@ -125,7 +125,14 @@ &ioops, wrf); if (!wrf->local_iofd) return -EBADFD; + osmo_iofd_set_txqueue_max_length(wrf->local_iofd, wrf->wr_queue_max_length); + + /* Request to use 8 write buffers, or less if not as many are available: */ + rc = osmo_iofd_set_io_buffers(wrf->local_iofd, OSMO_IO_OP_WRITE, 0); + if (rc > 0) + osmo_iofd_set_io_buffers(wrf->local_iofd, OSMO_IO_OP_WRITE, OSMO_MIN(rc, 8)); + if (osmo_iofd_register(wrf->local_iofd, -1) < 0) { osmo_iofd_free(wrf->local_iofd); wrf->local_iofd = NULL;