RSSAmplifier

Blog

Mike my bytes

Recent content on Mike my bytes

mikemybytes.comRSS feed ↗49 posts

Latest posts

Kubernetes CPU limits - When JVM sees more than it should

To limit, or not to limit - this is the question that Java developers ask themselves when configuring CPU resources for their Kubernetes pods. Avoiding a strict pod CPU limit can be beneficial for latency-sensitive workloads, as it prevents pauses caused by CPU throttling. At the same time, running without a CPU limit removes an important signal the JVM uses to size its internal thread pools. When…

Great engineers keep asking "Why?"

I’ve had some health issues in the last few months. Moving from one doctor to another made me realise something important. Great engineers, just like great doctors, keep asking “why?” . This question is not only about curiosity. It’s a tool. When we go to a doctor, we expect a diagnosis, not stating the obvious. Cough, fever, stomach pain - these are not much different from timeouts,…

Java 24 - Thread pinning revisited

Back in 2023, I got extremely excited about the release of Java 21. It felt like a significant breakthrough, similar to Java 8 . I was also one of the early adopters of virtual threads in my production code. Back then, thread pinning was the main limitation of this promising solution. The negative impact of thread pinning was initially exaggerated. Shortly after the Java 21 release, many popular…

A year of scaling myself

2024 was eventful, but professionally quiet. I didn’t speak at major tech conferences, write as many blog posts, or spend as much time on technical deep dives. Still, it was one of the most important years in my almost 12-year career. It was just a bit different. 2024 was a year of scaling myself . Instead of working more, I’ve been exploring ways of making an impact differently. I…

Continuous monitoring of pinned threads with Spring Boot and JFR

In my previous article about Java Virtual Threads I focused on different pinning cases caused by the synchronized construct. Some of the presented cases were far from being evident just by looking at the code. That’s why I believe that actively monitoring our apps for pinning is a must. We don’t know if the pinning happens in our app if we’re not monitoring it . We don’t…

Curiosities of Java Virtual Threads pinning with synchronized

If you heard about Java Virtual Threads, you also heard about the pinning phenomenon . Yet, many articles I found online stop at “ replace synchronized with ReentrantLock and don’t use native methods or foreign functions ”. While I don’t want to discuss the second part here, I think good-old synchronized deserves a bit more attention. Note: If you are not familiar with…

The trap of testing simple orchestration

Orchestration code organizes calls to other components (dependencies) into a certain process. Such pieces of code are sometimes called coordinators or controllers. Orchestration code is usually simple. There’s no (or almost no) conditional logic, or algorithmic complexity. Its main job is to delegate the work to appropriate dependencies in a specific order. Separating orchestration from the actual…

Spoiled but enlightened

Everybody knows that programmers are spoiled. When not enjoying free fruits in their fancy offices, they probably work from the end of the world that looks like a paradise. Even during challenging economic conditions, the market still tries to exceed their expectations… A comfortable life and great earnings - who wouldn’t want that? In fact, there’s much more to appreciate. Most…

Kotlin 'equals ignoring fields' using data classes

Equals ignoring fields is a pretty common operation. While often used within the test code to exclude selected fields from equality assertions, it can also be handy in our domain code. With Kotlin data classes , we can implement equals ignoring fields without using reflection or extra libraries . This solution feels almost too simple to describe, but it’s interesting to compare it with the…

Is 21 the new Java 8?

Not all Java releases receive the same attention from the community . The ones marked as “LTS” have a much higher chance of broad adoption (even if many of us don’t fully understand what the “LTS” means ). This alone makes the recently released Java 21 a serious contender. I believe it’s the most influential Java release since Java 8 . Just not all of its…

Centralizing the decision-making

Imagine we’re building yet another e-commerce platform. One of its crucial business processes is, of course, processing an order. After a successful payment, the Orders module (domain) has to call Warehouse asynchronously to prepare purchased goods. Yet, they may not be there. Usually, it’s not a big deal, since we can get them from our suppliers. But what if any of the items are not…

Content is king, I'm still Mike - blog revamp

I launched my own brand “Mike my bytes” in November 2020 as an experiment. Rebooting my existing blog (dated back to 2015!) along with becoming active on Twitter really paid off. Apart from joy, it also brought thousands of people interacting with my content every month. Today, it’s high time to make some adjustments. Refreshed mikemybytes.com design is just the beginning.…

