Skip to content

[improve][io] Remove sleep when sourceTask.poll of kafka return null #24124

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

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

shibd
Copy link
Member

@shibd shibd commented Mar 25, 2025

Motivation

We observe our debezium source connector latency min is 1s when traffic is small.

According to the Kafka Source API definition, when there is no data, the implementation should block for a period of time. We don't need to actively sleep here to avoid CPU spinning.

"platform/resource/debezium-postgres-source-0" #20 prio=5 os_prio=0 cpu=15396.95ms elapsed=21030.80s tid=0x00007f8cbc99f020 nid=0x20 waiting on condition  [0x00007f8cbb92c000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
	at java.lang.Thread.sleep([email protected]/Native Method)
	at org.apache.pulsar.io.kafka.connect.AbstractKafkaConnectSource.read(AbstractKafkaConnectSource.java:172)
	- locked <0x00000000cf3044a0> (a org.apache.pulsar.io.debezium.postgres.DebeziumPostgresSource)
	at org.apache.pulsar.functions.instance.JavaInstanceRunnable.readInput(JavaInstanceRunnable.java:529)
	at org.apache.pulsar.functions.instance.JavaInstanceRunnable.run(JavaInstanceRunnable.java:320)
	at java.lang.Thread.run([email protected]/Thread.java:840)

Modifications

  • Remove sleep when sourceTask.poll of kafka return null

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@codecov-commenter
Copy link

codecov-commenter commented Mar 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.27%. Comparing base (bbc6224) to head (5c9cf1a).
Report is 986 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24124      +/-   ##
============================================
+ Coverage     73.57%   74.27%   +0.70%     
+ Complexity    32624    32114     -510     
============================================
  Files          1877     1864      -13     
  Lines        139502   144440    +4938     
  Branches      15299    16468    +1169     
============================================
+ Hits         102638   107285    +4647     
+ Misses        28908    28709     -199     
- Partials       7956     8446     +490     
Flag Coverage Δ
inttests 26.77% <ø> (+2.18%) ⬆️
systests 23.13% <ø> (-1.19%) ⬇️
unittests 73.78% <ø> (+0.93%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...r/io/kafka/connect/AbstractKafkaConnectSource.java 63.28% <ø> (+1.68%) ⬆️

... and 1063 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shibd shibd merged commit d0c996e into apache:master Mar 26, 2025
56 checks passed
shibd added a commit that referenced this pull request Mar 26, 2025
shibd added a commit that referenced this pull request Mar 26, 2025
shibd added a commit that referenced this pull request Mar 26, 2025
nodece pushed a commit to nodece/pulsar that referenced this pull request Mar 27, 2025
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 27, 2025
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 28, 2025
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 28, 2025
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 29, 2025
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants