Topics

Featured in Development

Alex Bradbury gives an overview of the status and development of RISC-V as it relates to modern operating systems, highlighting major research strands, controversies, and opportunities to get involved.

Featured in Architecture & Design

Will Jones talks about how Habito, the leading digital mortgage broker, benefited from using Haskell, some of the wins and trade-offs that have brought it to where it is today and where it's going next. He also talks about why functional programming is beneficial for large projects, and how it helps especially with migrating the data store.

Featured in AI, ML & Data Engineering

Katharine Jarmul discusses research related to fair-and-private ML algorithms and privacy-preserving models, showing that caring about privacy can help ensure a better model overall and support ethics.

Featured in Culture & Methods

This personal experience report shows that political in-house games and bad corporate culture are not only annoying and a waste of time, but also harm a lot of initiatives for improvement. Whenever we become aware of the blame game, we should address it! DevOps wants to deliver high quality. The willingness to make things better - products, processes, collaboration, and more - is vital.

Featured in DevOps

Service mesh architectures enable a control and observability loop. At the moment, service mesh implementations vary in regard to API and technology, and this shows no signs of slowing down. Building on top of volatile APIs can be hazardous. Here we suggest to use a simplified, workflow-friendly API to shield organization platform code from specific service-mesh implementation details.

Plöd, principal consultant at InnoQ, started by noting that in his experience, teams currently too often see microservices as the default architecture. He emphasized that distributed systems are difficult systems; if you don’t need a distributed system you shouldn’t strive for one just for the sake of it. Well-built monoliths are often a better choice in such circumstances.

When the monolith isn’t enough and microservices are used, they must be integrated, and Plöd notes that this is not just a technical issue, it also has implications in other areas:

Team communication: Teams often need to communicate to solve integration problems, which may lead to politics and governance issues.

Coupling: It’s extremely important to achieve loose coupling between services, otherwise you will easily end up with a distributed monolith.

Quality criteria: To find what's really needed regarding consistency, performance, scalability and robustness you should do an early assessment of your application.

Technology: Although REST is commonly used, it’s not the only option for communication.

To help in team communication and manage coupling, Plöd notes that domain-driven design (DDD) can be of great help by finding boundaries at a business level – bounded contexts. These contexts commonly interact with each other in different ways, and to describe this a context map can be used. Patterns for these interactions include:

Open host service, which specifies a protocol like REST for how a service can be used.

Shared kernel, where two services share some code or a library defining the interaction.

Customer / Supplier, where one service is a customer of another service and may thus influence how it’s implemented.

Anticorruption layer, where a consuming service creates an adapter to minimize impact from another service that it interacts with.

Looking at the technical aspects of communication, Plöd first describes a more general categorization of communication – orchestration versus choreography. Using orchestration,one microservice knows about a process and actively calls other services in order to accomplish the task. Using choreography, a microservice publishes an event which other services react to, and act on. For Plöd this is an important distinction and he believes we should make an architectural decision about the preferred way of working within a system.

He also recommends thinking about both a macro and a micro architecture, and notes that the microservice architectural style is not about teams selecting anything they like, because then you will end up in total chaos. Instead, he recommends a macro architecture with rules that all teams must abide to. In the micro architecture, the teams have more freedom to select their own style of implementation.

Looking at the technical options of communication, Plöd notes four types:

RESTful resources

Messaging

Domain events

Feeds

Although REST is widely understood today, in Plöd’s experience very few teams implement it well, especially with regard to hypermedia and multiple representations. He notes that implementing a call to a RESTful resource is very easy nowadays but implementing a robust one that works in a microservices environment is much harder. There are quite a few pitfalls and challenges to be aware of, including:

Service discovery. A way for a service to find the URLs of services it communicates with.

Resilience, including how errors and downtime is handled. A graceful degradation of services is important to avoid one malfunctioning service taking a whole application down.

Load balancing, to be able to handle increasing load. This can be achieved in different ways, depending on the environment the application is running in.

The next option is messaging, where microservices send and consume messages, commonly through a message broker. Here the challenges described for REST is not as relevant:

Service discovery is not relevant anymore since services only know about the messaging system.

Resilience is mostly handled by the messaging system. The main risk is an increase in latency due to errors or downtime.

Load balancing is done by scaling up the messaging system or by increasing the number of message consumers.

Plöd’s third option is domain events. They represent facts about things that have happened in the past at a business level. Using them for communication leads to event-driven microservices, a very popular architectural style today. When using events for communication he describes a few alternatives for the payload used in events:

Full payload, where the event contains all data needed for dealing with the event, for instance all data about a customer. This makes it easier for the consumer, but it also means a tighter coupling.

REST URL, with just an URL to a resource that represents the event.

Empty, with only data about the event itself. A consumer then must have other means of finding the data it needs.

Mix, with for instance a small amount of data plus an URL for finding additional data. This is the preferred way for Plöd in most cases.

Plöd’s final alternative is to combine REST and events by using Atom Feeds. A service now publishes a feed with events which consumers can subscribe to and asynchronously read. Using HTTP, it’s very easy to communicate in most environments and it’s possible to leverage features like ETags, Last Modified, pagination and links. Another advantage is that the services publishing feeds is completely decoupled from the consumers. It’s solely up to each consumer to read the feeds as it sees fit and to keep track of events already consumed.

In order to offer feeds, the events must be persisted, and this is where event-sourcing comes into play. We can use these events as our main persisted model which also enables us to use CQRS to derive views that are optimized read models from those events. Plöd emphasizes that CQRS and event sourcing are solutions that only come into play in specific parts in a system, they do not represent an architecture used everywhere in a system.