[ISSUE #10654] Benchmark support grpc#10655
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds gRPC-based benchmark producer and consumer tools (GrpcProducer, GrpcConsumer) using the rocketmq-client-java SDK, along with corresponding shell scripts for launching and shutting down the benchmarks. This extends the existing remoting-based benchmark suite with gRPC protocol support.
Findings
-
[Warning]
GrpcConsumer.java:103—successListis aLinkedListshared across multiple scheduled tasks (lines 135–143) without synchronization. The scheduled consumer callback and the stats snapshot task both access it concurrently. Consider usingConcurrentLinkedQueueorCollections.synchronizedList()to avoid potentialConcurrentModificationExceptionor lost counts. -
[Warning]
GrpcProducer.java:259—awaitTermination(1, TimeUnit.DAYS)is effectively a no-timeout wait. If any producer thread fails to exit (e.g. stuck in a blocking send), the process will hang indefinitely. Consider a more reasonable timeout (e.g. 60 seconds) followed byshutdownNow()and a warning log. -
[Info]
grpc-consumer.sh:18/grpc-producer.sh:18—$@is unquoted. If any argument contains spaces, it will be word-split. Consider"$@"for robustness. Note: the existing benchmark scripts (produce.sh,consume.sh) have the same pattern, so this is consistent but could be improved across the board. -
[Info]
GrpcProducer.java:147-148—accessKey/secretKeydefault to"ak"/"sk". This is fine for a benchmark tool, but worth a brief comment noting these are placeholder credentials for local testing only. -
[Info]
example/pom.xml— The dependency usesrocketmq-client-java-noshadeversion5.0.9-SNAPSHOT. If this is intentional for development, consider adding a comment. If a release version is available, prefer that for reproducibility. -
[Info]
GrpcConsumer.java:152—System.currentTimeMillis()is used for latency measurement.System.nanoTime()would be more accurate for measuring elapsed time (immune to wall-clock adjustments). Same applies toGrpcProducer.javatiming.
Verdict
Good addition to the benchmark toolkit — gRPC protocol coverage is a natural complement to the existing remoting benchmarks. The main concerns are the thread-safety issue in GrpcConsumer (should be fixed) and the infinite termination timeout in GrpcProducer (should be bounded). The rest are minor suggestions.
Automated review by github-manager-bot
The Bot's comment is confusing: looks like some comments point to blank line number or referred a non-exist variable. |
|
@bxfjb Thanks for pointing that out — you're right, the previous review had several factual inaccuracies. I re-checked the actual diff and here are the corrected findings: Corrected Findings
Apologies for the earlier inaccuracies. The two Warning items (thread-safety of Automated review by github-manager-bot (corrected) |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Corrected Findings
-
[Warning]
GrpcConsumer.java:109—snapshotList(aLinkedList<Long[]>) is shared across multiple scheduled tasks (lines ~115–140) without synchronization. The scheduled consumer callback adds to it and the stats snapshot task reads from it concurrently. Consider usingConcurrentLinkedQueueorCollections.synchronizedList()to avoid potentialConcurrentModificationException. -
[Warning]
GrpcProducer.java:186—sendThreadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS)is effectively an infinite wait. If any producer thread fails to exit, the process will hang indefinitely. Consider a more reasonable timeout (e.g. 60 seconds) followed byshutdownNow()and a warning log. -
[Info]
grpc-consumer.sh:18/grpc-producer.sh:18—$@is unquoted. If any argument contains spaces, it will be word-split. Consider"$@"for robustness. (Note: the existing benchmark scripts have the same pattern, so this is consistent.) -
[Info]
GrpcProducer.java:74-75—accessKey/secretKeydefault to"12345678"/"rocketmq2". Fine for a benchmark tool, but worth a brief comment noting these are placeholder credentials for local testing only. -
[Info]
GrpcConsumer.java:157/GrpcProducer.java:157—System.currentTimeMillis()is used for latency measurement.System.nanoTime()would be more accurate for measuring elapsed time (immune to wall-clock adjustments).
Apologies for the confusion in the previous review. The core concerns (thread safety in GrpcConsumer and unbounded termination timeout in GrpcProducer) remain valid.
Automated review by github-manager-bot
Which Issue(s) This PR Fixes
Brief Description
How Did You Test This Change?