sendfile to nonblocking socket

2007-04-25 Thread A.D.F.
Answer to Alex Vorona (I'm not subscribed to linux kernel list so CC me). Serious answers to an almost troll question (no offence here :-). 1) The possibility that sendfiles blocks, when it has to wait for disk reads / pages, has been repeatedly mentioned (and thus known) for ages by

sendfile to nonblocking socket

2007-04-25 Thread A.D.F.
Answer to Alex Vorona (I'm not subscribed to linux kernel list so CC me). Serious answers to an almost troll question (no offence here :-). 1) The possibility that sendfiles blocks, when it has to wait for disk reads / pages, has been repeatedly mentioned (and thus known) for ages by

RE: Re[2]: sendfile to nonblocking socket

2007-04-24 Thread David Schwartz
> DS> Threads plus epoll is another. > 20k threads and maybe more is too much :). Look at http://nginx.net/ > senction "Architecture and scalability" for example. > DS> It really depends upon how much performance you need > all, that hardware can take and hold :) Why would you want 20k threads?

Re: Re[2]: sendfile to nonblocking socket

2007-04-24 Thread Eric Dumazet
On Tue, 24 Apr 2007 14:33:48 +0400 Alex Vorona <[EMAIL PROTECTED]> wrote: > Hello David, > > Tuesday, April 24, 2007, 1:19:49 PM, you wrote: > > >> sendfile function is not just a more efficient version of a read > >> followed by a write. It reads from one fd and write to another at tha > >>

Re[2]: sendfile to nonblocking socket

2007-04-24 Thread Alex Vorona
Hello David, Tuesday, April 24, 2007, 1:19:49 PM, you wrote: >> sendfile function is not just a more efficient version of a read >> followed by a write. It reads from one fd and write to another at tha >> same time. Please try to read 2G, and then write 2G - and how much >> memory you will be

RE: sendfile to nonblocking socket

2007-04-24 Thread David Schwartz
> David Schwartz пишет: > > You have a misunderstanding about the semantics of 'sendfile'. > The 'sendfile' function is just a more efficient version of a > read followed by a write. If you did a read followed by a write, > it would block as well (in the read). > > > > DS > sendfile function

RE: sendfile to nonblocking socket

2007-04-24 Thread David Schwartz
David Schwartz пишет: You have a misunderstanding about the semantics of 'sendfile'. The 'sendfile' function is just a more efficient version of a read followed by a write. If you did a read followed by a write, it would block as well (in the read). DS sendfile function is not just

Re[2]: sendfile to nonblocking socket

2007-04-24 Thread Alex Vorona
Hello David, Tuesday, April 24, 2007, 1:19:49 PM, you wrote: sendfile function is not just a more efficient version of a read followed by a write. It reads from one fd and write to another at tha same time. Please try to read 2G, and then write 2G - and how much memory you will be need

Re: Re[2]: sendfile to nonblocking socket

2007-04-24 Thread Eric Dumazet
On Tue, 24 Apr 2007 14:33:48 +0400 Alex Vorona [EMAIL PROTECTED] wrote: Hello David, Tuesday, April 24, 2007, 1:19:49 PM, you wrote: sendfile function is not just a more efficient version of a read followed by a write. It reads from one fd and write to another at tha same time.

RE: Re[2]: sendfile to nonblocking socket

2007-04-24 Thread David Schwartz
DS Threads plus epoll is another. 20k threads and maybe more is too much :). Look at http://nginx.net/ senction Architecture and scalability for example. DS It really depends upon how much performance you need all, that hardware can take and hold :) Why would you want 20k threads? You

Re: sendfile to nonblocking socket

2007-04-23 Thread Alex Vorona
David Schwartz пишет: You have a misunderstanding about the semantics of 'sendfile'. The 'sendfile' function is just a more efficient version of a read followed by a write. If you did a read followed by a write, it would block as well (in the read). DS sendfile function is not just a more

Re: sendfile to nonblocking socket

2007-04-23 Thread Alex Vorona
David Miller wrote: From: voron <[EMAIL PROTECTED]> Date: Tue, 24 Apr 2007 00:13:27 +0300 As I see, nonblocking mode is enabled - sendfile sends less than asked. The socket is marked as non-blocking, but the disk I/O is not. It's blocking on the disk I/O not the socket part of the

RE: sendfile to nonblocking socket

2007-04-23 Thread David Schwartz
ndfile block on > nonblocking socket has place only when I'm using network connection, > that is faster than my hard disk, for example gigabit NIC or localhost. > When I use 100Mbit NIC, which is slower, than my hard disk, I got small > and fast sendfile calls without blocking. > > My k

Re: sendfile to nonblocking socket

2007-04-23 Thread David Miller
From: voron <[EMAIL PROTECTED]> Date: Tue, 24 Apr 2007 00:13:27 +0300 > As I see, nonblocking mode is enabled - sendfile sends less than asked. The socket is marked as non-blocking, but the disk I/O is not. It's blocking on the disk I/O not the socket part of the operation. - To unsubscribe

sendfile to nonblocking socket

2007-04-23 Thread voron
Hello I'm testing a web server nginx for films sharing in my LAN. And I've got some interesting results. When I tried to download film or another big file via gigabit link, I've got sendfile block with nonblocking socket. Strace log in attach. Some commens #enabling nonblock on fd 3 20:51

sendfile to nonblocking socket

2007-04-23 Thread voron
Hello I'm testing a web server nginx for films sharing in my LAN. And I've got some interesting results. When I tried to download film or another big file via gigabit link, I've got sendfile block with nonblocking socket. Strace log in attach. Some commens #enabling nonblock on fd 3 20:51

Re: sendfile to nonblocking socket

2007-04-23 Thread David Miller
From: voron [EMAIL PROTECTED] Date: Tue, 24 Apr 2007 00:13:27 +0300 As I see, nonblocking mode is enabled - sendfile sends less than asked. The socket is marked as non-blocking, but the disk I/O is not. It's blocking on the disk I/O not the socket part of the operation. - To unsubscribe from

RE: sendfile to nonblocking socket

2007-04-23 Thread David Schwartz
As I see, nonblocking mode is enabled - sendfile sends less than asked. But 2G via single 30 seconds sendfile call - this is blocking call. How can I avoid that? I prefer sendfile as fastest way to send file content to network socket. The problem with sendfile block on nonblocking

Re: sendfile to nonblocking socket

2007-04-23 Thread Alex Vorona
David Miller wrote: From: voron [EMAIL PROTECTED] Date: Tue, 24 Apr 2007 00:13:27 +0300 As I see, nonblocking mode is enabled - sendfile sends less than asked. The socket is marked as non-blocking, but the disk I/O is not. It's blocking on the disk I/O not the socket part of the

Re: sendfile to nonblocking socket

2007-04-23 Thread Alex Vorona
David Schwartz пишет: You have a misunderstanding about the semantics of 'sendfile'. The 'sendfile' function is just a more efficient version of a read followed by a write. If you did a read followed by a write, it would block as well (in the read). DS sendfile function is not just a more