Slicing The Monolith--With Java EE And Docker
Andreas, please introduce yourself
My name is Andreas Enbohm and been working as software developer and consultant for almost 15 years. Since three years ago I’m running my own company assisting various companies with coding, mentoring and methodology improvements. I’d like to call myself a programmer, but often clients defines my role as a technical/programming architect.
What are you building with Java EE?
I’ve ben involved with many types of applications based on Java EE. From eCommerce websites and web portals, to batch processing systems and core backend systems within telecom- and manufacturing industry. Currently I’m involved in refactoring and evolving a quite large self-service portal within the telecom business. The portal could be considered a big monolith with around 50 integrations with various backed systems (databases, IMS systems, CRM systems, etc). We are currently trying to slice the portal into smaller manageable pieces, what could be referred as ”right-sized” service architecture. We don’t really know the number of slices we’re going to end up with, but we think that somewhere around 10-15 services would be a good start. The foundation for these new services are Java EE along with Docker which I have found to be a perfect match! I’m specially keen on using uberjars and for this we utilise WildFly Swarm. With Docker Swarm mode we get the speed we need to deploy these services along with service discovery, failover, clustering, etc. which is nice. However, one big challenge I see is the monitoring and logging when building application this way. Most likely we will need tools to support us here and I’m investigating if the ELK stack (Elasticsearch, Logstash, Kinbana) can solve this problem. And not to forget, we use Swagger to document all our services which I find very easy and just works!
Can you share with us some geeky numbers like e.g. TX per seconds, heap sizes, thinnest WARs etc -- whatever Java EE devs might find interesting.
In this project the number of transaction are fairly low (around a few per seconds) so not much to brag about here. What is more interesting is maybe that the initial code was written in 2001 (using Java 1.3 and JBoss 3) and many old parts is still healthy and used! The portal has during the year gone through major platform- and application server updates. From Java 1.3 to Java 5, 6, 7 and 8 including various JBoss and Apache Tomcat upgrades with basically no or very little code modifications. This really shows that Java is a really long term platform to build upon! When it come to the newer parts the fat/uber jar services are between 40-120 MB and the services built as non-fat ones are ranging from ca 50KB to 10 MB depending amount of libraries included.
Are you happy with Java EE so far? Is Java EE productive?
I have been using Jave EE for 10+ years now. I’m definitely productive and like it. Frameworks like Arquillian makes testing really easy and many application servers are getting really lightweight and easy to manage. However, I have a few concerns about the evolvement of Java EE 8 (and beyond) and feel that in the accelerating pace of software industry, the Jave EE standards might need to speed up a bit. Then there are some parts I’ve been waiting for really long in Java EE such as caching (JSR107) which I really hope to see as part of Java EE 8.
Which application servers, tools or IDEs are you using?
We are currently using Apache Tomcat for the main part of the web portal (JSP pages) and WildFly (incl. Swarm) for the new (micro)-services. Eclipse is the IDE of my choice when developing Java-code and DbVizualizer for database management. Along with Maven, Jenkins, Git and Gerrit I basically got what I need :). There are of course a bunch of other tools I use from time to time but these ones I’m using on a daily basis.
You are using Docker together with Java EE in production. What is your experience so far?
We have been running Docker containers for a couple of month now in production and have not seen any concerns or issues so far. Memory and CPU footprints are low as is the ”overhead” of Docker (if any). Challenges for us are how to gather information (e.g. logs, health status) and how to share persistent data between containers. Also, in the long run, we think some GUI for Docker Swarm mode is needed but have not yet found anyone to support our demands. Shipyard or Rancher might be the way forward but we have yet to decide. But so summarise, I really think Docker, and to be able to treat infrastructure as code along with Java EE, is a really big step forward (kind of a new era) in software development.
How important are standards for you? Does your application depend on application server specific APIs?
For me standards are important. During the years I’ve been using many custom framework/APIs (which has been abandoned or not supported anymore) and this can be a real pain especially from an enterprise application view which might live for many years. Another problem that might occur without standards is vendor lock-in. When using standards, you often minimise these problems which means freedom to switch implementation without touching the actual code. I often avoid usage of any specific/custom APIs, but if needed I try to encapsulate it as much as just possible.
Which Java EE APIs are you using in your products?
The most widely used ones are JSP, Servlet, CDI, EJB, EL (expression language), JAX-RS and JSTL. In the future I believe I will more and more use the MicroProfile (JAX-RS, CDI, JSON-P) baseline for Java EE services.
Take a look at the Java EE 8 APIs. Which of the APIs are most interesting / important to you?
If I had to pick three ones I would go with these:
- JSR 107 JCACHE (because it is just so fundamental in enterprise development)
- JSR 375 Security API (because today it is confusing but business critical)
- JSR 367 (because JSON is such an important exchange format)
Can you share any resources (blogs, etc feel free to promote yourself) with us?
You can follow me on twitter (@enbohm) or see some of my presentations on SlideShare (www.slideshare.net/enbohm) or GitHub (github.com/enbohm). Some of my presentations are internal ones (not shared in public) but you might see me talking at some Java conference soon :)
Andreas, thank you for the inteview!