Redis Clone: Virtual Threads (Project Loom)

August 12, 2022

In the last post we profiled the naive Redis Clone. One of thing showing up was the flushing of the response.

In this post we try out Virtual Threads and Structured Concurrency from the JDK 19 preview, and see if we can use it to improve on the flushing. This is certainly not a primary use case for these feature, but let’s try it out anyway.

Continue reading →

Creating Pseudo Terminals for Test Scripts with tmux

August 5, 2022

I recently tried to automate a test setup, where the program I tried to automate insisted on having a tty. Oh no, yet another tty adventure (previous one) for me ;).

The app doesn’t really interact with a tty, except listening for Ctrl-C. Without a tty, the app just shut itself down. So, I needed a way to create a TTY in my test script.

Continue reading →

Profiling the Naive Redis Clone

July 29, 2022

In the last post we ran a benchmark on our naive Redis clone. It performed already impressively. To improve its performance, the first step is to understand where the time goes in the program.

Profiling
Figure 1. Profiling
Continue reading →

Building a (Java-) Redis Clone, naively

July 4, 2022

Oren Eini (Ayende) has a wonderful blog series where he builds a small Redis clone in C#, and then investigates performance issues and improves on it. I got tempted to do a Java version, out of curiosity. I probably won’t go as far as Oren Eini with the profiling and optimization, but I’ll try to do at least some iterations.

Building Redis
Figure 1. Building Redis
Continue reading →

Model Results/States with Java 17's Records

May 24, 2022

I often want to represent a set of possible results or states with different possible values. For example a processing result:

  • A successful full result

  • And expect error with some error code

  • An unexpected error with some exception

  • Some other rare edge case I need special handling for.

Continue reading →