Because your threads are blocking my performance.

Spools of multi-colored thread
Spools of multi-colored thread
Image by Vesna Harni from Pixabay

Non-Blocking I/O has been around for a while. Different languages implement it differently, but all provide a way to reduce the thread count while seeming to allow full concurrency. JavaScript has been doing it from the start; with only one thread, you better not be the coder that pushes a blocking call into production.

While reactive Java is gaining some traction, most Java coders I know still live in a multi-threaded frame of mind. Why? Threads are a relatively easy concept to grasp. Reactive Java requires us to rethink a lot of how we learned to code. …

Using an orchestration orchestrator

Conductor Andrea Vitello
Conductor Andrea Vitello
Image by artesitalia from Pixabay

In my previous article Running Java Microservices in Kubernetes, I created a set of deployment files for some example microservices that I created. Today I’m going to automate deploying them using ArgoCD. Argo will take a directory filled with deployment files and not only deploy them but give you some visibility into them.

To install Argo, I used their instructions with a few minor modifications. My commands were:

kubectl create namespace argocd
kubectl apply -n argocd -f \
brew install argocd
kubectl port-forward svc/argocd-server -n argocd 8080:443

This will expose the UI at port 8080, so you can browse…

Using priority queues to schedule work

Gears and stuff
Gears and stuff
Image by Pavlofox from Pixabay

I was recently reminded that Java has priority queues as part of its collections framework. A priority queue gets its name from one of its first usages, that of scheduling work in an operating system. It is a partially ordered list, which means that it doesn’t have to sort all the items, but only has to ensure that the least valued object is at the head. Because it doesn’t sort, it is more efficient than using a sorted list, but still allows you to pull the items off the queue in sorted order, least to greatest. …

Using Reactive pipelines to implement Gherkin based integrated tests

Image by Krzysztof Jaracz from Pixabay

One thing about integration tests is that you need to have state carried along from step to step. Let’s say you’re testing an application that implements a RESTful API. First, you want to create some test data and pass it along to the create endpoint.

Then you want to call another endpoint to see if you can retrieve it. You need the test data from the first step to be able to make assertions that the data retrieved in the second step is correct. It gets even worse when you have reusable steps that can be called in different orders…

When you can’t see the forest through the bells and whistles

Photo by Andrew Coelho on Unsplash

I have been working on a series of microservices that simulate a used car intake platform and as of now, I have managed to avoid Spring. Spring is a great framework when you need one of everything, but sometimes you just need a simple service and don’t want a 20–30 second start-up time.

One of the reasons I like to do small simple services in JavaScript is its lack of overhead and boilerplate. In the world of microservices, smaller is always better, and I think the reason so many fail at achieving success with microservices is that they’re still building…

Because it’s a terrible time for sobriety.

Person Drinking
Person Drinking
Image by Concord90 from Pixabay

All my life I was told I’d become an alcoholic if I drank alone. Here’s my chance to prove everyone wrong. Just as all my prior managers thought I could never be productive unless I was in constant view of their office, the naysayers of the world thought I couldn’t be trusted to drink unless there was a bartender present to cut me off. Well, guess what: I can.

Whereas most people talk about a work/life balance, I like to think about it as a work/drink balance. And here’s the good news: it’s not a zero-sum game. Sometimes a shot…

Microservices tied together with RabbitMQ and Couchbase

Cute little ducklings
Cute little ducklings
Image by Terri Zakraysek from Pixabay

In my previous article Java Configuration for Docker, I took a set of microservices, made Docker images from them, and tested it all out using Docker Compose. Now I will take it one step closer to production-ready by migrating all of that to Kubernetes. Kubernetes will give me the orchestration aspects to scale my system up and down as needed, plus the possibility of industrial-strength monitoring.

But first I should make some decisions. The services are reliant on RabbitMQ and Couchbase. Should these components run inside of Kubernetes or outside? There are pros and cons of each that I could…

How environment variables won the day

Tools being used inappropriately
Tools being used inappropriately
Image by Steve Buissinne from Pixabay

Docker did the unthinkable: it got everyone to agree on a platform. Even if you’re running Docker on Mac or Windows machines, there’s a Linux virtual machine lurking in the background. When I was a very young programmer, my manager asked two of us which platform the company should focus on as a server. I said some variant of Un*x like BSD which was very popular at the time and my peer said Windows NT. I guess we were both wrong, but I was the closest, as Linux is a variant of Un*x that one could say went viral.


Sometimes doubles are a better alternative to mocks.

Flightless bird head and wooden twin
Flightless bird head and wooden twin
Image by analogicus from Pixabay

When you write a unit test for some piece of code, you should only be testing one piece of code, not the code that it calls. Otherwise, you could be duplicating your testing effort. One way of isolating the code is by mocking objects or methods that are called. However, if you are mocking an object, especially one that contains state, it can be difficult to coordinate the mocking code. If the object is an implementation of an interface, you might be able to use doubles.

A double is an object that behaves like its twin, except that it is…

Decomposing the rock.

Photo by Greg Rosenke on Unsplash

In my last series of articles, I have created a monolithic set of Java classes that all run with a single main function. In this and future articles, I’m going to break them apart into separate services and run them all on the Docker Desktop flavor of Kubernetes. Ultimately, they should be able to run from any flavor of Kubernetes on any cloud provider. I will try to stick to the standard deployments as that will give me flexibility later on if I should want to move to the cloud.

The code I have been working with is a simple…

Randal Kamradt Sr

Software dev for thirty years still keeping on top of the latest tech trends. I write about the learning process.

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