Archive for the ‘java’ Category
This is one of these notes to self that I keep writing on the blog…
Add the following java options when launching an application (or application server) to get a dump if the application throws an OutOfMemoryException
We are using this on out local and development servers at work, and then using Eclipse MAT to diagnose the cause.
So far, it is been a pleasure working with MAT. We are maintaining some legacy web application which occasionally crashes due to OOM, so we took a dump and fed it to MAT.
Despite of my attempts to look at the wrong places (since we got OOM) on a webservice, MAT kept showing me our real memory problem until I understood it. The exception on the webservice was only collateral damage… most of the memory was being used in the tests run before the actual crash.
Now we save more than 2.5Mb on each http session, since it turned out that the application was caching too much, too many times (on every session, instead of sharing the data at the application level).
Sometimes you spend time developing and testing your new bundle using the runtime workbench launched from the same eclipse, and everything is fine… until some user installs that bundle and finds that it does… nothing!
The OSGi console is a great help in such cases. The `diag` command can tell you what’s wrong. Usually it is a dependency that is missing.
Start by launching eclipse from the command line with the
-console command line option.
diag your.bundle.id, and you’ll see eclipse telling you what’s wrong.
I’ve collected the following bits of information regarding the tunning of Oracle when used with Hibernate performance… it might help someone (and I need to write it down somewhere I won’t loose when moving from a desk to another!).
The following properties should be set:
# See http://martijndashorst.com/blog/2006/11/28/hibernate-31-something-performance-problems-contd/
# NOTE: See http://opensource.atlassian.com/projects/hibernate/browse/HHH-3359
hibernate.jdbc.wrap_result_sets = true
# See http://www.hibernate.org/120.html#A10
hibernate.dbcp.ps.maxIdle = 0
hibernate.c3p0.max_statements = 0
# Everything else comes from http://docs.codehaus.org/display/TRAILS/DatabaseConfigurations
# The Oracle JDBC driver doesn't like prepared statement caching very much.
# or batching with BLOBs very much.
I have not tested the performance difference… just collected the information.
Let me know if you know more tricks!
Update: Added a warning about a memory leak in current hibernate, thanks to dfernandez.
Update 2: Statement caching for Oracle can be enabled directly on the datasource implementation. See this article.
Q for Eclipse, or q4e for short, is an open-source and open-development eclipse plug-in for bridging the gap between Eclipse and Maven. It is available from its google code home.
Since we believe that every eclipse user should be able to enjoy the benefits of using maven, we’ve proposed IAM (Integration for Apache Maven) as a new Eclipse project. Of course we offered q4e as an initial code contribution for the project. The proposal is discussed on its eclipse newsgroup (you’ll need to get a password from eclipse).
We’ve been working towards becoming a good candidate for an Eclipse project. The number of committers and the overall project activity has been growing, we’ve provided WTP integration, allowed sophisticated dependency analiysis… and much more.
Now, we’re gearing towards the final step for donating q4e source to the IAM proposal… getting IAM into the eclipse incubator.
For this, we needed two eclipse mentors.
Well, we’ve got three
- Ed Merks, IBM: Eclipse EMF
- Thomas Watson, IBM, Equinox
- Brett Porter, Exist Global: Maven PMC, Apache member,…
Being an official Eclipse project can only bring good things to q4e. Since we will have more eyes on the project, more enhancements will be requested and more hands will join in.
If you use q4e, feel free to write some quotes on the IAM group. We always like to know who’s using q4e and where!
Exciting times are ahead!