From: "A.D.F." <adefacc@tin.it>
To: linux-kernel@vger.kernel.org
Subject: sendfile to nonblocking socket
Date: Wed, 25 Apr 2007 11:41:59 +0000 [thread overview]
Message-ID: <462F3E87.BAA51761@tin.it> (raw)
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 everybody
(including Linus) since kernel 2.2.x;
if you search the archives (mailing lists, etc.)
or just google "sendfile blocking" you'll find a lot of stuff about this
issue.
2) A possible answer, to your implicit request to add real asynchronous
support
to sendfile, is to wait for the general asynchronous support for all
blocking
syscalls (search the kernel archives in the last 3 months).
3) The simplest solution (that works with every OS) is to just pass
a small (*) amount of data to each sendfile() call,
(*) i.e. between 64 KB (very slow disk with DMA disabled)
and 1024 KB (very fast disk).
Of course, if files to be sent are not in page cache and
there are more than 10 - 100 parallel downloads of different files,
you'll see noticeable latencies (because of disk seeks, etc.);
in any case you may want to add a parameter to this nginx thing
to let the tuning of chunk size.
4) As it has already been mentioned by others, there are many good solutions
that can be used right now to allow the required scalability target:
- using threads;
- using asynchronous I/O;
- etc.
5) If you want to use some other Web Server that just works,
look for the alternatives (including lighttpd or even Apache).
--
Nick Name: A.D.F.
E-Mail: <adefacc () tin ! it>
--
next reply other threads:[~2007-04-25 10:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 11:41 A.D.F. [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-04-23 21:13 sendfile to nonblocking socket voron
2007-04-23 21:59 ` David Miller
2007-04-24 4:42 ` Alex Vorona
2007-04-23 22:52 ` David Schwartz
2007-04-24 4:54 ` Alex Vorona
2007-04-24 9:19 ` David Schwartz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=462F3E87.BAA51761@tin.it \
--to=adefacc@tin.it \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox