* Using io_splice for reading from EventMachine TCP socket
@ 2010-12-27 13:07 Iñaki Baz Castillo
2010-12-27 14:17 ` Iñaki Baz Castillo
0 siblings, 1 reply; 4+ messages in thread
From: Iñaki Baz Castillo @ 2010-12-27 13:07 UTC (permalink / raw)
To: ruby.io.splice
Hi, I posted this question in EventMachine maillist with no success,
so let me try here :)
M EM application (TCP/UDP server) receives messages with long
bodies and I want to copy such bodies into filesystem files. Instead
of using FileUtils.cp or FileUtils.copy_stream (which AFAIK copy the
file in user space) I would like to try io_splice which performs
the copy at kernel level (faster).
My question is: is it possible with EM? I expect I just need the
socket file descriptor in which EM receives the data but the API
provided by EM::Connection doesn't seem to offer such file descriptor.
Thanks a lot.
--
Iñaki Baz Castillo
<ibc@aliax.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Using io_splice for reading from EventMachine TCP socket
2010-12-27 13:07 Using io_splice for reading from EventMachine TCP socket Iñaki Baz Castillo
@ 2010-12-27 14:17 ` Iñaki Baz Castillo
2010-12-27 16:22 ` Eric Wong
0 siblings, 1 reply; 4+ messages in thread
From: Iñaki Baz Castillo @ 2010-12-27 14:17 UTC (permalink / raw)
To: ruby.io.splice
2010/12/27 Iñaki Baz Castillo <ibc@aliax.net>:
> Hi, I posted this question in EventMachine maillist with no success,
> so let me try here :)
>
> M EM application (TCP/UDP server) receives messages with long
> bodies and I want to copy such bodies into filesystem files. Instead
> of using FileUtils.cp or FileUtils.copy_stream (which AFAIK copy the
> file in user space) I would like to try io_splice which performs
> the copy at kernel level (faster).
>
> My question is: is it possible with EM? I expect I just need the
> socket file descriptor in which EM receives the data but the API
> provided by EM::Connection doesn't seem to offer such file descriptor.
By inspecting EM code such feature is not offered at API level so I've
created a patch:
https://github.com/eventmachine/eventmachine/pull/144
Regards.
--
Iñaki Baz Castillo
<ibc@aliax.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: Using io_splice for reading from EventMachine TCP socket
2010-12-27 14:17 ` Iñaki Baz Castillo
@ 2010-12-27 16:22 ` Eric Wong
2010-12-27 16:58 ` Iñaki Baz Castillo
0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2010-12-27 16:22 UTC (permalink / raw)
To: ruby.io.splice
Iñaki Baz Castillo <ibc@aliax.net> wrote:
> > My question is: is it possible with EM? I expect I just need the
> > socket file descriptor in which EM receives the data but the API
> > provided by EM::Connection doesn't seem to offer such file descriptor.
>
> By inspecting EM code such feature is not offered at API level so I've
> created a patch:
>
> https://github.com/eventmachine/eventmachine/pull/144
Actually, io_splice doesn't require integer FDs anymore, it can take IO
objects. I've updated the example on the website (it was in git, but
never pushed up).
--
Eric Wong
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: Using io_splice for reading from EventMachine TCP socket
2010-12-27 16:22 ` Eric Wong
@ 2010-12-27 16:58 ` Iñaki Baz Castillo
0 siblings, 0 replies; 4+ messages in thread
From: Iñaki Baz Castillo @ 2010-12-27 16:58 UTC (permalink / raw)
To: ruby.io.splice
2010/12/27 Eric Wong <normalperson@yhbt.net>:
> Actually, io_splice doesn't require integer FDs anymore, it can take IO
> objects. I've updated the example on the website (it was in git, but
> never pushed up).
Great :)
--
Iñaki Baz Castillo
<ibc@aliax.net>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-12-27 16:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-27 13:07 Using io_splice for reading from EventMachine TCP socket Iñaki Baz Castillo
2010-12-27 14:17 ` Iñaki Baz Castillo
2010-12-27 16:22 ` Eric Wong
2010-12-27 16:58 ` Iñaki Baz Castillo
Code repositories for project(s) associated with this public inbox
https://yhbt.net/ruby_io_splice.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).