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

Jun Rao commented on KAFKA-1115:
--------------------------------

Thanks for the patch. Are you sure that scala doesn't do lazy evaluation? I did 
the following test. It seems that it does?

scala> import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicInteger

scala> val c = new AtomicInteger(1)
c: java.util.concurrent.atomic.AtomicInteger = 1

scala> def a(msg: => String, isRun: Boolean) { if (isRun) println(msg) }
a: (msg: => String,isRun: Boolean)Unit

scala> a("test %d".format(c.incrementAndGet), false)

scala> c                                            
res3: java.util.concurrent.atomic.AtomicInteger = 1


> producer performance affected by trace/debug calls
> --------------------------------------------------
>
>                 Key: KAFKA-1115
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1115
>             Project: Kafka
>          Issue Type: Improvement
>          Components: producer 
>    Affects Versions: 0.8
>            Reporter: Francois Saint-Jacques
>            Assignee: Francois Saint-Jacques
>         Attachments: producer-performance-fix.patch
>
>
> After investigating high CPU usage on some producers in production, we found 
> out that a lot of time was passed in string construction for logging of DEBUG 
> and TRACE level.
> This patch removes most of the logging calls, on our systems it cuts CPU 
> usage down to half of what it used to be.
> Note that this is a significant boost in performance for environment where 
> there are thousands of msg/s.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to