We are delighted to be able to share our fourth monthly architects' newsletter with you, which we will send on the last Friday of every month. InfoQ strives to facilitate the spread of knowledge and innovation within this space, and in this newsletter we aim to curate and summarise key learnings from news items, articles and presentations created by industry peers, both on InfoQ and across the web. We aim to keep readers informed and educated about emerging trends, peer-validated early adoption of technologies, and architectural best practices, and are always keen to receive feedback from our readers.
News
Service Interaction Mechanisms
This month on InfoQ, Srini Penchikala organised a virtual panel on the topic of "Microservices Interaction and Governance Model - Orchestration v Choreography." Highlights of the panel included the recommendation to think of microservices interaction in terms of commands and queries, as popularised by Command Query Responsibility Segregation (CQRS): commands are external requests that create, update or delete data; and queries are external requests that simply read data.
Service interaction mechanisms include messaging/eventing, Remote Procedure Calls (RPC), and REST-like interaction e.g. JSON over HTTP/S. Service orchestration gives visibility into the processes and data flow involved, but it's inflexible as you have to describe every interaction. Service choreography works by the exchange of messages between different services, which ultimately translates into decentralized service composition.
The panel concludes with a discussion of the Spring Cloud Stream framework - which lets developers focus on writing messaging-centric services - and the Spring Cloud Data Flow framework - which enables the orchestration of messaging-based microservices.
Artem Bilan has created an interesting related article that discusses "How to test Spring Cloud Stream applications (Part I)." The article sets the scope of the challenge by quoting Gregor Hohpe in the introduction "One of the reasons integration solutions are not tested thoroughly is the fact that testing asynchronous, message-based middleware solutions is challenging." The remainder of the article walks through a practical example of unit testing a Spring Cloud Stream application, and the second part in the series will explore integration testing further.
Processing and Querying Streams
Ken Finnigan has created a sample application and tutorial for "Data Streaming with WildFly Swarm and Apache Kafka." The associated GitHub repository contains code to allow developers to experiment with sending and consuming events via Kafka and Java-based applications deployed on OpenShift.
Continuing a very comprehensive series of articles on the Confluent blog, this month Ben Stopford has written "Building a Microservices Ecosystem with Kafka Streams and KSQL." Kafka Streams is the core API for stream processing on the JVM - Java, Scala, Clojure etc - and it is based on a DSL (Domain Specific Language) that provides a declaratively-styled interface where streams can be manipulated in a SQL-like fashion, and joined, filtered, grouped or aggregated.
KSQL provides a simple, interactive SQL interface for stream processing for applications that are not running on the JVM. KSQL can be run standalone, for example via the sidecar pattern, and uses the Kafka Streams API under the hood. This means it can be used to do the same kind of declarative "slicing and dicing" that might be done in JVM code using the Streams API. Then a native Kafka client, in whatever language the consuming service is built in, can process the manipulated streams one message at a time.
SPONSORED CONTENT
Applied AI Conference for Developers
Recently, we announced QCon.ai, a new AI and machine learning software development conference. Focusing on the practices of artificial intelligence and machine learning, QCon.ai takes a different tack to other major software conferences in the AI / machine learning space. Rather than focusing on data scientists, QCon.ai targets how full stack software engineers can apply machine learning and AI techniques in their day-to-day roles. QCon.ai takes place in San Francisco, April 9-11, 2018. You can find out more about the conference at QCon.ai. We really hope you can join us this coming April.
Sponsored by:
|
Case Studies
Special Focus: Event Sourcing
At the recent Microservices Conference QCon London 2017, Greg Young claimed that event sourced microservices is an area that hasn't been explored nearly as much as it should be. However, event sourcing is not a panacea, and it was strongly emphasized that developers should not event source every microservice within an application. Instead, Young recommended examining the requirements of individual services and applying the event sourcing pattern to services that will actually benefit from it.
Jonas Bonér, Founder & CTO at Lightbend, gave the keynote presentation at the recent Reactive Summit 2017 conference and discussed how event driven architectures (EDA) and event stream processing (ESP) technologies are helping with designing the modern applications based on distributed systems. Bonér recommended developers to not focus on just the "things" in the system - the Domain Objects - but rather focus on what happens - the Events. A key takeaway of the talk is that event sourcing allows developers to model time by treating an event as a snapshot in time and the event log as the full history. This allows for "time travel" in the sense that the log can be replayed for historic debugging, as well as stored for auditing and traceability.
For architects looking to get started with exploring the topic of event sourcing, Kenny Bastani has created an event-souring-microservices-basic GitHub repository that provides a reference example that is intended to teach the basics of event sourcing in Spring Boot applications. Additional theory can be found in Chris Richardson’s InfoQ series "Developing Transactional Microservices Using Aggregates, Event Sourcing and CQRS" from earlier this year. Jan Ypma also recently gave a talk at ProgSCon "Disrupting Development Using Reactive Event Sourced Systems with Akka," which presented the building of a system which exposes reactive events as a real-time streaming REST API.
To get notifications when InfoQ publishes content on this topic follow Event Driven Architecture on InfoQ.
This edition of The Software Architects' Newsletter is brought to you by:
|
Getting Started with Microcaching
In microcaching, you cache content that’s somewhere in the middle here on the scale – between static content (such as images, CSS, stuff that’s typically easily cached and quite often put into some sort of CDN) and stuff that’s all the way on the right. That’s personalized content, your shopping cart, your account data, stuff that you do not ever want to cache.
Between those two extremes, there’s a whole load of content (blog posts, status pages) that we consider dynamic content, but dynamic content that is cacheable. By microcaching this content, which is to say caching it for a short amount of time – as little as 1 second – we can get significant performance gains and reduce the load on the servers.
The nice part of microcaching is you can set your microcache validity to, for example, one second, and your site content will be out of date for a maximum of one second. That takes away a lot of the typical worries you have with caching, such as accidentally presenting old stale content to your users, or having to go through the hassle of validating and purging the cache every time you make a change. If you’re doing microcaching, updates can be taken care of just by leveraging existing caching mechanisms.
This is the fourth issue of a monthly newsletter, focusing exclusively on software architecture. We thought it would be valuable for you to get a quick overview of things you might like to keep an eye on. If this is not the case, you can unsubscribe using the link below.
Forwarded email? Subscribe and get your own copy.
|