Follow 12 factor and you can’t go wrong when rolling out your microservices, here are some practical tips on how to engineer them for real (a more in depth look can be found 12 Factor Apps in Practice).

Codebase

  • Use feature branches to support different versions of an app in the same repo
  • Refactor out shared code into a new repo and reference it in original repo as a library dependency using a dependency management framework
  • Application topology (deployments, config etc) can be version controlled to avoid environment creep

Dependencies

  • Use a dependency management framework like maven to explicitly declare dependencies
  • Use…

If you like the go concurrency features of goroutines and would like something similar for high-throughput concurrent applications written in Java, then read on …

Summary

To get anything comparable to a goroutine in Java we look at an alternative OpenJDK called Project Loom that provides 'virtual threads', a new implementation of Thread that differs in memory footprint and scheduling.

Routines

Java does not have anything that is equivalent to a goroutine, the nearest match is a Thread, unlike Java threads though, you can run many more goroutines on a typical system, they will have a lower memory footprint, and will perform…


A quick walk-through on how to use Red Hat OpenShift to create and deploy a container image from a git project that contains a simple mood board REST service, deploy a redis container that acts as a backing service, and test.

The source code lives at https://github.com/stehrn/mood-board.

Sign up to OpenShift for free here to get:

  • 2GiB memory for your applications
  • 2GiB persistent storage for your applications
  • 60-day duration

(at time of writing version 4.2 was used)

Log in to admin home page:

Click ‘Create Project’ and enter details:


This is a practical look at 12 factor apps and how to engineer them for real.

A simple Java microservice is evolved architecturally, from a single process app, to a multi process Docker containerised app leveraging a redis cache, first running on the container orchestration platform Kubernetes, and then rolled out to Red Hat OpenShift.

It’s hands-on-keyboard, with exercises to work through, technical prerequisites:

  • JDK and maven are installed (along with a decent IDE like IntelliJ)
  • Docker is installed

Take a bit of time up-front to read the introductions to Docker containers and Kubernetes, whilst lots of links to more…


This blog explores the use of synthetics metrics to help reduce the running costs of application platforms. We’ll discuss the infrastructure management process, which metrics are important and why, and how they can be combined into a synthetic metric to help with decision making.

It covers some of the things an engineer building out and supporting an application needs to be mindful of, including CPU and memory characteristics to look out for when an application is running, and guidance on how to design and implement the synthetic metric.

The problem with change

What do you do with a server that costs a lot of…


Overview

This article builds on the Risk Systems — Trade Modelling and Pricing and presents a relational database schema for a trading application, examining what happens when a trade is executed, including how to apply fx conversion of monetary amounts, and handle trade history via bi-temporal chaining.

We look at a few typical trade reporting use cases and associated sql queries, and show a simple way to run and test queries locally using an embedded H2 in-memory database.

In the final section we discuss some of the different ways to access the database model within a Java application before choosing the…


Overview

This article will give you a flavour of how a risk system works, looking at trading desk concepts including:

  • what is a trade and how can it be modelled
  • what you need before booking a trade
  • what happens when a trade is booked
  • how pricing works

A simple trade API is evolved, starting with trade booking and then pricing, examples and pseudo code are provided to help understand concepts, and some of the challenges building out risk systems are discussed.

What is a trade?

A trade is:

  • A contract to buy or sell something
  • An action that changes positions

There are lots of different…

Nik Stehr

A software engineer who works hard to create simple solutions.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store