On Wed, Jan 15, 2020 at 2:34 PM Avi Kivity <avi(a)scylladb.com> wrote:
This is what Seastar provides today and I agree it can
should be improved.
I agree. Let's continue our discussion and try to find the way. :-)
What I propose it:
* WHEN you have a requirement for aligned buffers, use
"application-provided"
* WHEN you do not have a requirement for aligned buffers, use
"stack-provided"
After the applications starts, do you not know whether you have a
requirement for alignment or not?
We have the knowledge on alignment, so let's experiment with
the proposed ruleset to judge performance repercussions.
Today, when crimson-osd is all about the cyan store (simple,
RAM-backed store for testing), we can definitely say there is
no requirement for alignment. Basing on that and the rule:
* WHEN you do not have a requirement for aligned buffers, use
"stack-provided".
Therefore we should opt for "stack-provided". Let's verify
the result:
* if the actual stack is native, everything is OK. There will
be no even single memcpy, no syscall.
* if the actual stack is POSIX, as there is no provided buffer,
there is also no buffer.length. The stack needs to guess
how many bytes read() from the socket. If the guessed
number is too small, the application is hurt by excessive
syscalls. This happens today. :-(
Regards,
Radek