Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] when we need to transfer data between file and socket we prefer to use sendfile instead of write because we save the copy to a buffer

Maxim Dounin
April 18, 2019 09:08AM
Hello!

On Thu, Apr 18, 2019 at 10:32:56AM +0300, ben ben ishay wrote:

> # HG changeset patch
> # User ben ben ishay <benishay@mellanox.com>
> # Date 1555572726 -10800
> # Thu Apr 18 10:32:06 2019 +0300
> # Node ID bb4c564a9f1c5c721c192e6188967c19aabbc0b9
> # Parent a6e23e343081b79eb924da985a414909310aa7a3
> when we need to transfer data between file and socket we prefer to use sendfile instead of write because we save the copy to a buffer.
> the use of sendfile is possible in openssl only if it support ktls(the master of openssl support ktls) otherwise there is a copy of the data to userspace for encryption in any case (this paper explain this https://netdevconf.org/1.2/papers/ktls.pdf ).
> the patch change the flow when the request is to send data over ssl and also the nginx use openssl that support ktls, the new flow using the sendfile function that tcp use for send data (ngx_linux_sendfile_chain).
> the performence with this patch applied was check with apib benchmark(this is the source https://github.com/apigee/apib),one machine run nginx and the other machine that connect back to back to the first one run apib with this comand: ./apib -c <num of connection> -d 30 https://<ip address>/<file name to send>.
> the file size was 100K.
>
> the result display in this table , each value represnt average throughput in GBps of 10 runs.
>
> num of connection | regular nginx | new nginx
> 1 5 5.2
> 2 7.5 8.5
> 3 7.7 9
>
> this result prove that this patch increase nginx performance and thus is useful.

In no particular order:

- Please read http://nginx.org/en/docs/contributing_changes.html for
basic tips on how to submit patches. In particular, please make
sure to follow nginx coding style.

- Note well that at least one bug in your code is directly related
to incorrect indentation and failure to properly use curly
brackets as explicitly required by the coding style. The style
is there to prevent such accidental bugs.

- When you update your patches based on the feedback given,
consider replying to the thread in question instead of
posting a new thread. If for some reason you think a new thread
will be better, describe these reasons and post a reference to
the old thread. Also, make sure to describe changes you've
made based on the feedback.

- The SSL_sendfile() call you are using in this version does not
seem to exists in any published version of OpenSSL, including
github repo. This is not going to work.

- The approach you are using - that is, introducing changes into
ngx_linux_sendfile_chain.c - is not portable, and is not going
to work on other platforms if/when appropriate kernel level and
OpenSSL level support will be available. As suggested in the
previous thread, this should be something handled at the
ngx_event_openssl.c level.

[...]

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] when we need to transfer data between file and socket we prefer to use sendfile instead of write because we save the copy to a buffer

ben ben ishay 1485 April 18, 2019 03:34AM

Re: [PATCH] when we need to transfer data between file and socket we prefer to use sendfile instead of write because we save the copy to a buffer

Maxim Dounin 459 April 18, 2019 09:08AM

FW: [PATCH] when we need to transfer data between file and socket we prefer to use sendfile instead of write because we save the copy to a buffer

Ben Ben Ishay 498 May 06, 2019 02:04AM

Re: FW: [PATCH] when we need to transfer data between file and socket we prefer to use sendfile instead of write because we save the copy to a buffer

Maxim Dounin 468 May 06, 2019 10:32AM

Re: FW: [PATCH] when we need to transfer data between file and socket we prefer to use sendfile instead of write because we save the copy to a buffer

Maxim Dounin 599 May 13, 2019 09:04AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 270
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready