Performance tuning – the server side java symposium

The presenter started with a disclaimer.  Not for legal like Oracle.  To emphasize that advice needs common sense and to be checked for applicability to your system.

Applications are slow because they are waiting for something. Need to find out what that is.  We generally start looking in our application. But we should start with a larger view of hardware/os,  jvm/memory, and actors/usage patterns.

Tips

  • Make sure your test system is as close to production as possible. This includes the amount of data so you aren’t caching away your problem. In other words, you want to make sure you are solving the right problem.
  • keep going until meets requirements or user decides to stop paying for performance improvements, whichever comes first
  • Remember to benchmark before/after each change so know if worked and the impact
  • Know how much CPU you can use. Even if you are only using forty percent, adding CPU does not help if you are only allocated forty percent
  • Knowing which process using CPU helps. Is it your algorithms or the JVM for garbage collection or nothing in which case it is waiting on some other resource
  • After CPU, go on to other diagnostics such as memory, paging, etc
  • Want system to be calm when testing so can use CPU as a benchmark

The Tooling
The presenter ran an example to walk through the tools

  • Added XX:PrintGCDetails
  • JMeter – shows average time for points of interest real time. Both in numeric format and in a running graph.  Found an out of memory error. Noted better to analyze garbage collection before increasing memory
  • VisualVM – use memory profile to profile object allocations and GC. The count will show objects leaking because it will survive every attempt to collect and create more. The increasing generational count will show the leak.  Note you can instrument every X counts instead of each one to save space.  Can see it happen real time as you run.  Then you can take a snapshot [ the snapshot view is what I’m used to seeing for CodeRanch work]. The monitoring tab shows in graphical format. the heap analysis shows all instances of objects of a certain type. Pick on at random and see heap walk. Select nearest GC root, this takes a minute or so.  The GC root is what is anchoring it to live memory.
  • Visual VM – use threads view to see if thread pool can be increased. Are there enough threads servicing the number of users?  One way to tune is to set the thread pool size larger and then scale back until it is good.
  • GC.log – a number of graphs on garbage collection statistics – how long it takes, distribution, etc
  • Censum – garbage collection log analysis tool that hasn’t been released yet. It shows stats and distributions on the generations

Fixing the jcp – the server side java symposium

The official title of this session is “The Java Community Process – What’s broken and how to fix it”.  The panel is James Gosling, Patrick Curran (head of the jcp) and Reza Rahman (member of jcp expert groups and author of EJB in action)

What’s wrong

  • Some inherent because so many priorities and agendas. these predated Oracle
  • Apache Harmony TCK issue (Apache Geronomo doesn’t pay for TCK because non profit open source. The problem with Harmony is that it has restrictions). Reza would like to see it free, no strings attached after the lawsuit.
  • Patrick said Oracle is more forceful than Sun in that they make a stand rather than bicker forever
  • Reza said James is too bright but not practical enough :). He views Oracle as being more practical. Reza noted leading is hard and getting people to agree is hard. He views Oracle leading as a necessity because they have the resources to be a JSR lead.   James noted being a spec lead is a full time job even if things go smoothly.
  • In 2007, Oracle tried to create an organization so sun would have less power. Now that they are in charge, they want to retain ownership. Logical position at least.
  • Process issues -greater transparency so don’t have to be a JCP member for read only view
  • Reza views a big problem as lack of individual participation in the JCP. Reas the proceedings, blog, be spec leads, etc. Democracy is participatory [yes, but this isn’t a democracy, right after i wrote this Cameron noted SpringSource and Google are leading by example. Reza said that sounds like Microsoft. and it does.  Except that Sun copied from Spring extensively. James noted that innovation in the String class would be dangerous]

What could be better

  • Reza recognized it is hard to have an independent JCP. It requires resources, a way to move forward without veto bpower, etc
  • Patrick noted that all standards groups have these political obstacles because companies or countries have different interests. The fact that they are trying to work together is a good thing.
  • Patrick noted things are better than they look. Some groups have mailing lists that be read.  Oracle is looking at making things more open and expect to mandate transparency via an open mailing list. Similarly for formally tracking comments. The executive committee has been publishing minutes for several years.
  • Patrick noted they are looking at making it easier to join. In particular, creating a simpler legal agreement for non-spec lead roles
  • Patrick pointed out standards take time. It is more important to get it right than fast. It is avoiding unnecessary waste that matters

audience questions

  • Role of spec evangelist separate from spec lead?  Reza said don’t need formal role. Independents on JCP should blog and do this
  • More people shipping products dependent on platform?  oracle working on balance. Also looking at letting java user groups join so members can contribute
  • What can someone do to help without spending a lot of time?  Follow JSR interested in. Read the spec and comment without joining group. Mny JSRS are open source comments. Reza listed following jee articles on theserverside and javalobby and leave comments for actual jcp members to read and convey. Similarly for the comment period. [this was my question, a lot of the answers sound quite time consuming to me. Reza did list a short one which I appreciate]
  • Developers wait until something is stable to try it because working our own problems. By then it is late in the game to comment. Everyone agreed the proposed final draft and reference implementation IS that

java in flux – the server side java symposium

Oh look.  The ten line Oracle disclaimer is back.  At least this talk contains some forward looking statements where it makes sense to have the disclaimer.

Communication
Oracle recognizes they have issues with communicating late/poorly.  They have a culture of saying little and sticking to it.  Whereas Sun had more dialog.  They acknowledge it; will be interesting to see what happens.

Priority

Want to keep Java vibrant to keep making money.  Said will continue move to Open JDK.  Moving JRockit features to OpenJDK.

Other topics

  • Looking at support for multiple cores at the CPU level.  Think parallel collections and lambda/closures will be good candidates for paralleilization
  • Let ideas mature in more experimental languages
  • Reiterated pledge to backward compatibility
  • Covered what’s new in Java 7 at a high level – most I had heard before – the more lightweight garbage collector was new to me
  • Java 8 – more modularization, project lambda(closures), annotations on Java types and more small language enhancements
  • Java 9 – really speculative – forces on platform independence with hardware virtualization, better interoperatibility with non Java languages, improved data integration, improved device support
  • Looking to expand Java FX [surprised]

JEE

  • Want JEE 7 done before Java 8 comes out which is end of 2012
  • Looking at what can do for modularity in JEE 7 before “real” modularity comes out in Java 8
  • Compared Java to .NET.Azure including areas like Cloud and multiple language support where Microsoft doing better
  • Covered the problems it was designed to solve and how it got so big that it isn’t simple anymore. Going back to POJOs, dependency injection. [again making it sound like this stuff just sprung up from developer complaints]
  • Showed timeline from 1998 and J2EE 1.2.
  • Recognized innovation is occurring on the outside and the platform stewards/Oracle need to reuse that to avoid becoming irrelevant
  • Customers win when there is interoperability and vendor choice
  • Companies want to build internal clouds – solutions starting to be built on Java Also noted cloud gives new JEE roles of data center and tenant roles. (in addition to things like deployer) In addition, noted the existing JEE APIs need to become tenant aware. Such as how to discriminate within a table what rows are associated with what tenant in a JPA entity. Maybe in JEE 8