Discussions

News: JAMon 1.0: Java Application Monitor Released

  1. JAMon 1.0: Java Application Monitor Released (21 messages)

    JAMon 1.0, an open source Java Application Monitor, has been released under a BSD license.

    "JAMon is a free, simple, high performance, thread safe, Java API that allows developers to easily monitor production applications. JAMon can be used to determine application performance bottlenecks, user/application interactions, and application scalability. JAMon gathers summary statistics such as hits, execution times (total, average, minimum, maximum, standard deviation), and simultaneous application requests. JAMon statistics are displayed in the clickable JAMon Report.

    JAMon was developed primarily for monitoring J2EE applications, however it can be used in any JDK 1.2 or higher environment. JAMon can be used in Servlets, JSP's, EJB's and Java Beans in various J2EE Application Servers (Sybase's EAServer, and BEA's WebLogic,…), and can also be used in other programming environments that can call Java code (ColdFusion, PowerBuilder, BroadVision, ...)."

    To use JAMon you simply plugin the jar file and:

    import com.jamonapi.*;
    ...
    Monitor mon=MonitorFactory.start("myFirstMonitor");
    ...Code Being Timed...
    mon.stop();

    Check out the JAMon API at: http://www.jamonapi.com

    From there you can read about the API, see many code examples for monitoring your J2EE applications, and download the code.

    Threaded Messages (21)

  2. Jboss support[ Go to top ]

    You say JAMon can be used in Servlets, JSP's, EJB's and Java Beans in various J2EE Application Servers (Sybase's EAServer, and BEA's WebLogic,…). Do you support Jboss? If so, how far back - Jboss 3.2.6? I couldn't find this in the documentation. Thanks.
  3. Jboss support[ Go to top ]

    It supports any app server, it's just a jar you call, much like log4j.
    .V
  4. Exact Time Measuring[ Go to top ]

    It is possible to filter GC noise and concurrency issues:
    http://www.javaworld.com/javaworld/javatips/jw-javatip92.html

    Wouldn't it be useful to be able to use this tool (though it needs some native code)?
  5. Timing and Java :-([ Go to top ]

    The last week I have been investigating the whole thing.

    Have a look a the following articles:

    "My kingdom for a good timer!"
    http://www.javaworld.com/javaworld/javaqa/2003-01/01-qa-0110-timing.html

    Unfortunately there exist chipsets that cause time slips when using QueryPerformanceCounter and may lead to this code not delivering the right results:
    http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q274323&

    And a nice read also (although not directly related):
    http://developer.java.sun.com/developer/bugParade/bugs/4423429.html

    It's not that easy.
  6. Timing and Java :-([ Go to top ]

    interesting article on the timing of java applications. though, i think it's fairly safe to assume (here in a _server_side forum) that lots of people are concerned with applications developed on win2k and being migrated to sun or other unix based systems for production.

    also, a major concern is where is a bulk of time being spent in a page that takes 30 seconds to get to the user. it seems the JAMon product would be extremely helpfull in this respect.
  7. Timing and Java :-([ Go to top ]

    I didn't say anything about the usefulness of JAMon. My post was a direct reply to Christian Meier's post "Exact Time Measuring" and especially the URL he provided. Maybe, I should have made that clearer.
  8. Timing and Java :-)[ Go to top ]

    By coincidence I just came across a Bug-Report which states that Java 1.5 will include a high precision timer. Very nice. I hope it will work. That would be :-)

    http://developer.java.sun.com/developer/bugParade/bugs/4478186.html
  9. I find this thread (and all its pointers) very interesting. Did anyone test the System.nanoTime() method introduced in JDK 5.0? Does it solve some of the limitations of currentTimeMillis()? Sun is not exactly clear about the reliability of this method...
  10. ripe for AOP[ Go to top ]

    Could the JAMon team (or an enterprising individual with spare cycles) perhaps integrate JAMon with the AOP framework of their choice? Anytime you see code like:

    start()
    //do that stuff
    stop()

    it's ripe for an AOP solution
  11. Can you wait?[ Go to top ]

    Already in progress. The product will be released in early 2004. Based on AspectJ and JVMPI (and eventually JVMTI).

    What differentiates our solution is

    - standard Java enterprise (transactions, requests...) contextual information is appended at pointcuts (trace points)
    - high quality visualization tool similiar to JDBInsight (not a simple log viewer)
    - API for attaching additional application information for fine grain pointcuts (code blocks)
    - resource costing API
    - SPI API for extending the framework
    - XDoclet support
    - price (unfortunately not all good things in life are free, ;-))


    Regards,

    William Louth
    Product Architect
    JInspired

    "Test, Trace and Tune with Insight"
    www.jinspired.com
  12. ripe for AOP[ Go to top ]

    Here it is ,a monitoring aspect using JAMONAPI and ASPECTWERKZ.
    It allows you to output the monitoring statistics for the methods
    specified by the pattern pointcut defined in the XML file.

    The output looks like :
    PackageName.ClassName/MethodName:0 ms. (Hits=4 Avg=0 ms. Total=0 ms. Min=0 ms. Max=0 ms. Active=0 Avg Active=1 Max Active=1 First access=12/18/03 8:53:07 PM Last access=12/18/03 8:53:07 PM )

    The following was tested on JBOSS,WEBLOGIC and BROADVISION ,application servers that I usually use for my customers.

    Enjoy,Claude Hussenet
    Email:chussenet at yahoo dot com

    import org.codehaus.aspectwerkz.xmldef.advice.AroundAdvice;
    import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
    import org.codehaus.aspectwerkz.joinpoint.MethodJoinPoint;
    import com.jamonapi.MonitorFactory;
    import com.jamonapi.Monitor;
    public class MonitoringAdvice extends AroundAdvice {
    public MonitoringAdvice() {}
    public Object execute(final JoinPoint joinPoint) throws Throwable {
    MethodJoinPoint jp = (MethodJoinPoint)joinPoint;
    Monitor monitor = MonitorFactory.start(jp.getMethodName());
    final Object result = joinPoint.proceed();
    monitor.stop();
    Object targetInstance;
    String className = null;
    if ((targetInstance = jp.getTargetInstance()) != null)
    className = targetInstance.getClass().getName();
    System.out.println(
    new StringBuffer(className == null ? "" : className)
    .append("/")
    .append(jp.getMethodName())
    .append(":")
    .append(monitor)
    .toString());
    return result;
    }
    }
     <aspectwerkz>
       <system id="ServerSideSample">
        <advice-def name="monitoringAdvice"
         class="MonitoringAdvice"
         deployment-model="perJVM"/>
        <aspect name="monitoringAspect">
        <pointcut-def name="monitoringPointcut" type="method" pattern="* PackageName..*.*(..)" />
           <bind-advice pointcut="monitoringPointcut">
                <advice-ref name="monitoringAdvice"/>
            </bind-advice>
        </aspect>
        </system>
    </aspectwerkz>
  13. The battle for acronyms has ended: JAMON??MY god..., http://www.jamon.com/

    Will we ever come to a compromise to elude the use of more and more acronyms?
  14. Too many acronyms?[ Go to top ]

    YAFA? ;)

    Peace,

    Cameron Purdy
    Tangosol, Inc.
    Coherence: Clustered JCache for Grid Computing!
  15. JAMon Various[ Go to top ]

    I'll try to answer a few of the questions concerns in this thread.

    First of all JAMon works in ANY JDK 1.2 or higher environment. This means it will work in all APP servers including ones I didn't explicitly state (for example jboss). I've even called it from other languages (PowerBuilder, ColdFusion, BroadVision, PHP).

    I think submillisecond timing is overrated for most Performance tuning exercises (at least in database business apps). For example if my web page takes 1 second (1000 ms.). then tracking anything that takes less than 1 ms. is and making it faster will at best improve your code .1%. A waste of time.

    For events that happen many times (i.e. timing web pages, and jdbc connections in a java web app) the fact that the java timer sometimes has course granularity (say 10 ms.) is also not a problem. Let's say you measure an event 5 times with the following values returned: 10 ms, 0 ms, 10 ms, 0 ms, 0 ms. If you take the average of the 5 events you get 2 ms, so even though each individiual timing is off the average becomes quite accurate after a relatively small number of timings.

    I'm not sure what AOP is? What is it? Claude thanks for the code posting for ASPECTWERKZ.

    Here are about as useful a 2 lines of code I've seen for web application performance and tuning. It is a servlet filter that times ALL file resource access from a WAR (i.e. JSPs, Servlets, HTML, GIFs, JPGs, ...). http://www.ssouza.com/fdsapi/JAMonFilter.java.

    Also remember JAMon can be used for more than just timing things. One example is to count all connections opens/closes and to see that they match. It can also measure scalability. The jamon home pages goes into other uses of JAMON.

    Remember JAMon is at http://www.jamonapi.com NOT http://www.jamon.com. Unfortunately they already took the address. However you gotta love that picture of the ham! It gets harder and harder to come up with names. My first 5 choices were all taken.

    http://www.fdsapi.com - The easiest way to generate dynamic text including HTML and XML.
    http://www.jamonapi.com - A performance tuning and scalability testing API.

    Steve
  16. JAMon Various[ Go to top ]

    I'm not sure what AOP is? What is it? Claude thanks for the code posting for >

    >ASPECTWERKZ.

    AOP is stand for Aspect Object programming.
    There is a good article in the JAVA Developer Journal of this month
    regarding AOP.U should take a look and see that the function of
    profiling code such as method count,response time and so on,is
    the common example that people use to introduce AOP.

    So, the code posted allows u to profile a JAVA application using the Statistics capabilities of JMONAPI without changing one line of code.

    Rgds,Claude
  17. JAMon Various[ Go to top ]

    I will look at the article. One suggestion for the code you posted is to not always log the monitoring stats. You can get the same monitoring data that is viewable via the JAMonAdmin report by using the following method:

    Object[][] data=MonitorFactory.getData();

    Or make whether it prints or not a configurable parameter.

    A coworker has used jamon to time Ant tasks. Any task that starts with jamon is automatically timed.

    Steve - http://www.jamonapi.com
  18. AOP with Jamon[ Go to top ]

    I'm not sure what AOP is? What is it?


    The idea of AOP is similar to the servlet filter but instead of HTTP messages you intercept method calls.

    You can do this with a standard JDK (I'm not sure since wich version) using dynamic proxies. Here is an example:

    import java.lang.reflect.InvocationHandler;
    import java.lang.reflect.Method;
    import java.lang.reflect.Proxy;

    import com.jamonapi.Monitor;
    import com.jamonapi.MonitorFactory;

    public class MonitorProxy implements InvocationHandler
    {
    private Object target;

    private MonitorProxy(Object target)
    {
    this.target = target;
    }


    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
    {
    Monitor mon = MonitorFactory.start(method.getName());
    Object result = method.invoke(target, args);
    mon.stop();
    return result;
    }


    public static Object create(Class interfase, Object target)
    {
    return Proxy.newProxyInstance(interfase.getClassLoader(),
    new Class[] {interfase},
    new MonitorProxy(target));
    }
    }


    Then, you just have to wrap the object you want monitorized with a call to the method MonitorProxy.create.

    For example, if you wanted to monitorize all the methods of a ResultSet you would write something like this:

    ResultSet rs = stmt.executeQuery(...)
    rs = (ResultSet) MonitorProxy.create(ResultSet.class, rs);

    And that's all!

    I've been playing with this little class and your JSP viewer, and it has been very funny. Try it!
  19. AOP with Jamon[ Go to top ]

    I changed the code above to stop monitors if an exception is thrown.

     
     import java.lang.reflect.InvocationHandler;
     import java.lang.reflect.Method;
     import java.lang.reflect.Proxy;
     
     import com.jamonapi.Monitor;
     import com.jamonapi.MonitorFactory;
     
     public class MonitorProxy implements InvocationHandler
     {
      private Object target;
     
      private MonitorProxy(Object target)
      {
      this.target = target;
      }
     
     
         public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
          Monitor mon = MonitorFactory.start(method.getName());
          try {
              Object result = method.invoke(target, args);
              return result;
          } finally {
           mon.stop();
      }
         }
     
    Steve - http://www.fdsapi.com - The easiest way to generate dynamic HTML and XML
     
      public static Object create(Class interfase, Object target) {
      return Proxy.newProxyInstance(interfase.getClassLoader(),
      new Class[] {interfase},
      new MonitorProxy(target));
      }
     }
  20. Can some one tell me if this monitor (JAMon 1.0: Java Application Monitor) will work on IBM Z/OS mainframe platform. We are running z/os 1.4. ..... Regards, Wasim
  21. JAMon works in any jdk 1.2 or higher environment.
  22. jamon on PDA's[ Go to top ]

    hi

      I was seeing this thread regarding Jamon and it gave me a lot of info.i would like to thank the starter and all the participants of this thread.Hoping that you can also help me.

    MyBackground :
    1.
       I am a Student and a involved a little in java Programming.

    2. New to performance related issues and aspectwerkz etc..

    so my QUESTION is
        I think this jamon supports Tomcat server.isnt it?(i have read that it supports all app servers,but just asked for conformation to know whether someone has used with tomcat)

       And i have a j2ee application running on PDA's , i would just like to know whether this would be useful for measuring performance of j2ee applications on pDA's?

      Is it not possible to find memory leaks using Jamon?

    i am very sorry if my questions are stupid,that is the reason why i have mentioned my background.I have posted in many forums to find whetehr there exists any tool to measure performance on pDA's,but could not get any good reply.

     hoping for a response from you.

    thank you
    Reddy