Skip to main content

Posts

Showing posts from September, 2025

Looking outside the service boundary

Help others to help yourself This post is about how it sometimes pays to take a look beyond the services your team owns, so that you have a deeper understanding of the operating context and can have confidence in the performance and robustness of the implementation. I wouldn't claim to be an expert in anything, but sometimes my extra pair of eyes picks up on an opportunity to make a small change and get a significant benefit. Database queries  Back when I was operating in an environment where teams had access to logs and metrics of the services  of other teams, I could dip into what was going on when my login service was hitting timeouts form a dependency. Based on the details in the logs, the culprit seemed to be delays from a database query. Surprisingly enough, the database was missing an index for most common query pattern, so as we scaled up from a few hundred users to a few thousand  Default configuration options don't always match what has been in place i...

Improve performance, without introducing failure seams

Learning from the mistakes of others A few years ago a team that worked across the office from my team came up with a neat way of introducing a cache to speed up the performance of the most business critical pages on the company's main money earning website. Page load time had been identified as a particularly significant aspect of how search engines would rank the value of websites, so getting a few milliseconds off that metric was a great achievement. Fast forward several months, the unthinkable happened as the infrastructure component that was at the heart of the caching implementation had a temporary outage, taking away the possibility of loading pages at all. It was quite a while ago, and I wasn't directly involved in the recovery process but I expect that it would have taken a stressful hour or three to recover. Avoid introducing points of failure As inevitably happens, the project that I was working on required some performance improvements in order for it to be consider...

Java 25 Hello World, almost unrecognisable as Java

Hello world in Java 25 can be very different to any earlier version of Java. void main() { IO.println( "Hello world" ); } That's it, no package, no import, not even having to specify a class. Even that  IO  represents a class that was only introduced in Java 25. If you saw that code in a multi-choice lineup of code that should and should not work in Java 10 years ago you wouldn't dream of regarding it as valid Java. The main method is also so different to traditional Java. There's no "public", no "static", and no parameter list. It's still early days, but I'm not a fan. 

When to avoid, or allow upserts

Introduction  A few recent posts on this blog have outlined how we could achieve version aware upserting of data into various databases. In this post let's consider situations where that might be an unsuitable approach.  An assumption about Id uniqueness When we attempt to take an entity and write it into a database, we have an expectation that the attribute or attributes that are used to uniquely identify that entity are safe to handle as trustworthy within the business domain. Let's consider a situation where that assumption has been known to fall down in real production systems. Generation of a value to be used as the primary key in a relational database can seem to be a solved problem, given that we now have UUIDs that can be generated and passed around for use in our applications and services. Some earlier implementations for generation of UUID involved combining the MAC address associated with the network device of the machine and the current time as a way of combining t...

Designing APIs for use by AI, and others

Introduction  I recently listened to a podcast episode that offered an introduction to some of the core concepts of retrieval-augmented generation (RAG) for artificial intelligence systems. One of the many points covered was the opportunity to prompt the system to inform the user if it could not determine a crorect answer. In this post I will share some real world experience of how attention to detail in API design can help or hinder this capability. Example of an unintended limitation  "A chain is only as strong as its weakest link" . Databases and search engines have different use cases and so have different associated expectations around what type of behavior is expected when the system is not fully operational. Most databases are based on a concept of indexes and records, where it is only appropriate to present back a query result if the authoritative data store has successfully been contacted and produced a result. Search engines can be a little bit looser, on the basis ...

Always learning - Consistent hashing to reduce impact of database shard rebalancing

Introduction This post will describe an approach to balancing the distribution and redistribution of data in horizontally scaled databases. It is something that I came across as part of preparing for system design interviews, which often involve discussions weighing up the pros and cons and risks of applying particular approaches to storing data. Storing structured data at scale What is structured data? Structured data is at the core of most applications on the Internet. Without going into too much detail, let's just expect that it is something that is stored in a way that enables us to consistently be able to retrieve it for later use and be in a particular known shape. How does retrieval work?  Retrieval of structured data basically involves taking an identifier, such as a primary key, and being able to quickly look up an index to the one location that is expected to give an authoritative perspective of the current state of the corresponding record. In the simplest case of a sing...

