Skip to content

[Bug] A significant performance regression about producer publish throughput on master branch #17931

Closed

Description

@AnonHxy

Search before asking

  • I searched in the issues and found nothing similar.

Version

  • OS:
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "3.10.0-514.16.1.el7.x86_64", arch: "amd64", family: "unix"
  • JDK:
    java version "17.0.4" 2022-07-19 LTS
    Java(TM) SE Runtime Environment (build 17.0.4+11-LTS-179)
    Java HotSpot(TM) 64-Bit Server VM (build 17.0.4+11-LTS-179, mixed mode, sharing)
  • Pulsar Version
    • broker: apache-pulsar-2.10.1
    • client: commit id: d1b7c6a

Minimal reproduce step

step1. Start a standalone broker bin/pulsar standalone
step2. Start a producer to publish messages, using client compiled from commit id: d1b7c6a . Then watch the log about ProducerStats

compile pulsar-client:

mvn clean source:jar install -DskipTests -Pmain -Dlicense.skip=true -Dmaven.test.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true -pl pulsar-client -am

producer demo:

public class ProducerTest {
    public static void main(String[] args) throws Exception {
        String topic = "hxy-test-mem";
        byte[] smallMsg = new byte[64];
        PulsarClient client = PulsarClient.builder()
                .serviceUrl("pulsar://127.0.0.1:6650")
                .memoryLimit(2000, SizeUnit.MEGA_BYTES)  // memory limit 2000M
                .build();
        Producer<byte[]> producer = client.newProducer()
                .topic(topic)
                .enableBatching(true)
                .create();
        for (int i = 0; i < Integer.MAX_VALUE; ++i) {
            producer.sendAsync(smallMsg);
        }

step3. Revert #17049 and follow the steps like step2. We need compare the publish throughput with step2.

What did you expect to see?

  1. Here is the publish throughput result (msg/s).
before revert PR#17049 after revert PR#17049
1 837,119.26 1,504,240.76
2 870,065.55 1,538,345.83
3 868,281.75 1,543,356.32
avg 858,488.85 1,528,647.63
  1. We can see that before reverting [fix][broker] Fix schema does not replicate successfully #17049, there is a significant performance regression
  2. When I look into the flame graph, it seems that SchemaHash#of() this method take a lot of cpu time, but I am not sure it's the root cause.

image

image

  1. flame graph file

before_revert.html.zip
after_revert.html.zip

What did you see instead?

--

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

  1. added
    type/bug
    on Oct 4, 2022
  2. self-assigned this
    on Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions