Warning: mysql_real_escape_string(): No such file or directory in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): No such file or directory in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): No such file or directory in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): No such file or directory in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): No such file or directory in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): No such file or directory in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786

Warning: mysql_real_escape_string(): A link to the server could not be established in /home/jayshao/web/wp/wp-content/plugins/statpress-reloaded/statpress.php on line 1786Perf4j+Maven+AspectJ CTW | Jason E. Shao

Recently I’ve incorporated Perf4j for runtime performance statistics on a number of projects, combined with our in-house counters and other standard libs (actually I quite like the annotation-style logging of perf-stats, and the tag-name rollup conventions, and will probably retrofit both into our existing collection tools). I had a bit of difficulay initially getting AspectJ to do CTW for the collection (and in retrospect, very much want to investivate the agent-based LTW approach, since it’d give us the ability to flip on/off recording, while it should be basically just as fast except on object creation – which for Spring/Singleton instantiated services (most of our performance code) is not significant.

Anyhow, the meat, plugin config below:

12345678910111213141516171819202122232425

<plugin><groupId>org.codehaus.mojo</groupId><artifactId>aspectj-maven-plugin</artifactId><version>1.3</version><configuration><showWeaveInfo>true</showWeaveInfo><source>1.6</source><weaveDependencies><dependency><groupId>org.perf4j</groupId><artifactId>perf4j</artifactId></dependency></weaveDependencies></configuration><executions><execution><goals><goal>compile</goal><!-- use this goal to weave all your main classes --><goal>test-compile</goal><!-- use this goal to weave all your test classes --></goals></execution></executions></plugin>

Also dependencies (we use Log4j, though we’re looking at Logback as well):

Performance note: We did some unit testing of methods which were instrumented/non-instrumented (our unit test basically spewed out a couple thousand garbage string+ints in a loop, which was instrumented or not)

We saw something like 3x the number of minor GCs (though GC was still fast) – no additional major GCs after adding Perf4j. Overall execution time was higher as well, though not by the same degree.

I don’t remember getting a NSME when I was working through – did you make sure to only grab the log4j (or whatever framework you’re using) version of the jar? I know strange things happen trying to weave in all framework versions, since they clobber each other.