Sr. Engineer with Terracotta Inc.
Alex Miller is a Sr. Engineer with Terracotta Inc, the makers of the open-source Java clustering product Terracotta. Prior to Terracotta, Alex worked at BEA Systems on the AquaLogic product line and was Chief Architect at MetaMatrix. His interests include Java, concurrency, distributed systems, query languages, and software design. Alex enjoys writing his blog at http://tech.puredanger.com and has spoken at a number of Java user group meetings and conferences.Presentations by Alex Miller
Java 7 Preview
Possible library and language changes for Java 7 have been in discussion since early 2007 and many things have been proposed. This talk will focus on those items that are most likely to be included and some of the more controversial language changes that might be included in a future release. For a comprehensive list of almost everything being considered, see http://tech.puredanger.com/java7.Exploring Terracotta
Terracotta is an open-source Java clustering technology. It creates a virtual, durable Java heap that is shared across a cluster of Java Virtual Machines. This is done by dynamically instrumenting bytecode at load time to intercept calls to read and write fields, and also to enter and exit monitor locks. Information about these calls is then transmitted to the Terracotta Server (which can also be clustered) and out to other nodes in the cluster as needed. The advantage of this approach is that many Java programs can be clustered without code changes by providing just external Terracotta configuration. Many performance optimizations are performed to minimize communication and locking costs. Terracotta is commonly used for session sharing in web applications, distributed caching, and distributed workflow processing.This presentation will give an overview of the Terracotta technology, how it's implemented, and common use cases that can benefit from the technology. We will look at some code and cluster some Java applications during the presentation.
Cluster your Cache with Hibernate and Terracotta
Terracotta (an open source technology) provides a clustered, durable, virtual heap. You can reduce the load on your database by allowing Terracotta to handle sharing and persistence of temporary conversational state in your web application. One option is to simply cluster your existing Hibernate L2 cache (for instance with ehcache).A higher performance option is to disconnect your POJOs from the Hibernate session and manage them entirely in Terracotta shared heap until they are ready to be written back to the system of record. This option can yield extremely high performance while simultaneously reducing the load on your database, allowing you to scale your system with significantly less hardware.
Java Collections API
Did you know that Java 5 and 6 added 8 new interfaces and 16 new collection implementations to the JDK, more than doubling the size of the collection API? Collections 201 gives you an update on all of the interfaces, implementations, and utilities and gives you guidance on picking the perfect collection. In particular, Java 5 introduced a new major collection type Queue and a whole new java.util.concurrent package with data structures optimized for concurrent use.Java Concurrency Idioms
This presentation will look at the many new additions in Java 5 and 6 for concurrent programming such as Atomics, Locks, synchronizers, and concurrent collections. In particular, we will be looking at common concurrency idioms around locking and access to shared state, thread coordination, thread pooling, and work execution. Each of these topics will be presented with code examples demonstrating common idioms and the usage of these new concurrency primitives.Design Patterns Reconsidered
The Design Patterns book launched a revolution in object-oriented design and provided a vocabulary for OO developers to communicate their ideas. However, in some cases, patterns used blindly can lead to awkward, confusing, or hard to maintain code. It is time for some common patterns used in Java to be reconsidered so that we can derive the benefits from patterns while minimizing their concerns.This talk will re-evaluate key patterns like Singleton, Template Method, Visitor, and Proxy. These patterns have downsides and in some cases, do more harm than good. Examples of each pattern will be give in Java and examined for clarity, testability, and flexibility. Important problems will be discussed and examples of alternate solutions will be given.
Books by Alex Miller
by Ari Zilka, Alex Miller, and more
-
Get the definitive guide on all the fundamentals of Terracotta as well as user secrets, recipes, and prepackaged frameworks.
Written by Terracotta CTO Ari Zilka and his team, The Definitive Guide to Terracotta: Cluster the JVM for Spring, Hibernate and POJO Scalability covers the following:
* High Availability (HA) nth degree scaling and clustering for traditional J2EE and Java EE 5 applications (using Seam or other application) as well as Spring?based enterprise applications
* Everyday Terracotta using its prepackaged frameworks and integration recipes, including configuration and customization for your application tuning, no matter the scale
* Power user secrets available, including config modules, customized advanced performance tuning, SDLC, Maven, and more
- Available At: http://www.amazon.com/Definitive-Guide-Terracotta-Hibernate-..
Pure Danger Tech
Alex Miller's technical blog
Tuesday, August 19, 2008
Just a small plug for a nice paper by my favorite CS prof Ronald Loui called “In Praise of Scripting”. It’s getting pimped over at Lambda the Ultimate at the moment. He always wanted us to write our AI assignments in Gawk… :)
Tuesday, August 19, 2008
The elevator doors slide closed. Your fellow occupant says “So what do you do? I’m in venture capital.” You turn to him and say……well what do you say? You’ve got moments to make an impression.
This Friday, ITEN will be holding an event to help you hone your startup pitch and meet other IT startup founders in the St. Louis area. It’s the Elevator Pitch Intensive and you can still register to pitch or attend.
Those pitching will gather early and pitch to each other in small groups. Each group will also include mentors from the ITEN (IT Entrepreneur Network) who will help you to practice and perfect your pitch. It’s also a great opportunity to hear what other founders are doing.
From each group, two pitches will be sent to a public round, where everyone is welcome to attend. In this round the pitches will be given to everyone in attendance. If you’re interested in pitching or attending, please register now for planning purposes.
The event will be held at the TEC incubator in downtown St. Louis. Hope to see you there!
Some fun places to look for elevator pitches on the web:
Saturday, August 16, 2008
I’ve been taking a lot of walks lately and listening to podcasts, and I’ve become kind of addicted to podcasts oriented around story-telling. Perhaps the best is This American Life with Ira Glass. This NPR series every week takes a theme and tells a series of stories around it. They do an amazing job of putting together a riveting show every week. You can subscribe on iTunes but to reduce bandwidth they only provide the most recent episode.
Last week’s episode “Fear of Sleep” featured a number of good stories, but the one that stood out for me was Mike Birbiglia’s stories about him acting out his dreams. For one, it’s really funny, as only extended personal stories can be. For another, the presentation is just pitch-perfect - the pauses, the word choice, the pacing, etc. Of course, the comedian background should make this no surprise.
Of course, Mike’s performance was actually taken from a show at The Moth, which I’ve never heard of before. Apparently, they do storytelling shows in both New York and LA. Even better, they have a podcast. :) So, now I’ve been working my way through their podcast and enjoying it immensely.
Anyone else have any favorite story podcasts to share?
Wednesday, August 13, 2008
In case anyone is interested, I’ve been tracking some concurrency articles and have started adding them to a brand new Concurrency link blog
. This includes both shared-state and message-passing concurrency styles and languages such as Java, Erlang, Scala, etc.
If you’re into the link blog thing, I also maintain a Java 7 link blog
.
Monday, August 11, 2008
Along with the problem of actually making code thread-safe, there is also the problem of documenting it so other programmers know how to use your code. In general, it’s wise when designing a class to consider the state in the class and determine if each piece needs to be protected and how.
- You might decide to make your class immutable and thus avoid needing synchronization at all. (An excellent choice.)
- You may decide that either a class is intended to be used in a single-threaded scenario only or that it’s state will protected by locks completely external to the class. The Java collections classes like ArrayList, HashMap, etc are completely unsynchronized allowing you to use this in a single-threaded scenario without synchronization OR to apply synchronization at a granularity appropriate to your application.
- Or you may decide to make your class thread-safe and completely encapsulate the protection of the state with internal locks. Sometimes those locks can be done on the internal state variables themselves (highly recommended to make that state final in that case). For example, you might create your own Rolodex class, store state in local collections, and protect access with a lock on the internal collection(s). Note that if you have multiple pieces of internal state, you also need to decide whether they are protected by a single lock or multiple locks. If some methods on the class touch both, you need to be careful in how those locks combine. [Note: if no methods touch both locks, this is probably a design smell that this class is doing more than one thing.]
- Or you may be slightly trickier and protect the internal state, but allow external users to participate in your locks. This is done by locking on the instance (this) itself. Users of your class can then also lock on the instance and participate. You can see this in some of the java.util collections classes.
In any of these cases, it’s fairly crucial to document what safety you are providing both internally (for future maintainers of your code) and externally (for users of your class). Java Concurrency in Practice recommends a set of annotations to indicate the thread-safety of a class and what lock guards an attribute.
The nice thing about annotations is that they can be checked by a tool. In fact, the excellent FindBugs supports the JCIP threading annotations and can check that your code actually follows what you document.
Just recently, I saw a java.util.Random being used in a multi-threaded scenario while reviewing some code. I wondered to myself whether obtaining numbers from Random was actually thread-safe. I checked the javadoc and it doesn’t mention it in any way. Then I checked the source and after some minutes of review concluded that it was indeed thread-safe (in more modern versions, an AtomicLong stores the seed value). But if Random had been annotated @ThreadSafe I wouldn’t have had so much trouble.
Now I wonder where (if anywhere) this sort of concurrency information for the JDK is documented. Javadoc documents it (sometimes as we see). I presume the TCK verifies it (but who knows since that’s not exactly easy to get). And of course the implementation source tells you what it does now but not what it’s guaranteed to do in the future. Am I missing something?
