Posts

When you have automated testing setup with a big display board to provide clear feedback, it’s tempting to try and use it for things it wasn’t intended for. One example of that is as a kind of reminder system – you identify a problem somewhere that can’t be addressed immediately but needs to be handled at some point in the future. It’s tempting to add a test that begins failing after a certain date (or the inverse, whitelisting errors until a certain date).
2014-09-21
2 min read
This caused me to waste 1/2 an hour or so this morning. It also needed some quite precise google-fu to uncover the solution. I’m bound to forget this and am likely to need it again so it’s going here. I’m not sure how most of the zillions of “upload multiple files with php” tutorials out there work, because none of them seem to mention this. I was doing multiple file uploads in php, and finding that although you submit multiple files with a multipart/form-data encoding type (and can see multiple files being submitted in chrome devtools), php was only reporting the last one in the list of uploaded files in $_FILES.
2014-09-08
2 min read
We were tracing a problem with occasional latency spikes on one of our systems the other day. The cause was rather unusual. The write load was not high, being a few megabytes per second at peak on an otherwise completely idle disk. We checked for the usual hardware issues; cache batteries, failing disks as well as other programs writing to that disk, but came up empty. Fairly regularly we saw a write latency of up to 40ms.
2014-09-01
12 min read
In my last post, I focussed on how to go about analysing your application’s inbound traffic in order to create a simulation for performance testing. One part of the analysis was determining how long to leave between each simulated message, and we saw that the majority of messages received by LMAX have less than one millisecond between them. Using this piece of data to create a simulation doesn’t really make sense - if our simulator should send messages with zero milliseconds delay between each, it will just sit in a loop sending messages as fast as possible.
2014-08-22
5 min read
Every web based product is adding “responsive design” to their feature lists. Unfortunately in many cases that responsive design is actually making their product much harder to use on a variety of screen sizes instead of easier. The problem is that common CSS libraries and grid systems, including the extremely popular bootstrap, imply that a design can be made responsive using fixed cut-off points and the design just automatically adjusts. In reality making a design responsive requires tailoring the cut off points so that the design adjusts at the points where it stops working well.
2014-07-26
3 min read
Ever since the public beta of OS X I’ve been meaning to get around to learning Objective-C but for one reason or another never found a real reason to. I’ve picked up bits and pieces of it and even written a couple of working utilities but those were pretty much entirely copy/paste from various sources. Essentially they were small enough and short-lived enough that I only needed the barest grasp of Objective-C syntax and no understanding of the core philosophies and idioms that really make a language what it is.
2014-07-20
6 min read
Apple have released Swift, their new programming language – designed to be familiar to Objective-C programmers and work well with the existing Cocoa frameworks. It’s far too soon to make substantial judgements about the language – that can only come after actually using it in real projects for some time. However, there’s nothing that stands out as incredibly broken, so with Apple’s backing it’s extremely unlikely that it won’t become a very commonly used language. After all, there’s plenty wrong with every other programming language and we manage to make do with them.
2014-06-03
2 min read
Did you know that it’s perfectly fine to enjoy programming in both static and dynamic languages? — Honza Pokorny (@_honza) May 26, 2014 I do a lot of coding in Java and JavaScript and it’s never bothered me that one has static types and one dynamic (and I’ve used plenty of other languages from both camps as well – it amuses me slightly that the two I use most often tend to be viewed as the worst examples of each type).
2014-05-28
3 min read
Writing automated tests to prove software works correctly is now well established and relying solely or even primarily on manual testing is considered a “very bad sign”. A comprehensive automated test suite gives us a great deal of confidence that if we break something we’ll find out before it hits production. Despite that, automated tests shouldn’t be our first line of defence against things going wrong. Sure they’re powerful, but all they can do is point out that something is broken, they can’t do anything to prevent it being broken in the first place.
2014-05-27
2 min read
Kevlin Henney’s talk from YOW is a great deconstruction of the SOLID principles, delving into what they really say as opposed to what people think they say, and what we can learn from them in a nuanced, balanced way. Far too often we take these rules as absolutes under the mistaken assumption that if we always follow them, our software will be more maintainable. As an industry we seem to be seeking a silver bullet for architecture that solves all our problems just like we’ve searched for a silver bullet language for so long.
2014-05-25
1 min read
In 2011 I put out an example php class that could be used to talk to the LMAX API protocol. It was incomplete and for illustrative purposes only. It remains that way. Over the years however there have been some improvements and it can now be used for placing, closing and cancelling orders. I’ve made the latest version available on github, just in case the handful of people who have contacted me over the years about it find it useful to have the latest version.
2014-05-14
5 min read
I wanted to create a CSV file showing the number of JUnit tests in our codebase vs the number of Spock tests over time. I can count the number of tests, along with the revision pretty easily with: git svn find-rev HEAD find src/test -name '*Test.java' | wc -l find src/test -name '*Spec.groovy' | wc -l But that outputs the results on three separate lines and I really want them on one line with some separator (comma, space or tab).
2014-05-12
1 min read
Marco Cecconi - I don’t love the single responsibility principle: The principle is arbitrary in itself. What makes one and only Reason To Change™ always, unequivocally better than two Reasons To Change™? The number one sounds great, but I’m a strong advocate of simple things and sometimes a class with more reasons to change is the simplest thing. I agree that we mustn’t do mega-classes that try to do too many different things, but why should a class have one single Reason To Change™?
2014-05-07
2 min read
This time we’re going to explore how functional programs express variance. We’ll consider the same case as we did for TDA – getting a stored value from a Map, and storing a new value in a Map. Retrieval lookup :: Ord k => k -> Map k a -> Maybe a In Haskell, the variance is expressed in the return type. data Maybe a = Nothing | Just a We might express this as follows:
2014-04-28
8 min read
Previously in the Testing@LMAX series I’ve mentioned the way we’ve provided isolation between tests, allowing us to run them in parallel. That isolation extends all the way up to supporting a multi-tenancy module called venues which allows us to essentially run multiple, functionally separate exchanges on a single deployment of LMAX Exchange. We use the isolation of venues to reduce the amount of hardware we need to run our three separate liquidity pools (LMAX Professional, LMAX Institutional and LMAX Interbank), but that’s not all.
2014-04-14
3 min read
One of the most common reasons people avoid writing end-to-end acceptance tests is how difficult it is to make them run fast. Primary amongst this is the time required to start up the entire service and shut it down again. At LMAX Exchange with the full exchange consisting of a large number of different services, multiple databases and other components start up is far too slow to be done for each test so our acceptance tests are designed to run against the same server instance and not interfere with each other.
2014-04-12
3 min read
Testing time related functions is always a challenge – generally it involves adding some form of abstraction over the system clock which can then be stubbed, mocked or otherwise controlled by unit tests in order to test the functionality. At LMAX we like the confidence that end-to-end acceptance tests give us but, like most financial systems, a significant amount of our functionality is highly time dependent so we need the same kind of control over time but in a way that works even when the system is running as a whole (which means it’s running in multiple different JVMs or possibly even on different servers).
2014-04-01
5 min read
LMAX Exchange has invested quite a lot of time into building a suite of automated tests to verify the behaviour of our exchange. While the majority of those tests are unit or integration tests that run extremely fast, in order for us to have confidence that the whole package fits together in the right way we have a lot of end-to-end acceptance tests as well. These tests deliver a huge amount of confidence and are thus highly valuable to us, but they come at a significant cost because end-to-end tests are relatively time consuming to run.
2014-03-30
4 min read
I took the time to start using Mike’s HDR histogram port to C the other day. It was pretty painless to use, once I’d overcome a couple of initial problems. One of which is that the C compiler I have on CentOS 6.4 was too old. So I came up with a workaround for older compilers/machines. HDRHistogram is Azul’s high dynamic range histogram. The readme on github explains what it is. Suffice it to say that I’m in the process of dumping the various implementations of histogram code I’ve evolved over the years in favour of this for latency and performance management.
2014-03-26
3 min read
This time we’re going to explore how tell don’t ask (TDA) programs express variance, and hopefully come across an interesting corollary of our TDA definition. We’ll consider two ubiquitous operations: getting and storing a value into a map. In both cases we’ll discuss the standard Java implementation before creating a speculative TDA version. Example one: value retrieval We want to lookup the value associated with a particular key. This operation has entropy two. Either the map contains the value or it does not.
2014-03-26
6 min read
One of the things we tend to take for granted a bit at LMAX is that we store the results of our acceptance test runs in a database to make them easy to analyse later. We not only store whether each test passed or not for each revision, but the failure message if it failed, when it ran, how long it took, what server it ran on and a bunch of other information. Having this info somewhere that’s easy to query lets us perform some fairly advanced analysis on our test data.
2014-03-25
1 min read
The key to making continuous integration work well is to ensure that the build stays green – ensuring that the team always knows that if something doesn’t work it was their change that broke it. However, in any environment with a build pipeline beyond a simple commit build, for example integration, acceptance or deployment tests, sometimes things will break. When that happens, there is always a natural tendency to commit an additional change that will fix it.
2014-03-23
2 min read
Here’s a fun one, we have some code generated using javassist that looks a bit like: public void doStuff(byte actionId) { switch (actionId) { case 0: doOneThing(); break; case 1: doSomethingElse(); break; default: throw new IllegalArgumentException("Unknown action: " + actionId); } } This works perfectly fine on Java 6 and Java 7 but fails on Java 8. It turns out the problematic part is "Unknown action: " + actionId. When run on Java 8 that throws “java.
2014-03-21
1 min read
The truth is out: money is just an IOU, and the banks are rolling in it: What the Bank of England admitted this week is that none of this is really true. To quote from its own initial summary: “Rather than banks receiving deposits when households save and then lending them out, bank lending creates deposits” … “In normal times, the central bank does not fix the amount of money in circulation, nor is central bank money ‘multiplied up’ into more loans and deposits.
2014-03-18
1 min read
Here is my High Performance Design talk from Java Day Riga 2013: Video: http://parleys.com/play/52fd3379e4b026889c6a3de0/chapter0/about Code Examples: https://github.com/nickzeeb/LmaxTeachingCollections Slides: https://docs.google.com/presentation/d/1Yxw-9ZFM_maRORk_qGkdt9vqKKQNLjDSSd9DIOtbrIE/pub?start=false&loop=false&delayms=3000#slide=id.gb9e7834b_05
2014-03-10
1 min read
I have recently started a major stream of work centered on a particular application in the LMAX stack. This application has had plenty of features added to it over the last few years, but nothing has really required an overhaul. Our work, however, is somewhat more involved; even finishing the simplest of our requirements has been taking a week or so – that’s a long time, for us. Hitting the buffers Our method, to begin with, looked something like the following:
2014-02-27
4 min read
Esoteric Curio折伏; as it relates to coding Our job as a team is to reinforce each other and make each other more productive. While I attempt to conquer some of the engineering tasks as well as legal tasks, and human resource tasks I face, I need concentration and it world certainly help to not be interrupted. I used to think I needed those times of required solitute pretty much all the time. It turns out that I have added far more productivity by enabling my teams than I have personally lost due to interruptions, even when it was inconvenient and frustrating.
2014-02-10
1 min read
Last week we had several reports of disconnections to some of our haproxy fronted services after we upgraded to a longer/stronger SSL certificate. As the version of haproxy we are running is quite old, we tried an upgrade to the latest (dev21). This fixed the disconnections, but after a few packets, it reliably crashed on the production systems. However we could not repeat the problem on any test or development systems, even through kickstart and puppet ensured they were identical to production.
2014-01-31
9 min read
I spoilt myself in 2013 for my Birthday and Christmas and bought the beautiful ASUS Zenbook UX301LA. The model I ordered comes with a touch screen WQHD (2560x1440) display, an Intel i7 4558U CPU, 8GiB of RAM and 2 internal SSDs. Needless to say it’s very cool! The laptop comes with OEM Windows 8, which despite all the bad geek press online I actually like it. Without a touch screen though it would be useless but with a touch screen it works quite well.
2014-01-30
5 min read
Geekdom is not a club; it’s a destination, open to anyone who wants to put in the time and effort to travel there… …dive headfirst into the things that interest you. Soak up every experience. Lose yourself in the pursuit of knowledge. When you finally come up for air, you’ll find that the long road to geekdom no longer stretches out before you. No one can deny you entry. You’re already home. via Hypercritical: The Road to Geekdom.
2014-01-14
1 min read