performance imgproxy Apache APISIX

Resizing images on-the-fly

As a web architect, one of the many issues is asset management. And the most significant issue in assets is images. A naive approach would be to set an image and let the browser resize the image via CSS: img { height: 100%; width: 100%; object-fit: contain; } However, it means that you download the original image. It entails two problems: the size of the original image and the suboptimal browser-based resizing. This post will cover two alternatives: traditional and brand-new s

web HTTP cache performance

Web resource caching: Server-side

The subject of Web resource caching is as old as the World Wide Web itself. However, I’d like to offer an as-exhaustive-as-possible catalog of how one can improve performance by caching. Web resource caching can happen in two different places: client-side - on the browser and server side. In the previous post, I explained the former; this post focuses on the latter. While client-side caching works well, it has one central issue: to serve the resource locally, it must first have it in the

web HTTP cache performance

Web resource caching: Client-side

The subject of Web resource caching is as old as the World Wide Web itself. However, I’d like to offer an as-exhaustive-as-possible catalog of how one can improve performance by caching. Web resource caching can happen in two different places: client-side - on the browser and server-side. This post is dedicated to the former; the next post will focus on the latter. Caching 101 The idea behind caching is simple: if a resource is a time- or resource-consuming to compute, do it once and st

Kotlin serverless FaaS JVM performance GraalVM native

Kotlin and FaaS, an impossible union?

Some time ago, I read a post describing how to run a serverless Kotlin function on OpenFaaS. While the content is technically correct, I believe the concept itself is very wrong. Such posts can lead people to make ill-advised decisions: 'because we can' is hardly a winning strategy. in this post, I’d like to first explain why the JVM platform is a bad idea for FaaS. Then, I’ll proceed to propose alternatives to use Kotlin nonetheless. I deliberately chose not to link to the original

Maven build performance Maven daemon Docker buildkit

Faster Maven builds in Docker

Last week, I described different techniques to fasten your Maven builds. Today, I’d like to widen the scope and do the same for Maven builds inside Docker. Between each run, we change the source code by adding a single blank line; between each section, we remove all built images, including the intermediate ones that are the results of the multi-stage build. The idea is to avoid reusing a previously built image. Baseline To compute a helpful baseline, we need a sample project. I create

Maven build performance Maven daemon Surefire

Faster Maven builds

Builds require a few properties, chief among them reproducibility. I would consider speed to be low on the order of priorities. However, it’s also one of the most limiting factors to your release cycle: if your build takes T, you cannot release faster than each T. Hence, you’ll probably want to speed up your builds after you’ve reached a certain maturity level to enable more frequent releases. I want to detail some techniques you can leverage to make your Maven builds faster i

hibernate query cache performance

Digging into Hibernate's Query Cache

I haven’t used Hibernate for a long time, and I haven’t blogged about it for even longer. Recently, I was working on a blog post in the context of my job on setting up an evergreen cache. When I was coding the demo, I faced some issue regarding Hibernate’s Query Cache: it didn’t work as I expected it to. Finally, after some time, I managed to fix the issue. This post aims to dig deeper into Hibernate’s Query Cache in order to help fellow developpers confronted with

minification performance HTML

Minification of HTML in Java EE webapps

Minification (also minimisation or minimization) is the process of removing all unnecessary characters from the source codes of interpreted programming languages or markup languages without changing their functionality. These unnecessary characters usually include white space characters, new line characters, comments, and sometimes block delimiters, which are used to add readability to the code but are not required for it to execute. Minification reduces the size of the source code, making its tr

GraalVM performance polyglot

My first impressions about Graal VM

Last week was the release of Oracle’s GraalVM. As stated on the website: GraalVM is a universal virtual machine for running applications written in JavaScript, Python 3, Ruby, R, JVM-based languages like Java, Scala, Kotlin, and LLVM-based languages such as C and C++. GraalVM removes the isolation between programming languages and enables interoperability in a shared runtime. It can run either standalone or in the context of OpenJDK, Node.js, Oracle Database, or MySQL. There are several fac

performance software engineering

Performance cost of reflection

In Java, it’s widely admitted that reflection - usage of the java.reflect API, comes at a high cost in terms of performance. Older Java versions had huge performance overhead, while it seems that newer versions bring it in the acceptable range. But what does 'acceptable' really mean? This is the question I asked when commenting on a performance review that advised to replace code based on reflection by standard code.

mutation testing quality performance

Faster Mutation Testing

As an ardent promoter of Mutation Testing, I sometimes get comments that it’s too slow to be of real use. This is always very funny as it also applies to Integration Testing, or GUI. Yet, this argument is only used againt Mutation Testing, though it cost nothing to setup, as opposed to the former. This will be the subject of another post. In this one, I will provide proposals on how to speed up mutation testing, or more precisely PIT, the Java Mutation Testing reference. Setting the bar

kotlin logging performance

Smart logging in Java 8 and Kotlin

Logging is a not a sexy subject but it’s important nonetheless. In the Java world, logging frameworks range from Log4J to SLF4J via Commons Logging and JDK logging (let’s exclude Log4J 2 for the time being). Though different in architecture and features, all of their API look the same. The logger has a method for each log level e.g.: debug(String message)info(String message)error(String message)etc. Levels are organized into a hierarchy. Once the framework is configured at a certain

devops graphite metrics performance spring Spring MVC

Metrics, metrics everywhere

With DevOps, metrics are starting to be among the non-functional requirements any application has to bring into scope. Before going further, there are several comments I’d like to make: Metrics are not only about non-functional stuff. Many metrics represent very important KPI for the business. For example, for an e-commerce shop, the business needs to know how many customers leave the checkout process, and in which screen. True, there are several solutions to achieve this, though they are