Differences between a java profiler and spring insight? - java

I am working on a java project which is based on Spring and Hibernate frameworks. Recently we have some performance issues and we want to have a deep visibility into the app. Currently we have Spring Insight on our test environment that helps us towards that. But I also want to know a bout the features of a java profiler that we can take benefit of that. I couldn't find a good source that explain what are the differences between a java profiler framework with spring insight. Can anybody explain the differences? Thanks.

For Spring Insight, I will say that I have used it with my Spring applications and its important prerequisite is that it will be deployed as a web application in TC Server. After installing and setting it up in a TC Server, I deployed the application on the TC Server instance and browsed to the Insight interface where I could monitor my application’s flow. It gave me a nice flow layout of the classes and methods. It showed me how much time the methods took to complete, I could see the values of input parameters as well as the return values.
Coming to your question I will suggest that choice of profiling tools totally depends on your requirement. If you have Spring based application the right choice is clearly the Spring Insight. It is free for development purposes, but your application needs to be deployed on the TC Server.
If you want more freedom in monitoring local and remote processes you should go for JProfiler or YourKit. These two can also assist the Spring Insight monitoring in your conquest in finding performance bottlenecks. JProfiler and YourKit also provides the monitoring of memory usage which Spring Insight does not provide.

Related

Suggestions on architecture to monitor services and databases

I am trying to make a monitoring system for JAVA web services. It would be a simple switch kind of system where based on the health of a service it would report 'RUNNING', 'CRITICAL' or 'UNSTABLE'. The challenge is integrating it with existing code. While calling an endpoint with the data would be the easiest, I am not too keen on going down that path because it would require too many changes to the source code. Instead I was looking at run-time injection. Your suggestions on coming up with an architecture would be very helpful. Thanks and let me know if you have questions.
EDIT: Tips on how to extend it to monitor stored procedures in an Oracle DB would be great too.
There is a common answer for such kind of question: just try JMX.
If you already use such frameworks like Spring - feel free to use Spring JMX there.
Aslo you can built your application into OSGi framework if it suits to you (here you can also use JMX layer for that).

Alternative to Spring in smaller applications

I like to work with Spring features like #Component, #Autowired or ApplicationContext even in smaller applications (like batch applications).
I've read that Java EE 6 is now a viable alternative to Spring in enterprise applications. Is that also true for smaller ones? What would be the corresponding alternatives to the features I've mentioned above?
Java EE 6 is not going to be any lighter that's for sure. In the Java EE space look at jBoss Weld. But really good alternate and in lighter weight is google Guice.
The Java EE 6 Web Profile is suitable for very small applications. TomEE is a good example, it's only some 25MB and runs in 64MB of memory.
Being mostly POJO and annotation based with a good dose of convention over configuration, the programming model is also very light and easy to understand now.
Play Framework is also a good recommendation for a smaller application. Its main feature is Hot Deployment. And its view technology is like Grails. Its pretty good.
Hope this helps you. Cheers.
DataKernel might be a great option in your case. From the site:
DataKernel is a full-featured alternative web and big data Java framework.
A set of predefined launchers and classes for typical use cases allows you to develop apps extremely fast. Create an async HTTP server in less than 15 lines of code with no additional configuration files.
They also have their own Dependency Injection with quite impressive benchmarks:
DataKernel DI is lightning-fast: 5.5 times faster than Guice and up to 100s times faster than Spring.
Note that DataKernel has quite a different approach comparing to Spring framework, it is more like Node.js-inspired

spring insight with org.codehaus.paranamer

I have a java spring GWT web application. I need to use a profiler to view why is a certain function that slow (on server)... After some searching, seems that insight is a good way... tried it and it works... what I did is create a tc server instance (developer edition) with insight and add the project to it. It works.
The problem here is that I use maven plugin "org.codehaus.paranamer", that is a plugin that I use to get function paramater names... It works post-compilation to add a special private field in the class that holds the parameters names.
This is a problem with insight since it seems that it modifies the code too and that it works on the source code not the compiled version in the target folder.
What I can do to make this work? FYI, all I need is profile the app.. not necessarily with insight....
Edit:
I ended up using visualvm... It can help with profiling the app on the cpu level and the memory level... That is the way I can use the common remote profiling mechanism jerry was talking about.
For profile of JAVA apps(including tomcat instances), I strongly recommend the TPTP(Eclipse Test & Performance Tools Platform). You can read a lot here:
http://www.eclipse.org/articles/Article-TPTP-Profiling-Tool/tptpProfilingArticle.html
Especially for TPTP working with tomcat instance:
http://www.deepakgaikwad.net/index.php/2009/02/10/tutorialprofiling-with-tptp-and-tomcat.html
Some of the information in the above article may be outdated, but main workflow is the same.
For commercial profilers, I will recommend yourkit profiler: http://www.yourkit.com/
I don't know if there is a trial edition available now, but years ago, this profile is more user friendly than TPTP.

How to test the performance of a java application?

I've created a stand alone java desktop application using Netbeans. I want a way to test the performance of my application. I need some tool with the help of which my application can be evaluated. I heard about Software metrics, is this related to my context. Or is there any tool or plugin available in Netbeans through which I can test.
Have a look at the Netbeans Profiler:
http://netbeans.org/features/java/profiler.html
Netbeans has one of the best profilers going for Java apps, it runs well and provides as much detail as you want. Since you're using Netbeans I'd take advantage of it!
In terms of tutorials, there's one here about memory leaks and how to debug / discover them using the profiler. Once you get going with it the other features should come pretty easily.

java ee server similar to cassini

I primarily use Tomcat and Glassfish for Java EE development at work, but was wondering if anyone knew of any small application servers like Cassini for ASP.NET that would make building and testing faster? I would still eventually deploy to one of our production tomcat/glassfish servers, but would prefer something that is simpler and quicker.
I am probably going to take jetty and geronimo for a spin, any others I should check out?
You might want to check out JRebel which eliminates the need to do a redeploy on ~80% of the cases, making the development quicker.
jetty is good for testing, because it's very easy to start a jetty instance in your tests. if you're also concerned about faster development, then the choice of server is not the only factor.
there's also jonas and resin
This may not answer your question directly, but you may want to consider alternative Framework/Server combinations.
Here are a few Java RAD stacks that I have used in the past and work very well when trying to achieve a rapid development -> build -> test loop:
Spring Roo
Grails
Play Framework
Granted, these are not application servers in their own right, but each of them are frameworks/servers that can be used to achieve the results you are looking for. Roo and Play are both Java based, and Grails is Groovy based.
None of these solutions will work if you are looking for a plain container to deploy your application in to. These are more like all in one solutions.
(...) but was wondering if anyone knew of any small application servers like Cassini for ASP.NET that would make building and testing faster?
You should have a look at this Short screencast on GlassFish v3 session redeployment that shows the session state preservation across redeployments in GlassFish v3. Combined with the "deploy-on-save" feature (vs build and redeploy) offered by the GFv3 IDE plugins for NetBeans or Eclipse, Java EE development is very productive (even if GlassFish is not the fastest to start but well, you don't have to start it that often).
I was a big fan of Jetty but I must say that I just love these two features and consider them as direct answers to your concerns.

Categories