A Neate Blog


A collection of Neate thoughts brought to you by myself


20 May 2020 - Setup EmbeddedKafka for Unit Testing Kafka in Java

~ 2 minutes
Category: Technology

Unit testing Kafka can be a pain, it seems a lot of overkill to have an entire Kafka cluster ready just for unit testing purposes, luckily, spring-kafka-test helps with this by providing an Embedded Kafka instance you can use to produce or consume messages.

This article contains a short How-To guide on setting up Embedded Kafka to be used for unit testing an application.

TL;DR:- Using embedded kafka is a simple way to run unit tests that don’t have or need a local Kafka instance, such as your CI server



15 April 2020 - Using Persistable for JPA Performance Improvements

~ 5 minutes
Categories: Technology, Java

Using JPA to interact with a database is, and always has been, heavily popular for Java applications; this post contains an example of how implementing persistable results in performance improvements for certain use-cases that might not be commonly known. This is particularly useful if you have little to no control over the database schema or it isn’t designed that well.

TL;DR:- Implementing persistable on a Java entity can force JPA to either always insert or always update the records by overriding the isNew method instead of first checking whether the record exists via a select and then deciding whether to insert or update the record, this can heavily reduce the overall number of SQL statements executed by JPA. This is done automatically if you use a JPA Generated ID but there are times where you can’t control the ID within your Java entities…



9 March 2020 - Running Oracle JET in Docker

~ 5 minutes
Category: Technology

In the previous Dockerfile articles, we looked at a Dockerfile example that was an Oracle JET application, in this post we dive deeper and enhance this Dockerfile which results in a great way to run an Oracle JET application via Docker, whether that’s on a local machine or in the cloud.

TL;DR:- Oracle JET can be served via a simple web server tool such as Nginx or Express, scroll down to the end to see the final Dockerfile.



17 February 2020 - Simple Dockerfile Performance Improvements (Part 3)

~ 5 minutes
Category: Technology

In Part 2 we learned about how we can create multi-stage Docker builds, this article follows on from the previous therefore if you haven’t already, please give it a read!

This time in Part 3, we focus specifically on how your various stages can be cached in order for your CI process to build images quicker using the Docker layer cache by creating a setup stage that is used by multiple stages later on.

Note: Docker 17.05 or higher is required to enable Multi-Stage builds

TL;DR:- It’s possible to create an entire stage that can be cached, thinking carefully about your command order and any duplicated commands that can be moved to a “common/parent” stage significantly reduces overall build time.



22 January 2020 - Simple Dockerfile Performance Improvements (Part 2)

~ 5 minutes
Category: Technology

In Part 1 we learned about how the order of your Dockerfile commands matters along with copying only what you need, using these principles, this post dives deeper into a Dockerfile and reveals a great strategy called multi-stage builds that provide immense power when used correctly.

Note: Docker 17.05 or higher is required to enable Multi-Stage builds

TL;DR:- Whilst slightly more advanced, using multi-stage builds is often the ultimate Dockerfile improvement, this allows you to run intermediate containers to perform processing whilst only keeping the end result or compiled artifacts in your final docker image, thus resulting in a significantly smaller image.



20 December 2019 - Simple Dockerfile Performance Improvements (Part 1)

~ 8 minutes
Category: Technology

As a developer, I find that one of the easiest ways to ship an application is to create a Docker image via a custom Dockerfile in order for it to be deployed usually on AWS/Azure/Oracle cloud Kuberenetes (AKS, EKS, OKE). In recent times I’ve spent some time looking into the docker image created and attempted to find ways to shrink the final image size and also make the build quicker by caching docker image layers, this post is Part 1 of my approaches and also the final outcomes. This particular Dockerfile builds an Oracle JET UI Application.

TL;DR:- Ordering your commands in terms of slowly-changing outputs to more frequently increasing output has a huge impact on build time, explicitly specifying files to copy instead of copying everything results in image size reduction and finally using ADD for local tar archives means Docker will automatically unpack the archive for you, no more manual unpacking! The above might sound like common sense but they’re often overlooked, even in production ready applications.



14 November 2019 - Changing the default editor of Kubectl Edit

~ 1 minute
Category: Technology

If you find yourself working with Kubernetes, whether that’s in the cloud on AKS (Azure), EKS (AWS), OKE (Oracle Cloud), GKE (Google Cloud) or even locally, chances are you have encountered the need to edit a piece of config via the kubectl edit command, did you know that you can change the default editor that kubectl edit uses, on Windows it’s Notepad by default but I changed it to VS Code and here’s how.

TL;DR:- You need to create an environment variable named KUBE_EDITOR, the value should be set to the CLI command to open the editor of your choice and ideally specify a watch flag so K8s knows when the file has has been saved and closed.



5 November 2019 - Nordic APIs 2019 Platform Summit

~ 1 minute
Categories: Technology, Presentation, Nordic APIs

The Nordic APIs 2019 Platform Summit attracted both industry experts and thought leaders, this year I was lucky enough to be selected to present a consumer’s take on GraphQL vs REST. My short presentation and accompanying demo (written using Oracle JET) imparted the top 3 factors a consumer considers when looking at an API, the key take-away is that ultimately the design of the API is more important than the technology the API is built in.



3 July 2019 - UKOUG Southern Technology Summit

~ 2 minutes
Categories: Technology, Presentation, UKOUG

Early July I had the pleasure of presenting at the UKOUG Southern Technology Summit, this one day conference contained various streams but I mainly attended the Development stream. Three of the sessions that stuck in my mind were Phil Wilkins’ presentation of “What Makes A Good API”, David Callaghan’s session on “Hermes’ Chatbot, Holly” and finally Susan Duncan’s session on “High Productivity in a Microservices World”.