10 years of software development

The calendar doesn’t lie. A decade of my professional career in software development has just passed. 10 years of experience always felt like a magical and very distant boundary. Am I a better engineer now? Am I a different person? Absolutely! Yet, it didn’t happen overnight. Reviewing these changes is a fascinating exercise. Sometimes I struggle to remember what I had for lunch the…

Introducing JUnit 5 FormattedSource

Quite some time ago, JUnit’s @CsvAnnotation caught my attention. It turned out so interesting, that I dedicated it a separate blog post and a significant part of a conference talk . It also inspired me to create a new way of writing parameterized tests with JUnit 5. The JUnit 5 FormattedSource library allows defining test case arguments in a human-readable way, following a user-defined…

A simple pattern to keep your business logic together

Keeping our domain (business) logic together is usually a really good idea. It not only makes it easier to reason about the most important part of our code but also increases its cohesion. Yet, decoupling the domain code from all the rest (orchestration, persistence, etc.) can be tricky. In this post, I’d like to share a simple pattern that helps me with that. The amazing Unit Testing…

Squashing DB migrations using Testcontainers

Database migrations are a standard way of dealing with database schema changes, especially in the relational world. No matter which solution we choose (e.g. Flyway or Liquibase in the Java ecosystem), the number of migrations usually grows together with the project itself. An unfortunate side effect is that the test execution time grows as well. An effective way of speeding up our test execution…

Gazing into a crystal ball - my predictions for 2023

The very last days of the old year are probably a good time to think about the next one. Although we already learned how inaccurate any predictions can be, it still feels like an interesting exercise to me. Let’s try to predict the tech future just a little bit… 🔮 I have to warn you, that everything you’ll read here is just a reflection of my own gut feeling. It’s a bunch…

What happens when you only limit the maximum heap size?

The JVM has spoiled us with its cleverness . It makes so many decisions behind the scenes, that lots of us gave up on looking at what’s inside. Memory-related discussions are probably more likely to appear at a conference or during a job interview than at “real” work. Of course, depending on what you work on. Java apps are often run in containers these days. Built-in container…

JSON, Kafka, and the need for schema

When I started my journey with Apache Kafka, JSON was already everywhere. From Javascript UIs, through API calls, and even databases - it became a lingua franca of data exchange. For many organizations adopting Kafka I worked with, the decision to combine it with JSON was a no-brainer. Yet, this post is not really about Kafka itself. It’s not another how-to guide either. Using Kafka made me…

The API should guide you

We create APIs all the time - and I don’t have only libraries and frameworks in mind. Every piece of code that’s intended to be called by another piece of code is an API , in some sense. It’s our job to define an interface, which will be used to achieve whatever is expected. While discussing various API designs, we often focus on “how it’s gonna look” first.…

Java records & compact constructors

Java records should be no longer considered as a “new concept”. Introduced in early 2020 (with version 14) have already been adopted in many projects and organizations. Yet, while we all know that they provide getters, equals , hashCode , and toString for free, there is one feature that still feels a bit unknown. Let’s see how compact constructors can help us write more idiomatic…

Go-live is a test of flexibility

We want our applications to be maintainable, reliable, resilient, and scalable. All these features seem to share the same idea: being flexible. This flexibility is often manifested in the early design documents close to the buzzwords and technology names. But that’s only the marketing. The true test of flexibility comes with the first go-live . “Production will verify” as my…

Pragmatic tests parallelization with JUnit 5

Running tests sequentially seems to be the current status quo in the Java community, despite the number of CPU cores our computers have these days. On the other hand, executing all of them in parallel may look great on paper, but it’s often easier said than done, especially in the already existing projects. With version 5.3, the JUnit framework has introduced experimental support for the…

Parameterize like a pro with JUnit 5 @CsvSource