Upserts with version awareness in DynamoDB

Introduction ElasticSearch has a concurrency control capability that enables writes to use a version value to determine whether to apply an update or discard it as being stale in comparison to some existing data. As part of considering a migration away from ElasticSearch as a data store, I was interested in how other databases could be made to achieve the same type of version aware upsert capability. In some earlier posts on this blog I have shared how the version aware upserting can be done with PostgreSQL, MariaDB and TitanDB. This post is to share how the same capability can be achieved with AWS's DynamoDB document database, as an example of a non-relational database. What does the DynamoDB API offer? Insert, or update  DynamoDB has putItem for creating an item in a DynamoDB table, and updateItem for updating an existing item. On first look, we might expect some combination of putItem and updateItem to need to be applied, as that would resemble how the relational databases had t...

How to include AI in the developer interview process

What problem are we trying to solve? In an earlier post I put forward an observation that as of September 2025 (month of posting), companies that are looking to hire professional software developers include a setup in the interviewing process that takes away common code assistance, which is in stark contrast to the way that developers joining the company would be expected to operate in their day to day work. I've had a little bit of time to contemplate this, and while I do not have a solution that involves keeping the AI features enabled, I do have the an idea of an alternative approach to include some consideration of AI. Look what the AI made us do Instead of getting developers to cram revision of computer science fundamentals by re-reading  Cracking The Coding Interview  to fit a cookie-cutter template of what a good developer should be expected to produce for a given coding challenge, we could instead present examples of code that has been generated by AI, and have the can...

Not the gotcha I was expecting

So there I was, starting a tech interview...  I recently attended a couple of online technical coding challenge interviews (apologies to anyone reading my posts in chronological order, this is a fast-follow to the previous one). To give myself a better chance of success in the second one I thought to ask for the initial requirements as text after I had made my initial attempt at interpreting what the interviewer had described. To my astonishment, the interviewer said that he wasn't sure whether that was allowed, and that he would be able to clarify any points if I wanted to raise them. Why was I so surprised? I've attended a few online interviews over the course of my career, and it has never been about listening comprehension and recall. Not so long ago I was on the other side of this particular type of interviewing process at the same company, so I thought that I had a solid grasp on how the interview works. Does it matter? I was bit caught off guard, as I hadn't expected...

Developer interviews out of step with reality

Disclaimer  I am in the process of trying to get back into the workforce, after taking a few months out to be more available for family while dealing with a medical situation. After some time away from coding my muscle memory for solving little software problems is a bit slower than normal, so I fear that I may not be coming across as being a relatively intelligent and capable professional software developer with over two decades of industry experience. I'm feeling a bit glum, as shortly after each interview I established some aspect that I had not covered off with my implementation - which can be a showstopper for progressing to the next round of the interview process. The coding interview process is out-dated Disable default editor functionality I have attended a couple of online coding interviews in the last couple of weeks, and found myself having to disable some of the default features in my integrated development environment to enable myself to show my own capabilities separa...

Sequenced Collections, Look before you leap

I have been giving myself a refresher on Java Collections APIs as part of preparation for coding interviews. It's not all reading dry documentation, as we now have podcasts, youtube videos and all manner of consumable media available to consume. On one particular podcast episode I heard about Sequenced Collections, which was something that was introduced with Java 21 a couple of years ago. An example of some functionality introduced by Sequenced Collections is the option to obtain a reversed view of a collection. The key word to pay attention to there is, "view". So, if we take an ArrayList and call reversed()   what we get back will be a SequencedCollection of the original ArrayList. As part of the SequencedCollection we can then call addLast(e) to add the specified object, e, onto the end of the collection. The gotcha If the ArrayList contains many objects then we will be faced with the performance overhead of adjusting the location offset of each individual existing en...