How to test the performance of a java application? - java

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.

Related

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 make a browser based IDE to code in the cloud?

I have read a bit about cloud and browser based IDE's.
I am planning to make a Java based bare bones IDE by integrating a compiler to code in the cloud. This is for educational purpose as I am just determined to learn to develop cloud based IDE.
I want it to be something like eclipse Orion but i want it to allow for coding in java. It should allow users to code, compile and run java programs by directly writing .java files and not by converting the .js files into java files.
Can someone please suggest me an existing cloud that I should use for this. And also, I am just a beginner and I have no clue about how to proceed and the articles that I am required to read.
Please do let me know what I should begin with and the cloud that suits my needs the best.
Thank you very much in advance.
You should look at projects like Mozilla SkyWriter, which implement the bare bones editing functionality
(There have been a lot of change lately. There seems to have been migrated to Ace)
You can use Codenvy and put your code on a Git repository. Then, you could build automatically once you have done the push using a CI tool like Jenkins. Now, I have an environment in which I use a Jenkins instance as a Service and also a runtime environment so I can get a continuous deployment pipeline. This video will show you, in a graphical way, what I am talking about.
Koding provides you with a full Ubuntu machine, with root, so it's able to run and do what you want, programming wise.
The reason i'm suggesting Koding though, is that they have a Framework to develop your IDE for the Koding VMs themselves.
The logic here, is that making IDEs is challenging, but the biggest challenges is ensuring security between your IDE users. Using another VM platform would mean that you don't have to manage the security of your VM, and focus entirely on your IDE.
Let me know what you think :)
For virtual/cloud hosting try one of the following:
Rackspace
VPS Farm
I like vpsfarm because it is cheap and pretty bare bones.
For the IDE itself, I would first create a webapp that can upload and compile and run arbitrary java code, without adding libraries or J2EE. That alone will be a good undertaking for one dev.

How mature is java.lang.instrument?

I'll be working on a project for instrumenting a relatively complex java application, and I'm planning to use java.lang.instrument to hook into the JVM and redefine classes before they're loaded.
What is your take on this package? Is it well supported across JVMs? Does it work well with Hotspot?
Thanks!
java.lang.instrument is used by many very popular frameworks and pieces of software, including:
AspectJ
JRebel
JProfiler
The java profiling extensions themselves
which leds me to the conclusion that it is save to use. (Maybe not in your in case but that wasn't the question).
I use all the given frameworks while using the HotSpot compiler, and got no problems.
If you want to profile the java application, I would suggest using existing java profilers as this API is definitely still pretty new and has some issues.
Though the following article was written in 2005, the findings pretty much are still relevant
http://www.javalobby.org/java/forums/t19309.html

Java in a Microsoft shop

I've been introduced to this wonderful project, xhtmlrenderer; the flying saucer project. Problem is, is that where I work, it's strictly a microsoft shop and I haven't done any java development since college, and a smidge of WebSphere a few years back.
I was wondering what it takes these days to do java development? I set up a quick proof of concept to see if I could do what I wanted with this project and it works great, however, I used jnbridge whose licenses are a bit on the expensive side but Visual Studio was what I had handy and got the job done with an hour of finagling.
I'm wondering what it take to do java development these days? Are servlets still the norm? Is Apache where I should start looking to get a small web server up and running? Is Eclipse/Ganymede the IDE to use?
Essentially what I want to do is pass a url to the service and have it spit back out a PDF. Just on vacation right now, and stuck on dial up, but can't stop thinking about this.
Thought I'd post these thoughts now to see if I can get a jump start on next weeks work.
Eclipse is certainly the IDE on no budget, NetBeans is also free. I prefer IDEA from Intellij, but for something that sounds like such a side part of your project, it probably isn't worth the money.
In terms of servlets, etc., it really depends on the archetecture/scalability you are looking for.
If you are looking for something that needs to run as a small web interface, then something like Jetty or Tomcat with a basic servlet should be fine.
You might be looking at something invoked via the command line, although starting a JVM for every conversion is going to be too heavy for all but the most trivial usages, but a little program that monitors a directory and pulls stuff out of it for the conversion may be what you need.
If you give more details about the archetecture and how you are planing to use it you could get some more specific advice.
In general .NET and Java development are quite similar (.NET was started to compete directly with Java, after all), but the real practical difference is that a lot of the .NET environment is kind of provided to you on a silver platter. You need a web container, you have IIS, you need a database, you have MS-SQL, You need an IDE, you have Visual Studio, etc., etc. In Java development, these are all choices to be made, there isn't really a default obvious good choice for a lot of things - there are many competitors. That can create a larger curve for a Microsoft shop than you are expecting.
Java's not all that different, although generics add some excitement; PDF with iText is fairly straightforward; and the IDE world is pretty much the same as ever. Eclipse and Netbeans are common, there are several others, and real programmers still use EMACS.
Apache is pretty generic, but with servlets in mind you might think about Tomcat.
If you want a small enough web server, you can always use an embedded Jetty. If you need the full services of Tomcat, it's also available. For Java development, I use Eclipse for an IDE. Not only is it free, but its support of refactoring is ahead of Visual Studio. Actually, if you used the WebSphere development environment, then Eclipse will be very familiar.
Consider sneaking in IKVM (http://www.ikvm.net/) as it allows you to use Java components in a .NET environment.

Is JRuby ready for production?

I just found out about JRuby, and I like the idea of running Ruby on Rails and being able to call Java libraries.
I would like to know about some experiences with running enterprise production applications in JRuby. Are stability and performance acceptable?
Thanks.
Here is a blog post from a company that created a cross-platform, multithreaded, desktop simulation application with JRuby. I think their success indicates JRuby is ready for enterprise production applications.
http://spin.atomicobject.com/2009/01/30/ruby-for-desktop-applications-yes-we-can
Actually it's pretty fast too. I'm not sure how they all compare now, but with the new dynamic invoke bytecode added to the JVM, it should become by far the fastest implementation available.
Groovy and Grails should also get a big speed boost from this pretty soon.
We're using it at our company on a large project. The major problem we find is that there isn't as large of a community built around the technology as say Java or .Net. Which makes recruiting difficult.
JRuby is among the fastest Ruby implementations right now and definitely production ready.
Here's some "success stories" from jruby.org:
http://wiki.jruby.org/wiki/Success_Stories
Jason Seifer says yes. His presentation on Ruby VM's is on InfoQ.
A look at the different Ruby virtual machines (JRuby, MagLev, IronRuby, Rubinius, MacRuby) and how to choose what fits best within the enterprise.
http://www.infoq.com/presentations/seifer-ruby-vm-comparison
The JRuby Wiki has moved to Kenai. The success stories page can be found here now:
http://kenai.com/projects/jruby/pages/SuccessStories

Categories