4 October 2012

Java One Day 3 thoughts

I feel there is a distinct lack of interesting sessions today and the number of sessions seems smaller than yesterday. Looks like I have quite big gaps in the schedule where I can't find a session of interest.

In Memory Data Grids Best Practices
Talip Ozturk (Founder Hazelcast)

Talip spent some time discussing the key features of IMDG which he considered important with no surprises;
  • Embeddable
  • Native Objects
  • High Performance
  • Distributed
  • High Scale
When looking at scalability initially throughput will drop as you move from single node to 2 nodes then linear scalability kicks in. This is because when you move to 2 nodes distribution kicks in. Obviously a single node has a limit on data.

Common features of Data Grids are;
  • Distributed Maps
  • Eviction
  • Code Execution
  • Listeners
  • Queries
  • JPA L2 cache
  • Transactions
  • Backing Cache Store - write behind, write through and read through
Deployment models of Data Grids are remote or embedded. Embedded is great for quick deployment and getting started however remote data grids are better as the grid is isolated and the GC requirements for the grid are usually different to the GC requirements of an application.

Most of the talk was a summary of C2B2's data grid workshop with no real insights. 

Innovative Testing Techniques with Byte Code instrumentation

Talk about using ASM to do Byte Code injection when doing testing. BCI can replace method bodies or replace whole classes without changing the underlying code. Limitations of BCI are;
  • Fields can't be added or removed
  • Methods can't be added or removed
  • Method signatures can't be changed
  • java.lang classes can't be modified
Techniques BCI can be used for are;

Testing exception handling
 Many exceptions are difficult to set up in a test environment. However Byecode injection can force exceptions to occur in your tests.The technique is to manipulate the class that throws the exception using BCI to force the throw. Using a Java agent on the command line of the JVM the agent manipulates the bytecodes of the classes as they are loaded.

Testing memory exhaustion
Similarly you can byte code inject a class to throw an OOME at a point in time or under certain conditions in the system under test.

Testing secure paths through the code
Test difficult to reach codepaths in large scale applications.

Tools are available to help with generating asm code. ASMifier is an Eclipse plugin which can turn a method in your class and show it as the ASM code you would need to implement the Java code.

Diagnosing your applications on the JVM
Staffan Larsen Oracle

The session was about tools available to diagnose application problems that come with the JDK. In retrospect I shouldn't have attended this talk as use of these tools is bread and butter for C2B2. However future tools and new insights were;
jcmd came in JDK 7 which I have blogged about previously,

jcmd 0 will send the same command to all Java processes running e.g.
jcmd 0 uptime
jcmd also has a help by running
jcmd 0 help <command> 
jcmd 0 VM.flags all
however not many of the jrockit commands have been ported over yet.
jcmd 0 thread print also has deadlock detection and will print out deadlocked threads it also works with java.util.concurrent locks
jcmd 0 PerfCounters.print prints all the raw performance counters in the JVM
jcmd 0 GC.heap_dump <filename>

JVisualVM can compare two heapdumps to detect histogram changes in object counts which can be useful in working out what classes are leaking.

Futures;
Java Flight Recorder is coming but only as a license option in Java SE advanced. 
Java Mission Control is also coming to JavaSE
jcmd will have more commands and this will replace all the other j* tools
JMX 2.0 is having more life breathed into it
improved logging which I've mentioned in the first day blogs
Java Discovery Protocol a way to broadcast on the network what JVMs are available 

Steve Millidge

 

No comments:

Post a Comment