Showing posts from 2022

Comparing Approaches to Durability in Low Latency Messaging Queues

  A significant feature of Chronicle Queue Enterprise is support for TCP replication across multiple servers to ensure the high availability of application infrastructure. I generally believe that replicating data to a secondary system is faster than syncing to disk, assuming the round trip network delay wasn’t high due to quality networks and co-located redundant servers. This is the first time I have benchmarked it with a realistic example. Little’s Law and Why Latency Matters In many cases, the assumption is that the latency won't be a problem as long as throughput is high enough. However, latency is often a key factor in why the throughput isn’t high enough. Little’s law states, “ the long-term average number  L  of customers in a  stationary  system is equal to the long-term average effective arrival rate  λ  multiplied by the average time  W  that a customer spends in the system”. In computer terminology, the level of concurrency or parallelism a system has to support must be

Event-Driven Order Processing Program

  Following the   Hello World example   of a simple, independently deployable real-time Event-Driven Microservice, this article looks at a more realistic example of an Order Processor with a New Order Single in and an Execution Report out.  A  New Order Single  is a standard message type for the order of one asset in the FIX protocol used widely by financial institutions such as banks. The reply is typically one or more  Execution  Report s updating the status of that order. Some Background on Fintech In fintech, when one organisation wishes to purchase an asset or commodity from another, they send an order.  The other organisation sends a message to notify if the order was successful; this message is called an execution report. You could think of it a bit like a trade receipt. These orders and execution reports are transmitted electronically, using a data format standardised by Financial Information eXchange (FIX). There are many different orders, but one of the most popular Orders of

Efficient Memory Mapping for Terabyte Sparse Files in Java

  On Linux, you can create  sparse files , where only the pages (of 4 KiB) that are touched utilise either memory or disk space. This allows you to memory map large virtual regions without worrying about wasted memory or disk In this program, you can see it reserves 8 TiB (8,192 GiB) Figure 1.  Test 1: Sparse file Tip:  x << y means x × 2 y  therefore  1L << 10 = 1 KiB (1024 bytes),  1L << 20 = 1 MiB (1024 2  bytes),  1L << 30 = 1 GiB (1024 3  bytes),  1L << 40 = 1 TiB etc Using multiples of 10 for the shift makes them easier to read.  64L << 20 is 64 × 2 20  = 64 × 1024 2  = 64 MiB.  The virtual memory size of the above process is just over 8192 GiB at 8200.7 GiB, but the RSS (Resident Set Size) is only  122,060  KB, or 122  MB. Figure 2. RES for Test 1 On disk, the extents reported are 8 TiB, however the amount of disk (and memory) actually used is just 20 KiB. Figure 3. Disk usage for Test 1 The following test displays the main point of this artic

Event Driven Hello World Program

  Event-driven microservices  can be straightforward to describe before they are implemented, tested and maintained. They are also highly responsive to new information in real-time, with latencies in Java of below 10 microseconds 99.99% of the time, depending on the functionality of the small, independently deployable microservice.    In this introductory article, we use an example  event-driven   Hello World  program ( a programming paradigm where the program flow is determined by events)  to step through   behaviour-driven   development , where we describe the behaviour the business needs first as test data and write a very simple  microservice  which turns input events like this. say: Hello World Into outputs like this, by adding an exclamation point say: Hello World !  # <- adds an exclamation point All the code for this example is  available on GitHub . When modelling Event-Driven systems, a useful pattern is to have event-driven core systems with gateways connecting to externa