In one of my grails projects we are using Spring Batch for processing huge amounts of data. We are processing 100000 database entries in one run. When using HibernatePagingItemReader or HibernateCursorItemReader we ran into OutOfMemory errors.
Using the Eclipse Memory Analyzer I quickly found the reason for this behavior. When starting the Spring Batch Job via the JobLauncher from a Grails Quartz Plugin Job it creates a HibernateSession per default. Even if the Spring Batch jobs handle the HibernateSession correct by fetching only a few items and committing small blocks of elements per transaction all the read items are still held by outer HibernateSession of the Quartz Job.
Read more →
My colleague Andre wrote an interesting post about this topic already and I have to do a follow up. In one of our projects we followed the assumptions Andre made and we found out that there are some things you might be careful not to stumble over them.
First when experimenting with Spring bean configurations in your Grails application it is useful to change the log level for org.codehaus.groovy.grails.commons to at least warning level.
Read more →
Last year (damn so long ago? seems like last week) I wrote a post about naming strategies and reusing an existing Hibernate domain model in a Grails app. I stumbled across this because I created a Grails application that is used as a “back office” management application for our time tracking product timr.com the uses the existing Hibernate domain model classes from the Spring application. There has also been a blog post on the official Springsource blog about this where I made a comment.
Read more →
Today I encountered the problem that every time I started one of my Eclipse workspaces it always started to build the workplace and could not finish it. The progress monitor showed additional tasks waiting but I could not stop them. After killing the Java VM process several times and starting up again I searched for a solution and found this page.
I already heard about the clean command line argument and after adding it to the command line it resolved my problem.
Read more →
A friend of mine asked me why his Java batch job reading a 23MB text file took over 300MB Memory. He read some text and date values and stored them in String an Calendar objects. A short web search brought up this blog post of Jason Rennie writing about the size of java.util.Calendar. He points out that a single instance of java.util.Calendar takes 432 bytes of memory. This was the explanation – 500000 calendar objects need 206MB memory!
Read more →
Lately the amount of JavaScript in web applications has grown a lot. JavaScript has always been there but with the need of AJAX and more and more dynamical features modern web developers can not avoid it.
Luckily there are a lot of good concepts arising and libraries available (e.g. prototype, yui, …) that show how to control the JavaScript monster. Something that always bothered me was that I was not able to find a good editor for JavaScript.
Read more →
Jeff Atwood posted a link to a site that sells T-shirts and stickers with the following image:
I am thinking of ordering some of them. Handling encodings is a very important part of programming and from my experience a lot of developers do not care enough about it. I encourage every developer to read “The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!
Read more →
Lately we experienced a lot of performance problems in our AJAX applications. Since we went online a year ago we always had problems with users of Internet Explorer 6 but within the last three months they got more and more.
We already knew that this had something to do with the huge memory amount the Internet Explorer 6 uses after some hours of working with our application. I used the Process Explorer to analyze which page causes the problem.
Read more →
I developed a Midlet PokerClock. PokerClock allows you to keep track of blind levels when hosting a Poker Tournament. You can
define small and big blind and set the time for each level It counts down the time for each level and plays a sound when changing into a new level.
Give it a try: http://www.getjar.com/products/9347/PokerClock (download it directly from your mobile)
Read more →
Sometimes your web applications behave different when deployed to the application server although everything worked fine when running inside Eclipse on your workstation.
In this case it is helpful to remote debug the application. In case of using Tomcat as application server just add the following VM parameters to JAVA_OPTS:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n I do this inside the file setenv.sh in the bin directory by adding a line JAVA_OPTS="…options…"
The paramete -Xdebug tells the VM to start in debug mode.
Read more →