You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/26 10:14:12 UTC

[GitHub] [pulsar] lhotari opened a new pull request #9735: [Metrics] Reduce CPU consumption of metrics creation

lhotari opened a new pull request #9735:
URL: https://github.com/apache/pulsar/pull/9735


   ### Motivation
   
   `String.format` is consuming most CPU when generating metrics:
   ![image](https://user-images.githubusercontent.com/66864/109286532-05226880-782b-11eb-9074-a578b1a83284.png)
   ([Flamegraph from Pulsar user](https://apache-pulsar.slack.com/archives/C5Z4T36F7/p1614331656110600?thread_ts=1614293057.103600&cid=C5Z4T36F7))
   
   ### Modifications
   
   Replace the usage of `String.format` with usage of `StringBuilder` and thread local cached `DecimalFormat`.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] lhotari commented on pull request #9735: [Metrics] Reduce CPU consumption of metrics creation

Posted by GitBox <gi...@apache.org>.
lhotari commented on pull request #9735:
URL: https://github.com/apache/pulsar/pull/9735#issuecomment-786567750


   It seems that it would be possible to get rid of the key creation to prevent String allocation, using a similar approach as @rdhabalia used in NamespaceStats: https://github.com/apache/pulsar/blob/cc64889abe94d47f048e2f8e8fb10d6c37e695ec/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/NamespaceStats.java#L46-L63 .
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] lhotari removed a comment on pull request #9735: [Metrics] Reduce CPU consumption of metrics creation

Posted by GitBox <gi...@apache.org>.
lhotari removed a comment on pull request #9735:
URL: https://github.com/apache/pulsar/pull/9735#issuecomment-786567750


   It seems that it would be possible to get rid of the key creation to prevent String allocation, using a similar approach as @rdhabalia used in NamespaceStats: https://github.com/apache/pulsar/blob/cc64889abe94d47f048e2f8e8fb10d6c37e695ec/pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/NamespaceStats.java#L46-L63 .
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] merlimat merged pull request #9735: [Metrics] Reduce CPU consumption of metrics creation

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #9735:
URL: https://github.com/apache/pulsar/pull/9735


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] lhotari commented on pull request #9735: [Metrics] Reduce CPU consumption of metrics creation

Posted by GitBox <gi...@apache.org>.
lhotari commented on pull request #9735:
URL: https://github.com/apache/pulsar/pull/9735#issuecomment-786793216


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] lhotari commented on pull request #9735: [Metrics] Reduce CPU consumption of metrics creation

Posted by GitBox <gi...@apache.org>.
lhotari commented on pull request #9735:
URL: https://github.com/apache/pulsar/pull/9735#issuecomment-786895484


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org