You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Karl Kirch <kk...@wdtinc.com> on 2013/04/24 20:45:52 UTC

Advice on cacheing producers

Is there a best practice on how to handle producer objects for long running apps?

Right now I have an app that is long running and will sit for large stretches of time (days/weeks) with next to none load and then get slammed. In that case I'd like to cache the producer so I don't incur  a hit in creating a producer connection. Is it a problem to keep that producer cached? Or should I create a new producer every batch of messages I send?

Thanks,
Karl

Re: Advice on cacheing producers

Posted by Jun Rao <ju...@gmail.com>.
You don't want to create a new producer for every batch of messages.
Keeping the producer connection open should be fine.

Thanks,

Jun


On Wed, Apr 24, 2013 at 11:45 AM, Karl Kirch <kk...@wdtinc.com> wrote:

> Is there a best practice on how to handle producer objects for long
> running apps?
>
> Right now I have an app that is long running and will sit for large
> stretches of time (days/weeks) with next to none load and then get slammed.
> In that case I'd like to cache the producer so I don't incur  a hit in
> creating a producer connection. Is it a problem to keep that producer
> cached? Or should I create a new producer every batch of messages I send?
>
> Thanks,
> Karl