Skip to content
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

Adjustments to container logging to address concerns from #262 #264

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

portante
Copy link

There are two commits in this PR:


Move WRITEV_BUFFER_N_IOV to src/ctr_logging.c

The WRITEV_BUFFER_N_IOV constant is not part of the ctr_logging interface, and is only used internal to src/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 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.

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()`.
@haircommander
Copy link
Collaborator

I opened cri-o/cri-o#5013 to test these changes with the kubernetes e2e and cri-o

@rhatdan
Copy link
Member

rhatdan commented Jun 18, 2021

Seems to be some packaging issues:
/usr/bin/ld: src/ctr_logging.o: in function writev_buffer_init': ctr_logging.c:(.text+0xd5a): undefined reference to ceilf'
/usr/bin/ld: ctr_logging.c:(.text+0xdd9): undefined reference to `ceilf'

Also fmt test is not happy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants