Java Performance Tuning

Java(TM) - see bottom of page

|home |services |training |newsletter |tuning tips |tool reports |articles |resources |about us |site map |contact us |
Tools: | GC log analysers| Multi-tenancy tools| Books| SizeOf| Thread analysers|

Our valued sponsors who help make this site possible
New Relic: Try free w/ production profiling and get a free shirt! 

Site24x7: Java Method-Level Tracing into Transactions @ $12/Month/JVM. Sign Up! 

News September 2014

jKool for DevOps
Light up your Apps & get a cool t-shirt

JProfiler
Get rid of your performance problems and memory leaks!


Java Performance Training Courses
COURSES AVAILABLE NOW. We can provide training courses to handle all your Java performance needs

Java Performance Tuning, 2nd ed
The classic and most comprehensive book on tuning Java

Java Performance Tuning Newsletter
Your source of Java performance news. Subscribe now!
Enter email:


New Relic
New Relic: Try free w/ production profiling and get a free shirt!

Site24x7
Site24x7: Java Method-Level Tracing into Transactions @ $12/Month/JVM. Sign Up!


jKool for DevOps
Light up your Apps & get a cool t-shirt

JProfiler
Get rid of your performance problems and memory leaks!


Back to newsletter 166 contents

I recently needed to get a sizeof implementation for Java objects. I needed to get a "deep" size, so that I could see how much memory a particular object was retaining. So I searched for implementations and found several different approaches. I ignored the ones that needed to use native calls of one type or another, I was looking for a Java implementation; and I found three main types of implementations.

A note from this newsletter's sponsor

New Relic - Try New Relic today and get your free Data Nerd shirt!
Free SaaS APM tool to monitor, troubleshoot, and tune apps
running on Websphere, Weblogic, Tomcat, Jetty, JBoss, Solr, Resin

Firstly, there's the old "use reflection and guess based on the known primitive data sizes and overheads" technique, which goes back about 15 years, though seems to have been most popularised by some Javaworld articles (see the tools section below for that and all the rest). Next is the "agent" based technique which Heinz Kabutz first popularised in his newsletter about 7 years ago. And lastly, more recently, are "unsafe" techniques developed in the last few of years.

After going through them, I tested them for my purposes and found that the carrotsearch 'unsafe' one was both the fastest and churned the least memory (ehcache's 'unsafe' implementation was close).

Note the drawback is that using unsafe is potentially dangerous - if the implementation is flakey or the JVM internals change, it'll most likely crash the JVM. Whenever using 'unsafe' based tools, it's worth bearing in mind Gil Tene's graphic description of using unsafe: like using scissors which have the obvious warning label saying "not safe for poking at one's own eye" to then poke at an itch in your eye.

See the tools section below for the links to those sizeof tools, and see all our usual sections: links to articles, news and as ever, all the extracted tips from all of this month's referenced articles.

A note from this newsletter's sponsor

Get total visibility in just 15 minutes with AppDynamics PRO,
A performance monitoring tool for Java/.NET apps.
It installs in minutes. Start your FREE TRIAL today.

News

Java performance tuning related news.

Tools

Java performance tuning related tools.

(Note the Lucene one is not listed as the carrotsearch one is an extracted version of that.)

A note from this newsletter's sponsor

Site24x7.com : Deep dive Application Performance Monitoring
Fix performance issues with Java, .NET and Ruby platforms.
*** Monitor one app instance starting at $9 ***.

Articles

Jack Shirazi


Back to newsletter 166 contents


Last Updated: 2017-05-01
Copyright © 2000-2017 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/news/news166.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us