<div dir="ltr">Hi Marian,<div>Thank you for the prompt response. I do understand that the overhead of encryption actually shadows the memory overhead involved, but still lost cycles are lost cycles. And these cycles might have been used by other logic (in the end of the day, the application does much more than send and receive). After-all, writev was invented for a specific reason.</div><div>Anyhow, even the temporary buffer solution is problematic. My application might use thousands of sockets. And since I don't want to allocate a buffer per socket, I will have no recourse but to re-use a small amount of buffers (perhaps one per thread), and to re-create the buffer content after every socket blocking condition. You might argue that this is negligible as well as blocking condition is relatively rare, but still these are extra wasted cycles.</div><div>Anyhow, if there isn't any other viable solution,  temporary buffer it is.</div><div><br></div><div>Regards,</div><div>Eran</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 2, 2020 at 5:47 PM Marian Beermann <<a href="mailto:public@enkore.de">public@enkore.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Creating a temporary buffer and then consolidating the<br>
> vector is a problem because of the performance cost associated with<br>
> memory copy.<br>
<br>
Did you actually benchmark this or do you just think this is the case?<br>
Consider that SSL_write/read will normally do something like AES or<br>
Chapoly on your CPU at a throughput of 2-4 GB/s, which is about an order<br>
of magnitude slower than streaming memory throughput.<br>
<br>
-Marian<br>
<br>
Am 02.02.20 um 15:27 schrieb Eran Borovik:<br>
> Hi all,<br>
> I am in the process of integrating OpenSSL with my application. My<br>
> application uses scatter-gather unencrypted buffers. Without OpenSSL, I<br>
> would use writev with no issues. Is there a way to do the equivalent<br>
> over OpenSSL? I understand that I can split the vector into multiple<br>
> SSL_write/SSL_read operations but that defeats the purpose and has a<br>
> large overhead. Creating a temporary buffer and then consolidating the<br>
> vector is a problem because of the performance cost associated with<br>
> memory copy.<br>
> Is there a clean way to achieve this without the performance overhead.<br>
> Perhaps dealing with BIOs directly?<br>
> <br>
> Many thanks,<br>
> Eran<br>
<br>
</blockquote></div>