
Minborg's Java Pot
1000 FOLLOWERS
This is my Java blog with various tips and tricks that are targeted for medium and advanced Java users.
Minborg's Java Pot
2w ago
Wouldn’t it be cool if you could allocate an infinite amount of memory? In a previous article, I elaborated a bit on how to create memory-mapped files which could be sparse. In this article, we will learn how this can be leveraged as an under-carriage for providing a memory-allocating arena that can return an almost infinite amount of native memory without ever throwing an OutOfMemoryError.
Arena
An Arena controls the lifecycle of native memory segments, providing both flexible allocation and timely deallocation.
There are two built-in Arena types in Java 20:
A Confined Arena (avai ..read more
Minborg's Java Pot
2M ago
The new JEP 434 has just seen daylight and describes the second preview of the ”Foreign Function & Memory API” (or FFM for short) which is going to be incorporated in the upcoming Java 20 release! In this article, we will take a closer look at some of the improvements made from the first preview that debuted in Java 19 via the older JEP 424.
Getting familiar with the FFM
This article assumes you are familiar with the FFM API. If not, you can get a good overview via the new JEP
Short Summary
Here is a short summary of the FFM changes made in Java 20 compared to Java 19:
The Memor ..read more
Minborg's Java Pot
8M ago
Exhaustive JUnit5 Testing with Combinations, Permutations, and Products
Unit testing constitutes an integral part of the process of providing high-quality software. But, how can one write tests covering all variants of several operations? Read this article and learn how to use JUnit5 in conjunction with combinations, permutations, and products.
Test Support Libraries
There are many libraries that make testing better in different aspects. Here are some of them:
Agitar One
Agitator automatically creates dynamic test cases, synthesizes sets of input data, and analyzes the results.
http ..read more
Minborg's Java Pot
9M ago
Which JVM Version is Fastest?
How is a high-performance, low-latency Java application affected by the JVM version used? Every nanosecond counts for trading and other applications where messages between two different threads are exchanged in about 500 ns! Read this article and find out which JDK variant comes out at the top!
Benchmarks
This article will use open-source Chronicle Queue to exchange 256-byte messages between two threads whereby all messages are also reliably persisted to disk.
Chronicle Queue is a persisted low-latency Java messaging framework for high-performance an ..read more
Minborg's Java Pot
11M ago
How to Reduce Cloud Cost by 99% for EDA Kafka Applications
While the cloud offers great convenience and flexibility, the operational cost for applications deployed in the cloud can sometimes be significant. This article shows a way to substantially reduce operating costs in latency-sensitive Event-Driven Architecture (EDA) Java applications by migrating from Kafka to Chronicle Queue open-source, a more resource-efficient and lower-latency queue implementation.
What is EDA?
An EDA application is a distributed application where events (in the form of messages or DTOs) are produced, detect ..read more
Minborg's Java Pot
1y ago
Did You Know the Fastest Way of Serializing a Java Field is not Serializing it at All?
This article elaborates on different ways of serializing Java objects and benchmarks performance for the variants. Read this article and become aware of different ways to improve Java serialization performance.
In a previous article about open-source Chronicle Queue, there was some benchmarking and method profiling indicating that the speed of serialization had a significant impact on execution performance. After all, this is only to be expected as Chronicle Queue (and other persisted queue lib ..read more
Minborg's Java Pot
1y ago
How the Java Language Could Better Support Composition and Delegation
This article outlines a way of improving the Java language to better support composition and delegation. Engage in the discussion and contribute to evolving the Java Language.
The Java language lacks explicit semantic support for composition and delegation. This makes delegating classes hard to write, error-prone, hard to read and maintain. For example, delegating a JDBC ResultSet interface entails writing more than 190 delegating methods that essentially provide no additional information, as illustrated at the end o ..read more
Minborg's Java Pot
1y ago
Java: How Object Reuse Can Reduce Latency and Improve Performance
Become familiar with the art of object reuse by reading this article and learn the pros and cons of different reuse strategies in a multi-threaded Java application. This allows you to write more performant code with less latency.
While the use of objects in object-oriented languages such as Java provides an excellent way of abstracting away complexity, frequent object creation can come with downsides in terms of increased memory pressure and garbage collection which will have an adverse effect on applications’ latency an ..read more
Minborg's Java Pot
1y ago
Queues are often fundamental components in software design patterns. But, what if there are millions of messages received every second and multi-process consumers need to be able to read the complete ledger of all messages? Java can only hold so much information before the heap becomes a limiting factor with high-impacting garbage collections as a result, potentially preventing us from fulfilling targeted SLAs or even halting the JVM for seconds or even minutes.
This article covers how to create huge persisted queues while retaining predictable and consistent low latency using open-source Chr ..read more
Minborg's Java Pot
1y ago
Java: Why a Set Can Contain Duplicate Elements
In low-latency applications, the creation of unnecessary objects is often avoided by reusing mutable objects to reduce memory pressure and thus the load on the garbage collector. This makes the application run much more deterministically and with much less jitter. However, care must be taken as to how these reused objects are used or else unexpected results might manifest themselves, for example in the form of a Set containing duplicate elements such as [B, B].
HashCode and Equals
Java’s built-in ByteBuffer provides direct access to heap an ..read more