From: "David Schwartz" <davids@webmaster.com>
To: "Alex Vorona" <voron@amhost.net>, <linux-kernel@vger.kernel.org>
Subject: RE: Re[2]: sendfile to nonblocking socket
Date: Tue, 24 Apr 2007 12:19:08 -0700 [thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKCEGNDEAC.davids@webmaster.com> (raw)
In-Reply-To: <1211570752.20070424143348@amhost.net>
> 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 aren't seriously suggesting that you
need to have 20,000 outstanding disk operations, are you? Surely you don't
think that would be efficient. If the disk is the limiting factor, it may
get slightly faster as you pend more concurrent requests, but surely 20,000
is not the best number! (256 is probably closer to the optimal value, and it
may be less.)
Your application has to manage the outstanding disk read requests. I don't
know of any way to foist this task on the kernel. Perhaps a pool of disk
read threads?
I would keep a flag for each connection to track whether the last write got
a 'would block' or was incomplete. So long as this flag is clear, let the
disk read thread attempt the socket 'write'. If the disk read thread gets a
partial write (or a would block indication), set the flag on the socket and
let the socket I/O threads takeover the connection (based on 'epoll'
notification). When a write completes and you need more disk data, clear the
flag and let the disk read threads takeover the connection until a write
blocks again. (This disk read threads can use 'sendfile' or 'splice' so long
as they don't block on the socket.)
Perhaps the disk read threads should be using 'mmap' with MAP_POPULATE.
There are certainly many possible approaches.
DS
prev parent reply other threads:[~2007-04-24 19:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-23 21:13 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
2007-04-24 10:33 ` Re[2]: " Alex Vorona
2007-04-24 12:48 ` Eric Dumazet
2007-04-24 19:19 ` David Schwartz [this message]
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=MDEHLPKNGKAHNMBLJOLKCEGNDEAC.davids@webmaster.com \
--to=davids@webmaster.com \
--cc=linux-kernel@vger.kernel.org \
--cc=voron@amhost.net \
/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
all inboxes | Powered by JetHome®