[ 
https://issues.apache.org/jira/browse/ROCKETMQ-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16119385#comment-16119385
 ] 

ASF GitHub Bot commented on ROCKETMQ-253:
-----------------------------------------

Github user shroman commented on a diff in the pull request:

    https://github.com/apache/incubator-rocketmq/pull/140#discussion_r132087129
  
    --- Diff: 
common/src/main/java/org/apache/rocketmq/common/protocol/body/RegisterBrokerBody.java
 ---
    @@ -40,4 +57,114 @@ public void 
setTopicConfigSerializeWrapper(TopicConfigSerializeWrapper topicConf
         public void setFilterServerList(List<String> filterServerList) {
             this.filterServerList = filterServerList;
         }
    +
    +    public byte[] encode(boolean compress) {
    +
    +        if (!compress) {
    +            return encode();
    +        }
    +
    +        ByteArrayOutputStream byteArrayOutputStream = new 
ByteArrayOutputStream();
    +        DeflaterOutputStream outputStream = new 
DeflaterOutputStream(byteArrayOutputStream, new 
Deflater(Deflater.BEST_COMPRESSION));
    --- End diff --
    
    I think `Deflater.BEST_COMPRESSION` may be even slower than GZIP. Do we 
care about compression speed?


> Compress RegisterBrokerBody
> ---------------------------
>
>                 Key: ROCKETMQ-253
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-253
>             Project: Apache RocketMQ
>          Issue Type: Improvement
>          Components: rocketmq-broker, rocketmq-commons, rocketmq-namesrv
>            Reporter: Zhanhui Li
>            Assignee: yukon
>
> RocketMQ Brokers periodically register itself against namesrv to maintain its 
> liveness.
> In case a broker has many topics, a 10 thousand or more, two major 
> problematic issues show up:
> 1) Current serialization of RegisterBrokerBody would create a large String 
> object, which stresses GC  a lot, especially when G1 is used.
> 2) Transmission this bulk of data takes up significant portion of bandwidth.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to