Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[perf]: More precise producer rate limiter #989

Merged
merged 2 commits into from
Mar 13, 2023

Conversation

Gleiphir2769
Copy link
Contributor

@Gleiphir2769 Gleiphir2769 commented Mar 10, 2023

Motivation

Currently, when the rate of the producer is set relatively small, the actual production rate is not accurate.

For example.

$ ./pulsar-perf-old produce my-test-r1 -r 1

INFO[17:20:12.524] Stats - Publish rate:    2.9 msg/s -    0.0 Mbps - 
                                Latency ms: 50%   3.8 -95% 1004.0 - 99% 1004.3 - 99.9% 1004.3 - max 1005.2 
INFO[17:20:22.523] Stats - Publish rate:    3.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50%   3.8 -95% 1004.0 - 99% 1004.2 - 99.9% 1004.2 - max 1004.9 
INFO[17:20:32.523] Stats - Publish rate:    3.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50%   3.9 -95% 1004.0 - 99% 1004.0 - 99.9% 1004.0 - max 1004.1 

$ ./pulsar-perf-old produce my-test-r1 -r 5

INFO[17:27:33.597] Stats - Publish rate:    6.9 msg/s -    0.1 Mbps - 
                                Latency ms: 50%   4.0 -95% 1004.1 - 99% 1005.0 - 99.9% 1005.0 - max 1019.0 
INFO[17:27:43.596] Stats - Publish rate:    7.0 msg/s -    0.1 Mbps - 
                                Latency ms: 50%   4.7 -95% 1004.9 - 99% 1006.0 - 99.9% 1006.0 - max 1006.3 
INFO[17:27:53.596] Stats - Publish rate:    7.0 msg/s -    0.1 Mbps - 
                                Latency ms: 50%   4.0 -95% 1004.0 - 99% 1004.9 - 99.9% 1004.9 - max 1005.5 
INFO[17:28:03.588] Stats - Publish rate:    7.0 msg/s -    0.1 Mbps - 
                                Latency ms: 50%   5.0 -95% 1005.1 - 99% 1008.1 - 99.9% 1008.1 - max 1015.5

After modify the rate limiter, the result can be improved as that.

$ ./pulsar-perf produce my-test-r1 -r 1

INFO[17:22:45.971] Stats - Publish rate:    1.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50% 1004.4 -95% 1005.1 - 99% 1005.1 - 99.9% 1005.1 - max 1006.2 
INFO[17:22:55.971] Stats - Publish rate:    1.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50% 1004.2 -95% 1007.4 - 99% 1007.4 - 99.9% 1007.4 - max 1008.0 
INFO[17:23:05.971] Stats - Publish rate:    1.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50% 1003.4 -95% 1004.7 - 99% 1004.7 - 99.9% 1004.7 - max 1008.1 
INFO[17:23:15.971] Stats - Publish rate:    1.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50% 1003.5 -95% 1004.3 - 99% 1004.3 - 99.9% 1004.3 - max 1004.6 

$ ./pulsar-perf produce my-test-r1 -r 5

INFO[17:29:07.675] Stats - Publish rate:    5.4 msg/s -    0.0 Mbps - 
                                Latency ms: 50% 203.5 -95% 204.6 - 99% 206.3 - 99.9% 206.3 - max  207.3 
INFO[17:29:17.675] Stats - Publish rate:    5.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50% 203.8 -95% 205.5 - 99% 206.2 - 99.9% 206.2 - max  206.3 
INFO[17:29:27.675] Stats - Publish rate:    5.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50% 203.7 -95% 204.7 - 99% 207.4 - 99.9% 207.4 - max  220.8 
INFO[17:29:37.675] Stats - Publish rate:    5.0 msg/s -    0.0 Mbps - 
                                Latency ms: 50% 203.6 -95% 204.3 - 99% 204.4 - 99.9% 204.4 - max  204.5 

Modifications

  • Use the "golang.org/x/time/rate" as producer limiter.

Verifying this change

  • Make sure that the change passes the CI checks.

@shibd shibd merged commit bcbac9f into apache:master Mar 13, 2023
@RobertIndie RobertIndie added this to the v0.10.0 milestone Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants