Maksim Logvinenko created KAFKA-2882:
----------------------------------------

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