You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flume.apache.org by Loic Descotte <lo...@gmail.com> on 2015/01/28 17:39:41 UTC
Non blocking IO using Flume client
Hi all,
I'm using Flume and I'd like to send messages in an asynchronous way,
without consuming (or blocking) too many threads.
Is there a way to call Flume in a non blocking IO way, with Thrift or
with Avro client?
Looking at this class (on the old Cloudera repository) it seems
possible, but the "nonBlocking" flag is set to false by default :
https://github.com/cloudera/flume/blob/master/flume-core/src/main/java/com/cloudera/flume/handlers/thrift/ThriftEventSink.java
Do you know how to achieve this?
Thanks, best regards
Loïc
Re: Non blocking IO using Flume client
Posted by Loic Descotte <lo...@gmail.com>.
Hi Bhaskar,
It could be a good solution, thanks :)
Le 29/01/2015 16:00, Bhaskar V. Karambelkar a écrit :
> Loic,
> One thing you can do is write data to a queue (say Redis) using a non
> blocking client, and use a redis source to feed to flume. That'll give
> you non blocking push operations on the client side. It does add
> another component to the mix however.
> We do something similar, and it scales quite well.
>
> On Thu, Jan 29, 2015 at 1:45 AM, Loic Descotte
> <loic.descotte@gmail.com <ma...@gmail.com>> wrote:
>
> Thanks for the link, I'll take a look.
>
> 2015-01-29 7:43 GMT+01:00 Hari Shreedharan
> <hshreedharan@cloudera.com <ma...@cloudera.com>>:
>
> In your case, you'd end up having too many threads - that is
> right. I don't know if there is anything you can do right now
>
> The interesting thing is that the underlying Flume Avro RPC
> client is actually non-blocking. It is exposed as a blocking
> client for ease of use. Also, there is a bug in Avro that can
> cause the client to block during an initial handshake -
> https://issues.apache.org/jira/browse/AVRO-1122
>
> For now, I am not sure what we can do. But if you do happen to
> have some time, please take a look!
>
>
> Hari
>
> On Wed, Jan 28, 2015 at 10:35 PM, Loic Descotte
> <loic.descotte@gmail.com <ma...@gmail.com>> wrote:
>
> Of course this kind of problem can always be solved on the
> server side, but it would be better be able to handle
> latency with non blocking IO on the client. In particular
> if you are working with asynchronous web frameworks like
> Play Framework (or Spray.io) that work better with a low
> number of threads.
>
>
>
>
>
>
> --
> Loïc Descotte
> http://about.me/loicd
>
>
Re: Non blocking IO using Flume client
Posted by "Bhaskar V. Karambelkar" <bh...@gmail.com>.
Loic,
One thing you can do is write data to a queue (say Redis) using a non
blocking client, and use a redis source to feed to flume. That'll give you
non blocking push operations on the client side. It does add another
component to the mix however.
We do something similar, and it scales quite well.
On Thu, Jan 29, 2015 at 1:45 AM, Loic Descotte <lo...@gmail.com>
wrote:
> Thanks for the link, I'll take a look.
>
> 2015-01-29 7:43 GMT+01:00 Hari Shreedharan <hs...@cloudera.com>:
>
>> In your case, you'd end up having too many threads - that is right. I
>> don't know if there is anything you can do right now
>>
>> The interesting thing is that the underlying Flume Avro RPC client is
>> actually non-blocking. It is exposed as a blocking client for ease of use.
>> Also, there is a bug in Avro that can cause the client to block during an
>> initial handshake - https://issues.apache.org/jira/browse/AVRO-1122
>>
>> For now, I am not sure what we can do. But if you do happen to have some
>> time, please take a look!
>>
>>
>> Hari
>>
>> On Wed, Jan 28, 2015 at 10:35 PM, Loic Descotte <lo...@gmail.com>
>> wrote:
>>
>>> Of course this kind of problem can always be solved on the server side,
>>> but it would be better be able to handle latency with non blocking IO on
>>> the client. In particular if you are working with asynchronous web
>>> frameworks like Play Framework (or Spray.io) that work better with a low
>>> number of threads.
>>>
>>>
>>
>>
>
>
> --
> Loïc Descotte
> http://about.me/loicd
>
Re: Non blocking IO using Flume client
Posted by Loic Descotte <lo...@gmail.com>.
Thanks for the link, I'll take a look.
2015-01-29 7:43 GMT+01:00 Hari Shreedharan <hs...@cloudera.com>:
> In your case, you'd end up having too many threads - that is right. I
> don't know if there is anything you can do right now
>
> The interesting thing is that the underlying Flume Avro RPC client is
> actually non-blocking. It is exposed as a blocking client for ease of use.
> Also, there is a bug in Avro that can cause the client to block during an
> initial handshake - https://issues.apache.org/jira/browse/AVRO-1122
>
> For now, I am not sure what we can do. But if you do happen to have some
> time, please take a look!
>
>
> Hari
>
> On Wed, Jan 28, 2015 at 10:35 PM, Loic Descotte <lo...@gmail.com>
> wrote:
>
>> Of course this kind of problem can always be solved on the server side,
>> but it would be better be able to handle latency with non blocking IO on
>> the client. In particular if you are working with asynchronous web
>> frameworks like Play Framework (or Spray.io) that work better with a low
>> number of threads.
>>
>>
>
>
--
Loïc Descotte
http://about.me/loicd
Re: Non blocking IO using Flume client
Posted by Hari Shreedharan <hs...@cloudera.com>.
In your case, you'd end up having too many threads - that is right. I don't
know if there is anything you can do right now
The interesting thing is that the underlying Flume Avro RPC client is
actually non-blocking. It is exposed as a blocking client for ease of use.
Also, there is a bug in Avro that can cause the client to block during an
initial handshake - https://issues.apache.org/jira/browse/AVRO-1122
For now, I am not sure what we can do. But if you do happen to have some
time, please take a look!
Hari
On Wed, Jan 28, 2015 at 10:35 PM, Loic Descotte <lo...@gmail.com>
wrote:
> Of course this kind of problem can always be solved on the server side,
> but it would be better be able to handle latency with non blocking IO on
> the client. In particular if you are working with asynchronous web
> frameworks like Play Framework (or Spray.io) that work better with a low
> number of threads.
>
>
Re: Non blocking IO using Flume client
Posted by Loic Descotte <lo...@gmail.com>.
In fact I can't really achieve a similar effect with threads and futures in
a blocking mode. I'm using a Flume (RPC) client in a tomcat web service. If
there is a lot of user requests and if our Flume server is too slow to
respond, the number of threads is growing too much and it can cause
performance issues on the web service.
Of course this kind of problem can always be solved on the server side, but
it would be better be able to handle latency with non blocking IO on the
client. In particular if you are working with asynchronous web frameworks
like Play Framework (or Spray.io) that work better with a low number of
threads.
Thanks,
Loïc
Le 29 janv. 2015 02:00, "Hari Shreedharan" <hs...@cloudera.com> a
écrit :
>
> Currently, there is no non-blocking Flume client. You can use the
standard threads-futures combination to achieve a similar effect.
>
> Thanks,
> Hari
>
>
> On Wed, Jan 28, 2015 at 8:40 AM, Loic Descotte <lo...@gmail.com>
wrote:
>>
>> Hi all,
>>
>> I'm using Flume and I'd like to send messages in an asynchronous way,
>> without consuming (or blocking) too many threads.
>> Is there a way to call Flume in a non blocking IO way, with Thrift or
>> with Avro client?
>>
>> Looking at this class (on the old Cloudera repository) it seems
>> possible, but the "nonBlocking" flag is set to false by default :
>>
https://github.com/cloudera/flume/blob/master/flume-core/src/main/java/com/cloudera/flume/handlers/thrift/ThriftEventSink.java
>>
>> Do you know how to achieve this?
>>
>> Thanks, best regards
>>
>> Loïc
>>
>
Re: Non blocking IO using Flume client
Posted by Hari Shreedharan <hs...@cloudera.com>.
Currently, there is no non-blocking Flume client. You can use the standard threads-futures combination to achieve a similar effect.
Thanks, Hari
On Wed, Jan 28, 2015 at 8:40 AM, Loic Descotte <lo...@gmail.com>
wrote:
> Hi all,
> I'm using Flume and I'd like to send messages in an asynchronous way,
> without consuming (or blocking) too many threads.
> Is there a way to call Flume in a non blocking IO way, with Thrift or
> with Avro client?
> Looking at this class (on the old Cloudera repository) it seems
> possible, but the "nonBlocking" flag is set to false by default :
> https://github.com/cloudera/flume/blob/master/flume-core/src/main/java/com/cloudera/flume/handlers/thrift/ThriftEventSink.java
> Do you know how to achieve this?
> Thanks, best regards
> Loïc