Parameterized tests are definitely my favorite feature of JUnit 5. Defining multiple sets of arguments for the same test can significantly reduce the amount of the test code. Recent additions to the JUnit 5 enable us to write such tests in a whole different way, improving both readability and expressiveness. This article won’t be yet another primer/overview (like this great introduction from…

No need to hate Java default methods

While browsing Twitter a few days ago, I’ve been reminded about a quite controversial topic in the Java community, which (apparently) still is using interface default methods. To be honest, I’ve been a bit skeptical as well when I’ve first seen them coming as a part of Java 8. However, today I’ll write a few words in defense of default methods, as when used carefully, they…

SLA is the new CAP

The world has changed quite a lot since 1999 when Eric Brewer formulated his famous conjecture, known as the CAP Theorem today. Back then, the systems were running mostly on a self-hosted and rather expensive infrastructure, often related to the software components in use (due to licensing, etc.). A proper understanding of availability & consistency trade-offs in the presence of network partitions…

How startup time affects reliability

There seems to be a lot of interest in improving application startup time these days, driven by the discussions on languages and technologies (like Go, Node, or GraalVM), that provide almost instant startup for serverless functions (a.k.a. lambdas) being run in the cloud. However, such a speedup brings benefits to other types of processing as well. In this post, I’d like to present a…

You can't afford to run Java 8

Syntactic sugar (like the introduction of var ) is often not enough to convince somebody (especially non-developer) to move forward. This is one of the reasons why Java 8, almost 7 years after its first release, is still widely used. However, many things have improved apart from the syntax. When taking all of them into account, it may turn out that you can’t afford to run Java 8 anymore .…

Closing Java Streams with AutoCloseable

What could be kind of surprise even for some experienced Java programmers, the java.util.Stream interface extends java.lang.AutoCloseable . This (in theory) puts it on par with files, DB connections, and other resources requiring manual closing. Should we close all our Streams in the same way as any other resources? In this post, I’d like to explain which Streams have to be closed and how…

Single-partition Kafka topics

Apache Kafka has been designed with scalability and high-performance in mind. Thanks to its architecture and unique ordering guarantees (only within the topic’s partition), it is able to easily scale to millions of messages. However, there are some specific situations when using a topic with just one partition (despite being against mentioned features) might be a valid and simple solution to…

Technical interview tips for valuing candidates' time even more

The end of the year is an especially intensive recruitment season for many IT companies & software houses. This does not mean that only HR departments have their hands (and calendars) full. As one of the last steps before offering (or not) a job, a technical interview has to take place. Selected engineers , previously busy with technical stuff, have to now become recruiters , verifying…

Isolation issues with Helm umbrella charts

In this post, I’d like to describe the issue I’ve recently encountered when using Helm umbrella charts. Long story short, it turned out that subcharts are not completely isolated from each other, contrary to what we probably would expect . This feature has also some important consequences for building umbrella charts and combining different dependencies into one parent chart, which I…

Introducing Mike my bytes

People are using all their senses for recognition. Just think about how many jingles, slogans, images, or even actor faces unequivocally remind us of something. They are consistently building what we call a brand. It’s not a coincidence by the way - it’s called multisensory marketing . Software engineering loves consistency too - not only when ACID comes to play, but also in terms of…

DYI security audits - half a year later

At the end of 2018, I had a pleasure to give a talk at Testwarez - the oldest testing-oriented conference organized in Poland. The recording recently appeared on YouTube , so I decided to take this opportunity to figure out what has changed through the past few months in terms of tools that I presented. The goal of my talk was to present some practices and open source tools for improving the…

What could your luggage tell you about the cryptography?

A typical luggage case padlock with 3 rings and TSA (backdoor) lock on the left A combination of 3 digits - this is the level of protection offered by the vast majority of luggage cases on the market. 3 digits secret code, that should keep all your personal belongings safe at the aircraft, lobby and hotel room. Lots to expect for just 3 digits…

Project Lombok - beyond DRY

I have to admit, that when I first saw Project Lombok few years ago it was quite odd to me. The whole “annotation thing” and code pieces appearing “magically” inside the classes made me skeptical. A few years later, I’m now a fan of using Lombok in my Java projects for many reasons. Not all of its users know, that Lombok has more than just reducing the boilerplate…

Build docker images with Jenkins running in docker

Building docker images within the CI pipeline isn’t something new or unusual these days. Normally it’s super easy - you just have to install Docker in your Jenkins CI environment and add jenkins user to the docker group. Problems appear when your Jenkins instance is a docker container itself. Inception begins How to make docker available inside your container? Here is a three steps…

SolrCloud on production - the memory

I want to share with you some of my thoughts about using Apache Solr (especially SolrCloud ) on production. In one of the projects I’m participating in, we are using it to provide Near-Real-Time (NRT) searching along with frequent updates to the indexes. Here are some tips, that helped our project stand still on production environment against hundreds of simultaneous requests per second.…

The uncertain future of Keyczar

The cryptographic world changed a lot since 2008 when Google’s Keyczar library showed up. However, one thing is still the same - effective cryptography is really hard to implement. Keyczar library was a quite successful attempt to provide easy to use crypto solutions based on current security standards to Java, Python and C++. Now, after 9 years of its development, the future doesn’t…

Still using @author for every file? Please don't...

Luke, I am Your Father! In his first day at the new job, Bob created the following class: import java.util.Arrays ; import java.util.List ; /** * Returns a sum of given numbers. * @author Bob */ public class NumberSumCalculator { public int sum ( List < Integer > integers ) { int sum = 0 ; if ( integers != null ) { for ( Integer integer : integers ) { sum += integer ; } } return sum ; } } He was…

Welcome to HTTPS era with Let’s Encrypt!

As you can already see in the browser&rsquo;s address bar, my blog (along with other sites on mkowalski.net domain) received HTTPS support. Thanks to Let’s Encrypt everyone can get valid HTTPS certificate for free! Interested? Check out their&rsquo;s Getting Started Guide . If you are lucky enough your hosting provider may already support Let&rsquo;s Encrypt automatically. In my case a manual…

How micro should a microservice be?

Two days ago I&rsquo;ve participated in a JUG meeting in Poznań which special guest was famous Java rock star Adam Bien with his presentation called Microservices in 2016 — What Worked Well . The session was focused on the typical Bien&rsquo;s stack: JEE microservices & Docker and overlapped with his presentation on Devoxx Poland 2016 . But don&rsquo;t get me wrong - it was totally worth it! The…

Docker shared storage file permission problems

Case Imagine the following scenario: your world-famous web application is hosted with two Docker containers (eg. with application server). Both containers have access to same host&rsquo;s directories (passed with Docker&rsquo;s -v parameter) mounted as: /configuration - containing few configuration files, /logs - storing log files outside containers. Arguably, there are lots of better solutions…

Make your git commit verbose

Even if committing changes with git is straightforward, sometimes you want to verify all changes before doing it (e.g. to come up with with a nice and meaningfull commit message). Luckily there is --verbose switch for git commit . According to the manual ( git commit --help ): -v , --verbose Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message…

So you think you can skip tests? The &#34;dark side&#34; of Maven

Tests are the light side of programming. Period. Running test cases is one of the fundamental duty of every build automation system - including Maven. Even if it&rsquo;s a kind of ritual and the determinant of style, every experienced programmer knows that sometimes things just have to be MacGavyered instantly. But how to fold up a late night app version using only Maven, bottle of ketchup and an…

Solving locale issues with docker containers

When docker kicked in to the enterprise market many things started changing. Along with microservice-based architectures it became a must-have technology for any &ldquo;modern&rdquo; project (the containers idea itself isn&rsquo;t new - docker has just made things much simplier). In analogy to Java related slogan from 1995 &ldquo; Write once, run anywhere &rdquo; almost 20 years later docker…

Apache FOP - center table cell vertically

Nowadays we can argue if using Apache FOP is still the best solution for generating PDF documents. One of it&rsquo;s biggest competitors is probably JasperReports Library which supports multiple file formats and does not require creating XML templates manually from scratch (thanks to Jaspersoft Studio ). However, sometimes you just have to face the FOP&rsquo;s XML monster :) The FOP&rsquo;s way of…

Checkout specific Git branch or tag using its name only

For some compatibility reasons I needed to checkout specific branch or tag in the Git repository using only it&rsquo;s name (last part without refs/.../ prefix) from a bash script. For Mercurial repositories it&rsquo;s not a problem at all thanks to: hg checkout $tagOrBranch I haven&rsquo;t found similar solution using git checkout , so as a workaround I&rsquo;ve prepared the following bash script…

Hello world!

This post couldn&rsquo;t have started different - since I&rsquo;m calling myself a developer. Why Yet Another Developer Blog? It’s always good to write down things before forgetting them - isn&rsquo;t it a perfect excuse? Probably there is also another motivation… If you can&rsquo;t explain it simply, you don&rsquo;t understand it well enough. Albert Einstein