stagemonitor / stagemonitor-mailinglist

GitHub issues abused as a mailing list
3 stars 0 forks source link

Javassist #3

Open felixbarny opened 9 years ago

felixbarny commented 9 years ago

I'm currently working on replacing AspectJ with Javassist. This brings several benefits.

Simplicity

Users won't have to bother setting up a aop.xml file to configure the profiler. Instead they can use the existing stagemonitor configuration mechanisms like stagemonitor.properties, java system properties and environment variables which feels much more 'native'. Another cool thing is that it allows the profiler to work with zero configuration. If you don't explicitly specify which packages to include and to exclude, stagemonitor will apply a default package exclude list which excludes the most commonly used java libraries. So that the call trees won't get too big.

Performance

Writing the profiler with Javassist will make it even faster than with AspectJ.

More lightweight

AspectJ is a great tool, but it adds another 10MB to your dependencies! Javassist is much more lightweight with its 732KB.

The migration of the profiler is almost done. Now it's time to migrate the other aspects.

felixbarny commented 9 years ago

I did some basic measurements with the AspectJ vs the current Javassist based implementation.

Instrumentation Startup in seconds Memory consumption after first request
No Instrumentation 3.8 230 MiB
Javassist 3.9 260 MiB
AspectJ 9.5 1.16 GiB

I think the efforts really pay of and the overhead of instrumentation with Javassist is almost negligible.

alecxvs commented 9 years ago

Regarding the new configuration options (like stagemonitor.instrument.exclude), do I need to set this as an array of strings and will setting this override the default exclusions? Or can I specify it multiple times, for each additional exclusion? I'm not sure how flexible the properties file is.

I don't currently have the need to overwrite the whole exclusion list, but I do need to add a couple of things to the excludeMatching list and this thought occured.

felixbarny commented 9 years ago

You need to set this as a comma separated list and it will override the default settings.

If you want to extend the excludeMatching list, you also need to list the default options.

Which things do you need to add? Maybe it would make sense to add them to the default list.

alecxvs commented 9 years ago

access$ and EnhancerByGuice are the only things in our project's exclusions that we likely need to still be excluded.