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 2020/07/09 04:38:17 UTC

[GitHub] [pulsar-client-go] dferstay opened a new pull request #319: Do not allocate MessageIDs on the heap

dferstay opened a new pull request #319:
URL: https://github.com/apache/pulsar-client-go/pull/319


   Passing a function parameter by pointer (or writing a pointer into a
   channel) will cause the Go escape analysis to allocate the parameter on
   the heap.
   
   This change passes messageID struct instances by value instead of by
   pointer; this keeps messageID structs on the stack.
   
   Each message produced or consumed by the library is associated with
   a MessageID; keeping instances of the MessageID structure on the stack
   reduces heap allocation and associated GC cost.
   
   Signed-off-by: Daniel Ferstay <df...@splunk.com>
   
   ### Motivation
   
   Reduce the amount of per-Message heap allocation performed by the library
   
   ### Modifications
   
   This change modifies the Consumer and Producer code paths to pass messageID struct instances by value instead of by
   pointer; this keeps the messageID structures on the stack and off of the heap.
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change is already covered by existing tests, such as:
   * pulsar/consumer_multitopic_test.go
   * pulsar/consumer_partition_test.go
   * pulsar/consumer_regex_test.go
   * pulsar/consumer_test.go
   * pulsar/impl_message_test.go
   * pulsar/negative_acks_tracker_test.go
   * pulsar/producer_test.go
   * pulsar/reader_test.go
   
   ### Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API: no
     - The schema: no
     - The default values of configurations: no
     - The wire protocol: no
   
   ### Documentation
   
     - Does this pull request introduce a new feature? no
   


----------------------------------------------------------------
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-client-go] dferstay edited a comment on pull request #319: Do not allocate MessageIDs on the heap

Posted by GitBox <gi...@apache.org>.
dferstay edited a comment on pull request #319:
URL: https://github.com/apache/pulsar-client-go/pull/319#issuecomment-656195552


   Below is the alloc_space view of a pprof heap profile collected during a large scale test of a high-throughput service that uses pulsar-client-go to send messages to Pulsar.  Note that `messageID` structures account for 6.07% of all allocation; this percentage grows the longer the service runs as messageIDs escape to the heap for every message produced.
   
   ![message-id-alloc-space](https://user-images.githubusercontent.com/13126037/87059274-f749a580-c1bd-11ea-8f5b-bd1cc7f05f0e.png)
   


----------------------------------------------------------------
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-client-go] merlimat merged pull request #319: Do not allocate MessageIDs on the heap

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


   


----------------------------------------------------------------
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-client-go] dferstay commented on pull request #319: Do not allocate MessageIDs on the heap

Posted by GitBox <gi...@apache.org>.
dferstay commented on pull request #319:
URL: https://github.com/apache/pulsar-client-go/pull/319#issuecomment-656195552


   Below is the alloc_space view of a pprof heap profile collected during a large scale test of a high-throughput service that uses pulsar-client-go to send messages to Pulsar.
   
   ![message-id-alloc-space](https://user-images.githubusercontent.com/13126037/87059274-f749a580-c1bd-11ea-8f5b-bd1cc7f05f0e.png)
   


----------------------------------------------------------------
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