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


   ### Motivation
   
   The compression providers map in the partition consumer is a textbook case
   for using go's lock-free sync.Map: the set of map entries is stable and
   access is read-only.
   
   On machines with 4 cores or greater, read contention on the sync.RWMutex
   outweighs the cost of using a sync.Map.
   
   Below is an old article on the subject, but it still holds true today:
   https://medium.com/@deckarep/the-new-kid-in-town-gos-sync-map-de24a6bf7c2c
   
   ### Modifications
   
   The sync.RWMutex and map of compression providers 
(`map[pb.CompressionType]compression.Provider`) in the partition consumer has 
been replaced with a sync.Map
   
   ### Verifying this change
   
   This change is already covered by existing tests, such as:
   - `pulsar/consumer_partitiion_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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to