You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by Ivan Kelly <iv...@apache.org> on 2018/03/01 14:56:01 UTC

Re: Fine grained control over batching in tests

To answer my own question, batching can be controlled with.

        ProducerConfiguration producerConf = new ProducerConfiguration();
        producerConf.setMaxPendingMessages(10);
        producerConf.setBatchingEnabled(true);
        producerConf.setBatchingMaxMessages(10);
        producerConf.setBatchingMaxPublishDelay(1, TimeUnit.HOURS);

This will produce in batches of 10. The non-determinism I saw was due
to a bug in HashedWheelTimer. I set the delay to Long.MAX_VALUE, which
caused the batching trigger to run in a tight loop
(https://github.com/netty/netty/issues/7760).

-Ivan

On Mon, Feb 26, 2018 at 9:53 PM, Ivan Kelly <iv...@apache.org> wrote:
> Hi folks,
>
> I'd like to do some tests with batching and compaction. So far the
> only way I've found to control batching is by setting
> BatchingMaxMessages and MaxPublishingDelay, but this doesn't seem 100%
> deterministic to me.
>
> Does anyone have a better way to control this, or would it make more
> sense to expose ProducerImpl#batchMessageAndSend() just for tests?
>
> Regards,
> Ivan