Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question regarding JAmon

 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am evaluating the JAmon performance tool to identify the performance bottlenecks in my J2EE code. From the demo I could see that using JAmon, it is possible to monitor the time taken by each method for execution. However, this is only one aspect. I would like to see details on the memory (heap)front as well. Can anybody, who knows about the tool share if it is possible to monitor the objects created in the JVM when the application is serving user requests? I would like to see how many instances of each class have been created and how much is the momory taken by them.

Any pointer in this regard will be extremely helpful.

Thanks in advance for your time.

Cheers,
Steve
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jamon doesn't do what you are asking.

JAMon does allow you to monitor several different aspects of your code with no code changes:
1) Using jamon jdbc driver you can track sql stats, jdbc method call stats and jdbc exceptions
2) Using the jamon servlet filter you can track page hits, as well as performance of your pages
3) Using the jamon log4j Appender you can see how many calls you make to debug/info/warn/error/fatal as well as when they were last called and in addition the messages written to them can be viewed from the jamon war.
4) Any interface can be monitored via the jamon interface monitor with one line of code. For example
MyInterface my=(MyInterface) MonProxyFactory.monitor(new MyImplementation());
my.methodCall(); // any interface methods will be monitored for performance and excetpions
5) Using jamon in conjunction with AOP you can monitor any method pretty easily.
 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve,

Thanks a lot for responding to my post. You are the owner of the toolkit and the information from you is indeed valuable to me.

As I have understood, to make use of JAmon, to monitor the time taken by the methods, one has to insert a few lines of code per method (to start and stop the monitors). If the number of classes in the application are pretty large, this is still some amount of effort (unless you implement some tool to do the job). I am still looking for any option (other than the tool) which will make it even easier. You have mentioned in your reply that with AOP, it is even easier to get a method monitored. Could you please ealborate a bit how it can be done? We are not using AOP in the application as of now. A sample code would be of great help.

Many thanks in advance for your time and guidance.

Regards,
Steve
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
google aop and jamon and you should find some things. also Spring comes with a jamon/aop interceptor if you use that product. Remember also 3 of jamons solutions don't require any code changes and can be working in about 5 minutes so there is no risk: 1) JAMon jdbc driver, 2) JAMon servlet filter, 3) JAMon log4j appender which monitors info written to the log
 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many Thanks Mr Souza for your reply.

I am new to AOP hence struggling a bit. One thing I noticed for the Spring's JAmon interceptor is that it logs the monitors instead of showing on the jamon.jsp.

I would love to get the results on the jsp. Is there any way to do the same?

TIA
Steve
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring may log the jamon stats, but when you call jamon methods the data is also available via the jamon war's jamonadmin.jsp file. Simply install this war and you can see all stats. Would be nice if Spring optionally allowed you to disabled writing to the log.

For example if you made the following call it would be written to the log and viewable as a row with label "helloWorld" in the jamon report:
System.out.println(MonitorFactory.start("helloWorld").stop());
[ July 12, 2007: Message edited by: steve souza ]
 
Stephen King
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for this very important clarification Mr Souza.
Using the spring Jamon interceptor, atleast I can monitor the methods in the classes (beans) managed by the Spring container (unfortunate that the Spring AOP can not apply advices to classes that are not managed by the Spring container ).

Learnt that AspectJ can be the option for this but its not that easy to use. Could you suggest any option to this?

Many thanks in advance.

Cheers,
Steve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic