The best way to handle time zones in a Java web application

Introduction In this article, I’m going to show you what is the best way to handle time zones when developing a Java web application. I applied all these best practices while developing RevoGain, a web application that allows you to calculate the gains you realized while trading stocks, commodities, or crypto using Revolut.

RevoGain Software Architecture

Introduction In this article, I’m going to show you the RevoGain software architecture. RevoGain is a web application that helps Revolut users calculate their stocks and crypto trading gains, and I started building it at the beginning of September 2021.

Spring request-level memoization

Introduction Memoization is a method-level caching technique for speeding-up consecutive invocations. This post will demonstrate how you can achieve request-level repeatable reads for any data source, using Spring AOP only. Spring Caching Spring offers a very useful caching abstracting, allowing you do decouple the application logic from the caching implementation details. Spring Caching uses an application-level scope, so for a request-only memoization we need to take a DIY approach.

Java Performance Workshop with Peter Lawrey

Peter Lawrey at IT Days I’ve just come back from a Java Performance Workshop held by Peter Lawrey at Cluj-Napoca IT Days. Peter Lawrey is a well-known Java StackOverflow user and the creator of Java Chronicle open-source library. Of Java and low latency Little’s Law defines concurrency as: To increase throughput we can either: increase server resources (scaling vertically or horizontally) decrease latency (improve performance) While enterprise applications are usually designed for scaling, trading systems focus on lowering latencies. As surprising as it may sound, most trading systems, I’ve heard of, are… Read More

The fastest way of drawing UML class diagrams

A picture is worth a thousand words Understanding a software design proposal is so much easier once you can actually visualize it. While writing diagrams might take you an extra effort, the small time investment will pay off when others will require less time to understand your proposal. Software is a means, not a goal We are writing software to support other people business requirements. Understanding business goals are the first step towards coming up with an effective design proposal. After gathering input from your product owner, you should write down the… Read More

The data knowledge stack

Concurrency is not for the faint-hearted We all know concurrency programming is difficult to get it right. That’s why threading tasks are followed by extensive design and code review sessions. You never assign concurrent issues to inexperienced developers. The problem space is carefully analyzed, a design emerges and the solution is both documented and reviewed. That’s how threading related tasks are usually addressed. You will naturally choose a higher level abstraction since you don’t want to get tangled up in low-level details. That’s why the java.util.concurrent is usually better (unless you build… Read More

The simple scalability equation

Queuing Theory The queueing theory allows us to predict queue lengths and waiting times, which is of paramount importance for capacity planning. For an architect, this is a very handy tool since queues are not just the appanage of messaging systems. To avoid system over loading we use throttling. Whenever the number of incoming requests surpasses the available resources, we basically have two options: discarding all overflowing traffic, therefore decreasing availability queuing requests and wait (for as long as a time out threshold) for busy resources to become available This behavior applies… Read More

FlexyPool, reactive connection pooling

Introduction When I started working on enterprise projects we were using J2EE and the pooling data source was provided by the application server. Scaling up meant buying more powerful hardware to support the increasing request demand. The vertical scaling meant that for supporting more requests, we would have to increase the connection pool size accordingly. Horizontal scaling Our recent architectures shifted from scaling up to scaling out. So instead of having one big machine hosting all our enterprise services, we now have a distributed service network. This has numerous advantages: Each JVM… Read More

The anatomy of Connection Pooling

Introduction All projects I’ve been working on have used database connection pooling and that’s for very good reasons. Sometimes we might forget why we are employing one design pattern or a particular technology, so it’s worth stepping back and reason on it. Every technology or technological decision has both upsides and downsides, and if you can’t see any drawback you need to wonder what you are missing. The database connection life-cycle Every database read or write operation requires a connection. So let’s see how database connection flow looks like: The flow goes… Read More

Open-minded architect

While chit-chatting with one of my colleagues, I was surprised to hear they use a PHP team for developing their front-end application, while the back-end services are implemented using Java. Since their project is doing great, this really got my thinking why I haven’t ever considered such an architecture. Most large Java web application I’ve been involved with have shone on the server-side part, while the client-side has been the Achilles heel. While you can find great Java web developers, not every Java developer has web-based skills. But PHP developers are great… Read More