« Tools We Use at FeedBurner | Main | Wanted: Chicago Java Programmers »

Spring JdbcTemplate Gotcha

In one of our recent profiling use cases, I noticed that twice as many ResultSet objects were being created than I expected, and that half of them were being created in the PreparedStatement.getWarnings() method. Turns out that we were using the Spring JdbcTemplate class (version 1.2.5) in one of our tight loops, and it calls PreparedStatement.getWarnings() after every execute, even if setIgnoreWarnings() is set to true.

Rewriting that section to not use the Spring framework gave us a 2.4% increase in throughput. Not earth-shattering, but it just goes to show that it's worthwhile to include the frameworks you depend upon in your optimization efforts.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)