-
Notifications
You must be signed in to change notification settings - Fork 139
Adjustments to container logging to address concerns from #262 #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The `WRITEV_BUFFER_N_IOV` constant is not part of the `ctr_logging` interface, and is only used internal to `src/ctr_logging.c`.
Address a number of conditions flagged in issue containers#262. The general thrust of this commit is to move closer to a one-to-one, `read(2)` system call to `writev(2)` system call ratio by creating a memory buffer for reading sized to match the stdio pipes. The commit also allocates a maximum number of I/O vectors sized to the read buffer size, calculating 2 I/O vectors per line, defaulting to a target line size of 25 bytes (defined as the constant, `AVG_LOG_LINE_TARGET`). The commit also now allocates the I/O vectors and read buffer memory using `mmap()` so that we don't cross page boundaries for I/O operations. As a result, the commit removes the `STDIO_BUF_SIZE` constance, using `fcntl(F_GETPIPE_SZ)` calls to size all buffers for reading from pipes. The `stdpipe_t` value is now passed to `write_to_remote_consoles()` so that we do not have to play games with pre-/post- byte allocations to buffers.
We don't bother allocating I/O vectors for the journald case, and we make it much more efficient by using a pre-allocated stack variable using `memcpy` only, instead of `strdup()`.
|
I opened cri-o/cri-o#5013 to test these changes with the kubernetes e2e and cri-o |
|
Seems to be some packaging issues: Also fmt test is not happy. |
|
@portante Thank you for raising this - the most of the performance issues in your PR still applies even in the current conmon code base. Are you planning to update your PR? If not, I can create a new one. |
|
Thanks @jnovy, I'll take a stab at updating this PR. We really should consider shedding all this in favor of NOT interpreting the data stream of logs but instead write out what is read from the pipe, deferring its interpretation to when it is read. See cri-o/cri-o#1605. That would both solve the performance problem, while removing the ability of the data stream content to negatively impact the behavior of |
|
@portante Perfect, let me know once it's ready for review. I appreciate your effort. |
There are two commits in this PR:
Move
WRITEV_BUFFER_N_IOVtosrc/ctr_logging.cThe
WRITEV_BUFFER_N_IOVconstant is not part of thectr_logginginterface, and is only used internal tosrc/ctr_logging.c.Match
read(2)buffer size to pipe size.Address a number of conditions flagged in issue #262.
The general thrust of this commit is to move closer to a one-to-one,
read(2)system call towritev(2)system call ratio by creating a memory buffer for reading sized to match the stdio pipes.The commit also allocates a maximum number of I/O vectors sized to the read buffer size, calculating 2 I/O vectors per line, defaulting to a target line size of 25 bytes (defined as the constant,
AVG_LOG_LINE_TARGET).The commit also now allocates the I/O vectors and read buffer memory using
mmap()so that we don't cross page boundaries for I/O operations.As a result, the commit removes the
STDIO_BUF_SIZEconstance, usingfcntl(F_GETPIPE_SZ)calls to size all buffers for reading from pipes.The
stdpipe_tvalue is now passed towrite_to_remote_consoles()so that we do not have to play games with pre-/post- byte allocations to buffers.