↓Skip to main content

Week Notes 2026.42

·5 mins

The Tension Between Development and Operations #

One of the services I look after uses AWS Batch to run GPU compute jobs on EC2 instances. It would work great if not for two problems:

  • There is high demand for GPU instances so it is not always possible to provision an instance to run the batch jobs - we have even seen work queued for several days waiting for a GPU instance to become available.

  • When an instance is provisioned, it needs to copy model files from S3 and pull in a large Docker image, which takes 10-15 minutes for every new instance. In the worst-case scenario, when we are handling 2-3 jobs an hour, every job could incur this provisioning overhead taking its run-time from 7 minutes (on a g6e.2xlarge instance) to almost 22 minutes.

Our work-around for this was to use a larger instance than we needed (because g6e.4xlarge instances seem to be more readily available) and to configure the Batch Compute Environment to keep an instance running all the time (so we don’t incur the overhead of provisioning a new instance for every job). The downside to this is that we are paying for an instance to sit idle most of the time: jobs complete in about 3.5 minutes on a g6e.4xlarge instance and we are only handling 2-3 jobs an hour. At $3.00424/hour for the instance, costs soon mount up and the cost per job rockets from an expected $0.18 to $1.20.

Not unreasonably, our CEO asked if we could do anything to reduce these costs. The obvious solution is to process jobs in larger batches so the instance provisioning overhead is shared between more jobs (this assumes we are able to provision an instance when it’s needed so we can terminate our long-running instance).

Despite its name, AWS Batch does not have built-in support for controlling the batch size. The solution I came up with is to disable the compute environment so that jobs build up in the queue, then enable it to allow them to run. I implemented a simple Lambda function to automate this. It runs every 15 minutes (configurable) and checks the queue size, enabling or disabling the compute environment depending on the number of jobs in the queue.

It took me about 4 hours to implement, test, and deploy the Lambda (60 lines of Clojure for the lambda and 124 lines of Terraform for deployment). It seems to be working well: jobs are processed in reasonable time and our compute costs are down.

Management could have said “Thank you for completing this work promptly and reducing our Cloud costs by more than $1000/month”, but the feedback I actually got was “You should not have been working on a task that was not planned for this sprint.”

In case you’re wondering why I didn’t just ask if there was a more important task to work on, it’s because I’m in a different timezone from most of my colleagues so the task was complete by the time any of them showed up on Slack.

I see this as a tension between development and operations: is implementing a small Lambda function development work (that should be included in sprint planning) or is managing cloud costs an operations task for which every sprint should have some slack?

Spam Filtering Like It’s 2002 #

I noticed a slight uptick in spam hitting my inbox since I stopped using Thunderbird - their client-side filtering must have been doing some good! My mail provider runs server-side spam filtering but this doesn’t catch everything and I always saw the value in user-controlled Bayesian filtering, so I was looking for a way to integrate that into my new mbsync and mu4e setup.

Of course someone has already done this. I adapted his process-mail.sh script for my system and will see how it goes. It uses bogofilter which was written by Eric S Raymond back in 2002, so this feels like a trip to back in time.

An Unexpected Electricity Bill #

My sister received an unexpected electricity bill for more than £1000. It turns out that since she changed supplier at the beginning of the year, they had only been billing her for gas. Even so, the bill was much higher than expected and she asked me to take a look.

She had a new electricity meter fitted in June and usage since then has averaged 5.47 kWh per day. But when I looked at the retrospective bill for the first half of the year, usage averaged 21.47 kWh/day from January to March and 25.47 kWh/day from April to June. What could explain this discrepancy? Heating and hot water are fuelled by gas, and she was not running any different appliances in the first half of the year.

My sister also has a 3.6 kW solar installation. Looking at the power generated by my 4.5 kW installation, I estimated her panels will have been generating about 18 kWh/day on average. This also happens to be approximately the difference between the old daily average usage and the new.

Is it possible that her old electricity meter was counting both generated electricity and usage, or that she sent them the wrong reading? That would also explain the increase in the April-June readings compared to January-March, as the longer, brighter days would be generating more solar power.

We are waiting for a response from her electricity provider.

Listening #