Skip to content

Conversation

@wmanley
Copy link
Owner

@wmanley wmanley commented Jan 8, 2021

mmap is slower than copying for small buffers. With this commit, if the
size of the buffer is below some threshold we'll use write and read
to payload/depayload. We still use an FD transport in this case though.

I've set the threshold to 100KB, but it is customiseable via the
TMPFILE_MMAP_THRESHOLD environment variable so we can experiment with
different values easily.

This is an alternative to #35.

`mmap` is slower than copying for small buffers.  With this commit, if the
size of the buffer is below some threshold we'll use `write` and `read`
to payload/depayload.  We still use an FD transport in this case though.

I've set the threshold to 100KB, but it is customiseable via the
`TMPFILE_MMAP_THRESHOLD` environment variable so we can experiment with
different values easily.
@wmanley
Copy link
Owner Author

wmanley commented Jan 8, 2021

I couldn't measure any significant performance difference with this change. strace showed that mmap wasn't being used so much, but it didn't affect overall load in any significant way.

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.

1 participant