Skip to content

Conversation

@merlimat
Copy link
Contributor

Motivation

This PR is based on top of #1450. I'll rebase once first one is merged.

The processing of acknowledgments constitutes is broker a big chunk of CPU work. Even then, we throttle the persistence of acks to BK (default is once per sec).

In addition to that, acknowledgments generates a large number of very small IP packets and these are most expensive to process by OS/NIC (compared to fewer bigger packets).

This change introduces client side batching for acknowledgments. By default client, will group the acks and send out a single protobuf command every 100ms. Consumer can configure the delay, or set it to 0 to fall back to original behavior.

@merlimat merlimat added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Mar 28, 2018
@merlimat merlimat added this to the 2.0.0-incubating milestone Mar 28, 2018
@merlimat merlimat self-assigned this Mar 28, 2018
@merlimat merlimat force-pushed the delayed-acks-impl branch 2 times, most recently from 2165444 to 9d28ea1 Compare March 30, 2018 03:54
@merlimat
Copy link
Contributor Author

merlimat commented Mar 30, 2018

Rebased to master

@merlimat merlimat force-pushed the delayed-acks-impl branch from 4c8d1a0 to c0659d1 Compare April 2, 2018 23:09
@merlimat
Copy link
Contributor Author

merlimat commented Apr 3, 2018

retest this please

@merlimat merlimat merged commit 19dd2c5 into apache:master Apr 3, 2018
@rdhabalia
Copy link
Contributor

@merlimat this is not a backward compatible change with old broker (version < 2.0) because, old brokers don't understand group-ack command so, combination of new-client (>=2.0) and old-broker will not work and it can create ack-holes for the client.

also CommandAck schema is also changed

Before: required MessageIdData message_id = 3;
After: repeated MessageIdData message_id = 3;

I think we were making sure that we don't break backward compatibility so, If client uses new version and if it requires to rollback broker version then it can not create an issue here. Any thoughts to fix this issue?

@rdhabalia
Copy link
Contributor

can we add CommandAckDeprecated in proto-schema which can be used by client if broker-verison is < V12 ?

@rdhabalia
Copy link
Contributor

@merlimat any update on it?

@merlimat
Copy link
Contributor Author

merlimat commented Jul 9, 2018

@merlimat
Copy link
Contributor Author

@rdhabalia I did the test by using :

  • Broker 1.22.1
  • Producer 1.22 (perf-producer)
  • Consumer from master (2.2-SNAPSHOT) (perf-consumer)

I could no reproduce the issue. There are no unacked messages. Do you have a better way to reproduce?

@rdhabalia
Copy link
Contributor

The code should already be sending 1 single ack if the broker is < 2.0 :

I see, I missed it to check.

I think the issue is that I have cherry-picked ActiveConsumerListener-change into broker-1.22 to support function on broker-1.22 and this PR upgraded pulsar-broker version=V12 and because of that client was sending group-ack to broker which broker couldn't understand.
Thanks for pointing it out, I will fix internal broker's patch.

@merlimat merlimat deleted the delayed-acks-impl branch August 23, 2018 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants