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

ASF GitHub Bot commented on KAFKA-2882:
---------------------------------------

GitHub user logarithm opened a pull request:

    https://github.com/apache/kafka/pull/580

    KAFKA-2882: Add constructor cache for Snappy and LZ4 Output/Input streams 
in Compressor.java

    In `wrapForOutput` and `wrapForInput` methods of 
`org.apache.kafka.common.record.Compressor`,  `Class.forName("[compression 
codec]")` and `getConstructor` methods are invoked for each `wrapForOutput` / 
`wrapForInput` call. Reflection calls are expensive and impact performance at 
high volumes. This patch adds a cache for `Constructor` to reduce the 
reflection overhead.
    
    In our production deployments, this has reduced producer CPU usage by about 
20%

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/metamx/kafka compressor-getclass-cache

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/580.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #580
    
----
commit 6c05fbd265cd595e1878d12eb2c1cdc838c80b09
Author: Maksim Logvinenko <mlogvine...@gmail.com>
Date:   2015-11-24T13:21:09Z

    Add cache for constructors in Compressor.java

----


> Add constructor cache for Snappy and LZ4 Output/Input stream in 
> Compressor.java
> -------------------------------------------------------------------------------
>
>                 Key: KAFKA-2882
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2882
>             Project: Kafka
>          Issue Type: Improvement
>          Components: consumer, producer 
>    Affects Versions: 0.8.2.1
>            Reporter: Maksim Logvinenko
>            Assignee: Neha Narkhede
>
> In `wrapForOutput` and `wrapForInput` methods of 
> `org.apache.kafka.common.record.Compressor`,  `Class.forName("[compression 
> codec]")` and `getConstructor` methods are invoked for each `wrapForOutput` / 
> `wrapForInput` call. Reflection calls are expensive and impact performance at 
> high volumes. This patch adds a cache for `Constructor` to reduce the 
> reflection overhead.
> In our production deployments, this has reduced producer CPU usage by about 
> 20%



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to