A Neate Blog


2020 Blog Posts


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.