teetime-framework/TeeTime

Creating Non Static Logger in Abstract Stage Not Performant

Closed this issue · 8 comments

Creating a non-static logger for every abstract stage instance is taking more than 50% CPU on initial load tests.

public abstract class AbstractStage {
...
/**
* A unique logger instance per stage instance
*/
@SuppressWarnings("PMD.LoggerIsNotStaticFinal")
protected final Logger logger;
...
protected AbstractStage() {
this.id = this.createId();
this.logger = LoggerFactory.getLogger(this.getClass().getCanonicalName() + ":" + id);
}
...

Unfortunately, I cannot reproduce this performance issue. Could you please give us some details? ...such as

  • how long does your CPU have a utilization of 50%?
  • which CPU do you use (esp. the number of cores)?
  • how many stages does your configuration have?
  • how do you know that this line of code causes the issue?
  • how did you configure your logger(s)?

We implemented the logger in AbstractStage (the super class of all stages) so that each extending stage type automatically has a logger with its stage type name. I am not aware of a better solution. But if you are, then please tell us. We are open for improvements.

Ok, I've added an overloaded version of the constructor. I try to find a better solution, but first off it should help you when writing and using custom stage types. You are still not able to pass a custom logger to the stages which TeeTime already provides.

Done. Please report on whether the adaption has solved your performance problem.

I need this in Maven Central as developers have to build locally which is doable but... thanks !!

I will release version 3.0 very soon. Please be prepared for some API changes.

Today, we have released TeeTime 3.0 on maven central. HF!