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

T minor performance tweaks #720

Closed

Conversation

maniksurtani
Copy link
Member

The first commit makes us a few % faster on startup. The second makes us a lot faster if starting up transactional, LOCAL mode caches (common for Hibernate 2LC)

@@ -67,6 +69,13 @@
private CommandsFactory cf;
private RpcManager rpcManager;

private static final Log log = LogFactory.getLog(OptimisticLockingInterceptor.class);
Copy link
Member

Choose a reason for hiding this comment

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

Wrong one!

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense, but please fix this one.

Copy link
Member Author

Choose a reason for hiding this comment

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

+1

@maniksurtani
Copy link
Member Author

@galderz nope. The isStandaloneCache() check didn't suppress the registration of the listener. So the listener was registered anyway. And this is a hotspot when using a standalone cache (checking the listener, annotations, reflection to extract the annotated methods, etc).

@maniksurtani
Copy link
Member Author

About the other comments re: logging:

  • Interceptors are a very different beast from most other classes we have in the codebase since they are heavily subclassed. If we have a BaseRpcInterceptor logging some stuff, but the actual implementation is a ReplicationInterceptor, it makes sense to have all these messages logged as a ReplicationInterceptor. In the past the codebase used a non-static logger (one per interceptor instance) to get around this. But this is slow to construct if we have 1000's of cache instances (Hibernate 2LC).
  • A static logger is preferable, and this is the pattern we follow with the rest of the codebase. But since interceptors are heavily subclassed, we can't just reference a static Log variable in the superclass. Instead, the final implementation needs to hold on to the Log static instance, and make this available to superclasses via a getLog() method.
  • I suspect Commands will trip over the same problem and have to follow a similar pattern at some point. However as commands themselves are small and contain very simple logic, there isn't much logging going on there in the first place and many Commands don't set up loggers.
  • Regardingmy checking of getLog().isTraceEnabled(), this goes back to the fact that the EntryWrappingInterceptor is subclassed so it cannot rely on a class-level variable to cache whether tracing is enabled.

@maniksurtani
Copy link
Member Author

@Sanne I completely agree that getLog() will never perform as good as log, but at least it means we get (a) correct info as to which interceptor is in use and at the same time (b) we don't create a separate logger per interceptor instance, but rather one per interceptor type.

@Sanne
Copy link
Member

Sanne commented Dec 13, 2011

Ok; just waiting for the fix of the copy/paste issue of class name.

@maniksurtani
Copy link
Member Author

@Sanne done

@Sanne
Copy link
Member

Sanne commented Dec 13, 2011

well well.. you edited the wrong commit ;) merging anyway..

@Sanne Sanne closed this Dec 13, 2011
@Sanne
Copy link
Member

Sanne commented Dec 13, 2011

@maniksurtani hey there was no issue associated ?? imho you should definitely track such changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants