Spring I/O – Barcelona 2019

We, Tom and Jeroen from JArchitects went together with 1100 other attendees to the 2 day Spring I/O conference held in Barcelona on May 16 and 17 2019. During the keynote, Juergen Hoeller outlined the Spring Framework 5.2 roadmap with release date 31 July. As one of the key architects of Spring he highlighted the startup optimizations, better annotation processing, reactive transactions, rsocket messaging, kotlin coroutines and closed the gap with WebMvc.fn.

Ben Hale and Violeta Georgieva of Pivotal working on Project Reactor and Webflux took the main stage afterwards to tell us Reactive Programming is the next frontier in Java for high efficiency applications. Its fundamental non-blocking behavior make better use of the resources available to us. If you use reactive programming in your projects; you definitely want to add the debug agent, with zero runtime overhead to make the stack traces more insightful. Next to that, BlockHound watches your code execution and throws an error when a blocking API is called making sure you can identify and prevent blocking behavior, as there are only a few threads running when going reactive.

HTTP is not enough and RSocket, a Netflix founded project, is a bi-directional, multiplexed, message-based, binary protocol based on Reactive Streams back pressure. RSocket is language, payload, transport and programming agnostic. Many of the NoSQL datastores embrace Reactive programming models like MongoDB, Cassandra, Redis,.. But the relational databases are still very broad in use and therefore R2DBC is an API designed for reactive programming being more than a wrapper for JDBC. Utilizing Reactive Stream Types and Patterns, non-blocking and simply humane usage and features like first-class observability and connection pooling are also available when dealing with these relational databases.  

The last keynote speaker Sebastian demonstrated how Kotlin gains popularity and how the reactive API of Spring maps with Kotlin coroutines and highlighted how Kotlin embraces the Spring 5.2 features. During the demo, he showed how a data Kotlin class is mapped to Postgres with R2DBC both with reactive programming operators as with imperative coroutines.

Now the cloud has shaken up the traditional security policies, profiles, network stack and physical security, the talk of Mark Heckler brought us up to speed with Spring Security. His demo about integrating OAuth2 and OpenID integration with JWT token exchange is definitely of practical use. Pratik Patel introduced us to GraphQL,  an API query language specification founded by Facebook. It is a tool and not intended to replace REST, but rather can wrap around it, just like it can be put on an RDBMS.  It has a single endpoint and is schema based allowing to browse and inspect the structure when querying. Its main advantages over REST: REST is often overfetching or often underfetching. In general GraphQL is simpler and faster than REST.

Erin Schnabel and Ozzy Osborne recognize that there are many languages within a company, on multiple servers and in cloud infrastructure. Spring does amazing things, but also not so amazing. Spring Cloud connector and configuration are used to integrate Kubernetes. Metrics are captured with Micrometer, Prometheus and Spring Actuators. Interoperable Security with JWT tokens and here Ozzy explains Spring has some conventions on the content of the tokens that might lead to problems when interchanging with non-Spring applications. OAuth2 has been simplified to setup in Spring 5 and please leave loadbalancing over to the (cloud) infrastructure layer: e.g. Istio.  Axel Soto gave in his session an excellent demo how Istio is utilized in a Blue/Green deployment to divert the traffic between 2 different versions of the same application. Josh Long and Viktor Gamov talked about how Kafka becomes a vain for the data streams within the company. But you can use it more than just a message queue by adding data processing. Josh uses in his demo the Confluent CLI and Spring Initializr, like we’ve seen in many of the other demos on the conference.  Once the demo project is setup, they configure it with Kafka, Kafka Streams, Cloud Stream, Webflux and Lombok. Employing avro, messages are constructed and sent to Kafka and Kafka streams allows data processing on it within Kafka in any language. Dave Syer shows through benchmark results how Spring gets faster boot times and lower memory footprint with newer releases leaving quite some options on the table to tweak your Spring Boot project if you need to. Violeta Georgieva starts her talk with sketching server-client loads with synchronous processing and asynchronous processing and points to the problem that rise when data can’t be processed in time. Therefore WebFlux is suitable for dealing with this: volume scalable in way many less threads. The metrics that follows highlights the differences Web MVC and Webflux.fn on memory, cpu, thread load and most importantly the requests/minute processing rate.

Reactive programming is not a silver bullet, there is a higher learning curve than imperative programming and debugging can be trickier. Madhura Bhave reassures us that the annotations of Spring are no magic by showing how you can build an application without using them. Therefore she recreates the Spring annotations itself step by step to show everything can be done in code and knowing this you can use the Spring source to get to know ’how do they do it’. Tom Hombergs reminded us we need architecture to facilitate development and maintenance; keeping the software soft, make it changeable; keep the options open and minimize the lifetime cost of software. Although layered architecture is a solid architecture pattern, the database driven design might have some common pitfalls, concentric circles or the hexagon architecture is an answer with SOLID principles SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion). And most of all, Spring doesn’t care about which architecture we’re implementing. In his book, Get Your Hands Dirty with Clean Architecture, code examples are given applying the principles as set by Robert C. Martin (Uncle Bob). Stéphane Nicoll and Brian Clozel played with an app that is rewritten to use Reactor’s Flux/Mono to parallelize tasks and by adding Micrometer in combination with Prometheus and Grafana timing metrics could be analysed. Practically we saw how a slow service is easily wrapped with a timeout to fallback to a non-free service when there is no reply within 500 msec making the reactive flow programming seems like a breeze.

Having seen all these demos, a man gets hungry and sure enough, Barcelona has proven its reputation to be a fantastic city to be. Delicious seafood dishes accompanied with a couple of cool Estrella beers were each time a perfect combo to close of these days.