-
Notifications
You must be signed in to change notification settings - Fork 99
Closed
Labels
api: pubsubIssues related to the googleapis/java-pubsub API.Issues related to the googleapis/java-pubsub API.
Description
I was profiling a pubsub benchmark and I saw a potential improvement. Each publish it parses the topicName. 90% of publish CPU time is spent on this. 30% of total CPU during my profiling. One could lift this up into the publisher and pass TopicName directly into PubsubMessageWrapper in the publish
Short Repro
val sessionSampleMsg = """{"website":"https://minty-modernist.name","domain":"limp-effector.com","job":{"title":"Investor Creative Administrator","descriptor":"Customer","area":"Accountability","type":"Consultant","company":"Bailey - Ledner"},"uuid":"1ef60952-c540-47ad-97c3-e923e20faafc","objectId":"67643b6bac95a0492808f66b"}"""
val samplePubsubMsg = PubsubMessage.newBuilder()
.setData(ByteString.copyFromUtf8(sessionSampleMsg))
.build()
val testTopic = "projects/test/topics/pst-test"
val optimalPublisher = Publisher.newBuilder(testTopic)
fun startProducing(publisher: Publisher) {
while (true){
publisher.publish(samplePubsubMsg)
}
}
fun main() {
startProducing(optimalPublisher)
}
Profile background
Was run on 2vpcu xeon + 4GB ram, LTS JDK 21
I have included the profile, see below
optimal-producer.zip
Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the googleapis/java-pubsub API.Issues related to the googleapis/java-pubsub API.
