Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-4289 - moved short-lived loggers to companion objects #2006

Closed
wants to merge 1 commit into from

Conversation

radai-rosenblatt
Copy link
Contributor

Signed-off-by: radai-rosenblatt radai.rosenblatt@gmail.com

@becketqin
Copy link
Contributor

LGTM.

@onurkaraman
Copy link
Contributor

LGTM

@@ -225,7 +225,7 @@ class FileMessageSet private[kafka](@volatile var file: File,
case tl: TransportLayer => tl.transferFrom(channel, position, count)
case dc => channel.transferTo(position, count, dc)
}).toInt
trace("FileMessageSet " + file.getAbsolutePath + " : bytes transferred : " + bytesTransferred
FileMessageSet.trace("FileMessageSet " + file.getAbsolutePath + " : bytes transferred : " + bytesTransferred
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a import FileMessageSet._ at the top of the class block to avoid having to add the class name before trace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -430,7 +430,7 @@ class FileMessageSet private[kafka](@volatile var file: File,

}

object FileMessageSet
object FileMessageSet extends Logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the logger name slightly (the class of the companion object instead of the actual class). We could override loggerName to maintain compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@isolis
Copy link

isolis commented Oct 11, 2016

This is a good start. We should eventually evaluate logging. Scala 2.10 has macros so you can do very efficient logging calls as well.

We could use https://github.com/typesafehub/scala-logging or write our own.

@ijuma
Copy link
Contributor

ijuma commented Oct 11, 2016

@isolis, Kafka still supports Scala 2.10, so we can't use scala-logging. It's probably more work than it's worth to write our own macros for that at this point. Maybe once we drop support for Scala 2.10.

@isolis
Copy link

isolis commented Oct 11, 2016

@ijuma I did a quick test a while ago of a way to use macros with scala. It was more of a feasibility test than a real test. Macros require a separate package so you need a 2 phase compile. Using scala-logging might be a better option.

It's not urgent, obviously nobody is blocked by it, but at some point we should revisit this. Some of our profile data was showing up to 6% of the time was spent on logging, but most of it is probably on these short lived classes and they way they instantiate logging (which this patch tries to work towards). Once this is addressed the remaining part might be minor; so at some point the 0.5% performance improvement is not worth the added complexity.

Signed-off-by: radai-rosenblatt <radai.rosenblatt@gmail.com>
Copy link
Contributor

@ijuma ijuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, LGTM.

@jjkoshy
Copy link
Contributor

jjkoshy commented Oct 12, 2016

+1

@asfgit asfgit closed this in 704308a Oct 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants