<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tom Hay on Medium]]></title>
        <description><![CDATA[Stories by Tom Hay on Medium]]></description>
        <link>https://medium.com/@tomhay99?source=rss-70bbc924f6b3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QqnM-pOR_iXi6feM2Hpskg.jpeg</url>
            <title>Stories by Tom Hay on Medium</title>
            <link>https://medium.com/@tomhay99?source=rss-70bbc924f6b3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 18:32:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tomhay99/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Flying mammoths and Olava the Feeble]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@tomhay99/flying-mammoths-and-olava-the-feeble-8bbbf5746ada?source=rss-70bbc924f6b3------2"><img src="https://cdn-images-1.medium.com/max/999/1*2psSP-xvfDVxvZqso0_Y1g.png" width="999"></a></p><p class="medium-feed-snippet">I knew something was wrong when a saw a woolly mammoth floating 20 feet in the air. I mean, not on Camden High Street&#x200A;&#x2014;&#x200A;that would have&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@tomhay99/flying-mammoths-and-olava-the-feeble-8bbbf5746ada?source=rss-70bbc924f6b3------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@tomhay99/flying-mammoths-and-olava-the-feeble-8bbbf5746ada?source=rss-70bbc924f6b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bbbf5746ada</guid>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[humor]]></category>
            <category><![CDATA[skyrim]]></category>
            <category><![CDATA[elder-scrolls]]></category>
            <dc:creator><![CDATA[Tom Hay]]></dc:creator>
            <pubDate>Sun, 09 Aug 2020 20:20:01 GMT</pubDate>
            <atom:updated>2020-08-09T20:20:01.254Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Blue-green deployment: a microservices antipattern]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/blue-green-deployment-a-microservices-antipattern-30b7f0538904?source=rss-70bbc924f6b3------2"><img src="https://cdn-images-1.medium.com/max/600/1*ulxTXoy_fpa21HTMnz7Irg.jpeg" width="600"></a></p><p class="medium-feed-snippet">A key benefit of microservices is that they are independently deployable. Blue-green deployment violates this, and can mask deeper&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/swlh/blue-green-deployment-a-microservices-antipattern-30b7f0538904?source=rss-70bbc924f6b3------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/blue-green-deployment-a-microservices-antipattern-30b7f0538904?source=rss-70bbc924f6b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/30b7f0538904</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[monolith]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Tom Hay]]></dc:creator>
            <pubDate>Fri, 13 Sep 2019 22:48:43 GMT</pubDate>
            <atom:updated>2019-09-15T19:00:51.182Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Into the clouds: a software architect’s journey]]></title>
            <link>https://medium.com/@tomhay99/into-the-clouds-a-software-architects-journey-3d83301e027d?source=rss-70bbc924f6b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d83301e027d</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[payment-processing]]></category>
            <dc:creator><![CDATA[Tom Hay]]></dc:creator>
            <pubDate>Sun, 09 Dec 2018 20:37:29 GMT</pubDate>
            <atom:updated>2018-12-10T11:12:38.572Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oWIBjI7iAfp5Cvf--rUWyA.jpeg" /></figure><p>In 1991, the same year that the world wide web was born, three of us started a company. Our vision was to create a software system to drive cash machines (ATMs) and process debit and credit cards. Our unique selling point was that it would run on Open Systems, as Unix was then known. That was a big deal, because at that time all similar systems ran either on mainframes or on special fault-tolerant hardware from Tandem or Stratus, so our solution would slash the cost by running on commodity hardware.</p><p>There were good reasons why our competitors used special hardware. Think about the operating characteristics of an ATM: it has to be open 24 hours a day, 7 days a week, so it must be resilient against component failures. Customers expect to get their money quickly, so it has to be responsive at all times. At some hours of the day it will be very busy, at others it will be quiet, so it must cope with widely varying and unpredictable load. Oh, and it cannot lose a transaction under any circumstances. That’s a serious set of requirements, and conventional wisdom held that Open Systems software couldn’t hack it.</p><h4>Tuxedo: an early distributed system</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/1*kopK-aVjEeWIhlnie1VbYw.jpeg" /></figure><p>One of our secret weapons was Tuxedo, a transaction ‘monitor’ developed by Unix Systems Labs to provide high availability and extremely scalability to support applications requiring thousands of transactions per second on commonly available distributed systems.</p><p>Tuxedo offered several of the essential features of a distributed framework. The most important was the division of functionality into <strong>services</strong>. We’d previously tried to break away from monolithic development by using multiple processes communicating via IPC (inter-process communications), but services provided a more generic approach. (By the way, in those days we were coding in plain old C; the second edition of <em>The C++ Programming Language</em> had just been published, but frankly we hadn’t yet got our heads round object orientation).</p><p>We deployed multiple instances of each service to provide <strong>redundancy</strong> in case of component failure. This approach also supports <strong>scale-out</strong>, though in those days there were no virtual servers so most organizations preferred to scale-up by adding more CPUs and memory.</p><p>Another stand-out feature of Tuxedo was an <strong>externalised configuration file</strong> in which servers, services etc. were defined. This was automatically propagated to all the nodes on which the system was running. It allowed runtime parameters to be changed without recompiling and redeploying the software.</p><p>A third feature of Tuxedo that we used heavily was fielded buffers. Unlike the fixed length or separator delimited messages we were used to, fielded buffers were more like <strong>XML or JSON messages</strong>, featuring name-value pairs and a range of supported data types. They were compiled for efficiency, and there was even a domain specific language for interrogating and manipulating the contents of these messages.</p><p>As we started using the framework, it quickly became clear that synchronous calls are an anti-pattern in this type of system. They keep resources (services) tied up for too long, and an <strong>asynchronous, event-driven</strong> approach allows for much greater parallelization and hence throughput. Tuxedo included a <strong>message queue</strong> capability to support this interaction model.</p><p>Although Tuxedo included a database of sorts, we never used that, and after a disastrous attempt to use a cheap database engine, we settled on Informix. It was a good database of its type, with features like online backup, but it remained a single point of failure in an otherwise distributed system.</p><h4>Distributing the database</h4><p>Fast forward several years to the early noughties. We’d sold our company, Java had become the lingua franca, and I was working for a large inter-bank clearing house that was just making the transition from batch processing to real-time payments. It was a real paradigm shift for a development team that was used to manipulating data sets of 50 million transactions via stored procedures, to handling one payment at a time via in-memory messaging.</p><p>We came across a small company that had an innovative idea. They were using two processing nodes each with its own independent Oracle database, and had written software to perform bidirectional synchronisation between them. This was a first step towards a truly <strong>distributed database</strong>. Unfortunately the <a href="https://en.wikipedia.org/wiki/CAP_theorem">CAP theorem</a> was not widely known at that time, so we could never figure out why the results always fell short in one way or another.</p><p>Moving forward a few more years, I was seduced by Joe Armstrong’s arguments for Erlang as a foundation for “<a href="https://www.infoq.com/presentations/Systems-that-Never-Stop-Joe-Armstrong">systems that never stop</a>”. One of its lesser known features is a database called Mnesia (the opposite of <em>amnesia</em> — typical geek humour). To me it had two big attractions; first, it is designed for distribution; and second, as part of the Erlang distribution, it cost nothing. I had failed to learn the lesson that when it comes to databases, cheap does not necessarily mean good!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*PPlspEZjiJi-Uu0G3lDzbg.gif" /></figure><p>We started with Mnesia running on a single node, and functionally it behaved exactly as specified. We did some baseline performance tests, then started adding nodes to see how well it scaled out. The results were bizarre — the more nodes we added, the <em>worse </em>the performance became! With help from one of the original committers, we tracked the problem down to distributed locking. We had some heavily contended database records, and as multiple node tried to get locks on the same record, they were having to back off and wait. The more the nodes, the longer the wait — negative scalability! The only solution was to re-design the application and the data model to avoid contention and to favour node-local over distributed locks.</p><p>There is still no generic solution to the requirement for strong consistency in distributed systems, and the CAP theorem says there never can be. <a href="https://smile.amazon.co.uk/Cloud-Native-Designing-Change-Tolerant-Software/dp/1617294292/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1544339655&amp;sr=1-1&amp;keywords=1617294292">Cornelia Davis</a> comments that “some of cloud-native approaches don’t lend themselves well to use cases where strong consistency is required” and distributed databases is one of those. Most well-known cloud databases such as Cassandra and Dynamo offer eventual consistency, which is not good enough for financial transactions. Consistency can be improved via read quora and write quora, but that punishes performance.</p><p>We’ve settled for MongoDB which uses a primary instance with multiple synchronous replicas, split-brain detection, and automatic <strong>election</strong> in case of primary server failure. That means it can offer high availability, but it’s not a truly distributed database.</p><h4>Actors, messages and events</h4><p>Database aside, Erlang has some great features for real-time message processing. It’s a <strong>functional </strong>language running in a specialised Virtual Machine that’s optimised to spin up thousands of processes that communicate by message passing. It also has a <strong>fail-fast</strong> philosophy of ‘let it crash’ where each process has a supervisor that detects failure and can restart the process, or otherwise handle appropriately. These concepts are encapsulated in a pattern called gen_server, which receives messages and dispatches them to a user-provided callback function.</p><p>Despite Erlang’s great features, its development environment was frankly primitive. Developers took an atavistic delight in using vi or emacs editors instead of an IDE, and the amount of open source software available was miniscule compared with Java. We struggled with basic functionality such as parsing XML. If only there were a Java framework that offered similar functionality …</p><p>Enter Akka, a framework that explicitly <a href="https://doc.akka.io/docs/akka/current/actors.html#introduction">borrows from Erlang</a>, but which runs in the JVM. It carries across Erlang’s supervisor model, and evolves the gen_server into an <strong>actor</strong>. Actors are composed into actor systems, which form nodes in a cluster. The cluster supports <strong>locational transparency</strong> and <strong>failure detection</strong>. Akka also unifies messages and <strong>events</strong>, allowing actors to create and consume events via a <strong>pub-sub model</strong>.</p><p>Like Erlang’s gen_servers, Akka’s actors have a built-in pattern to handle state machines, which are a great way of <a href="https://blog.bernd-ruecker.com/why-service-collaboration-needs-choreography-and-orchestration-239c4f9700fa"><strong>orchestrating</strong> </a>events in a structured and easily comprehensible way — much more so than the choreography pattern that has gained popularity with the advent of microservices. Back in the days of C coding we implemented hard-coded state machines, but nowadays we model the state machines in UML and generate code from the model.</p><p>Incidentally, we leveraged these patterns to avoid the performance hit of 2-phase commit transactions. Orchestration supports the <a href="https://blog.couchbase.com/saga-pattern-implement-business-transactions-using-microservices-part-2/"><strong>saga pattern</strong></a> which we combine with <a href="https://martinfowler.com/eaaCatalog/optimisticOfflineLock.html"><strong>optimistic locking</strong></a> to protect against conflicting updates, using <a href="https://docs.microsoft.com/en-us/azure/architecture/patterns/compensating-transaction"><strong>compensating transactions</strong></a> in case things go wrong. We also used rudimentary <a href="https://martinfowler.com/eaaDev/EventSourcing.html"><strong>event sourcing</strong></a> to make compensation logic more generic.</p><h4>Logging</h4><p>Back in the days of C and Tuxedo, we wanted to log what was going on for debug purposes. We developed our own logging libraries and before too long we were generating megabytes of logs, spread across multiple servers. This made it difficult to trace the execution of a transaction which might pass through multiple servers over its lifecycle. Worse still, we discovered the hard way that Unix stderr is unbuffered, so high levels of debug had disastrous effects on performance.</p><p>Our solution was to introduce a Tuxedo logging server, and have all nodes send their log messages to that server (a single point of failure, but this was only a convenience for developers anyway). In other words, we were treating our <a href="https://www.oreilly.com/ideas/a-cloud-native-approach-to-logs"><strong>logs as event streams</strong></a>, with the server controlling how and where the logs were stored.</p><p>There still remained the problem of picking out the log messages relating to a specific transaction from among the thousands of interleaved messages from other transactions. That was when I discovered the power of Perl and as well as extracting the messages relating to a specific transaction, I also started extracting useful metrics from logs, and later used GDChart for plotting graphs of throughput, latency, error rates and so on.</p><p>All that functionality we hand-rolled is now available as open source tools: logback, Logstash, ElasticSearch and Kibana (the ELK stack).</p><h4>DevOps</h4><p>We’d got a nice continuous integration pipleline running with teams using Scrum to deliver code every two weeks. It all came unstuck when we wanted to deploy to so-called controlled environments — production, pre-prod, and system integration test. There was a dedicated deployment team who insisted on a step-by-step set of instructions in a Word document which they invariably failed to follow properly. Even though we supplied deploy scripts, they refused to use them because “they wanted to be in control”.</p><p>Worse: they also forced us to recompile the source for each different environment. They were so used to having environmental parameters hard-coded that they couldn’t grasp the idea of a system where the code remains the same, and only the config file changes across environments. My explanations that it’s madness to test one thing and then put a different thing live were met with blank incomprehension.</p><p>On my next project (still processing those real-time payments!) we got off to a much better start. There was no deployment team, and we packaged the application into Docker <strong>containers</strong> and used Ansible for scripted deployment locally or in AWS. We use Lightbend (ex-Typesafe) Config files mounted externally to the Docker containers, which directly supports import of <strong>environmental configuration</strong> variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*et-_Wk9praWNhYsA5fXSkA.png" /></figure><p>The cherry on the cake is <strong>Kubernetes</strong>, which gives us an environment-agnostic tool for managing the containers. As well as dynamic scale-out and failure restart at the actor level, we now have the same capabilities at the container level.</p><h4>Cloud native</h4><p>There are many definitions of what constitutes a ‘cloud native’ application, for example the <a href="https://12factor.net/">12 Factors</a>, and several defining characteristics have been highlighted in this article. I feel a little like Moliere’s character who is surprised to discover that “<em>for</em> <em>forty years now I’ve been speaking in prose without knowing it</em>” — I’ve been architecting applications that increasingly meet the cloud native criteria, without (until fairly recently) explicitly targeting deployment in the cloud. How can that be?</p><p>Back in 1991, card processing systems were one of the few types of application facing the wicked problem of simultaneously offering high availability, high resilience, low latency, high throughput and guaranteed integrity. Through the nineties most software was focused on batch processing and client-server systems, and in the noughties it was all about serving dynamic web pages. It’s only in this decade that large scale ‘always on’ systems requiring consistent low response times have become the rule rather than the exception, increasing the focus on developing appropriate tools and techniques.</p><p>So while I have been following a path that leads to the clouds, it feels that the clouds have also been drifting towards me. It’s now possible for newcomers to land directly at the point that’s taken me so many years to reach, but as the singer Drake said, <em>“Sometimes it’s the journey that teaches you a lot about your destination.” </em>I certainly feel that I’ve learnt a lot on the way, and I’m happy to share that knowledge with others heading for the same destination. And I’m still learning too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d83301e027d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How free payments make money for banks]]></title>
            <link>https://medium.com/@tomhay99/how-free-payments-make-money-for-banks-41c6716a5caf?source=rss-70bbc924f6b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/41c6716a5caf</guid>
            <category><![CDATA[banking]]></category>
            <category><![CDATA[payments]]></category>
            <dc:creator><![CDATA[Tom Hay]]></dc:creator>
            <pubDate>Sun, 02 Dec 2018 07:20:11 GMT</pubDate>
            <atom:updated>2018-12-02T07:20:11.249Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQCmyFiRur_k0NiarLFY0Q.jpeg" /></figure><p>In the UK (and many other countries) banks don’t charge consumers to make or receive payments. So how do banks make money from payments? A colleague of mine claims that “Banks rely on charging businesses for payments to subsidise free consumer payments”. He’s been in the payments business for many years, but in this case he’s plain wrong. Let’s see why.</p><p>For one thing, not all banks have a significant business banking footprint, so where is the supposed subsidy for their consumer payments coming from? Also, banks are not philanthropic organizations, so why would they behave like Robin Hood and take from the rich (businesses) to give to the poor (consumers)? It doesn’t make sense.</p><p>Let’s go back to the basics of why banks exist. Their primary function is to collect deposits and make loans. The interest on the loans finances the operation of the bank, and makes profits. To attract deposits, a bank has to offer security — ensure that the money will be available whenever the customer wants to withdraw it — but beyond that, there are two reasons why a customer might want to deposit their money a bank.</p><p>Reason number one is to get a return on their money. Banks offer interest-bearing savings accounts and term deposit accounts to encourage consumers of this kind to make deposits. Competition is primarily based on interest rate, and there is generally little provision for making payments from such an account, so they are not relevant in this context.</p><p>Reason number two is to conduct their day to day financial affairs. This is the objective of current accounts, hence the ease of making and receiving payments is key to the success of this type of account. The ability to pay and receive cheques used to be part of the <a href="https://en.wikipedia.org/wiki/United_Dominions_Trust_Ltd_v_Kirkwood">legal definition of a bank account</a>, which of course now extends also to electronic payments.</p><p>To put it another way: making payments is the main reason why current accounts exist. Without payments, current accounts would not attract deposits; without deposits, banks could not make loans; and without loans, they would make no profit and could not exist at all. (I have deliberately over-simplified here to make the core of the argument crystal clear).</p><p>My colleague’s mistake was caused by taking a narrow view and only looking at revenue generated by directly charging for payments. Instead, think of payments like the engine in a car; you don’t get charged separately for the engine, but you certainly wouldn’t buy the car if it didn’t have one! As well as making engines for their own vehicles, the car manufacturer may also sell engines to other companies, but that doesn’t mean those engine sales are subsidising the engines in the manufacturer’s own cars.</p><p>At the risk of stretching the analogy, every car needs an engine, but offering a better engine makes the car more attractive. That’s why banks invest in offering a better user experience for payments — it’s an important point of competitive differentiation from other current accounts. This applies to business customers as much as to consumers.</p><p><a href="https://www.mckinsey.com/industries/financial-services/our-insights/global-payments-expansive-growth-targeted-opportunities">Research by McKinsey</a> allows us to put figures on this. They report that over recent years, payments have generated roughly 30 percent of overall banking revenues, and that proportion is increasing sharply. In EMEA, payments revenue is evenly split between commerial and consumer payments. It’s clear that consumer payments do not need a subsidy from commercial payments, thank you very much!</p><p>So I have to disagree with my colleague’s conclusion that payments revenue is plummeting towards zero, and the best strategy for banks is to focus on reducing their costs of executing payments. As the old saying goes, no one ever cut their way to greatness! I would rather echo the McKinsey report’s observation that it is “imperative for financial institutions to develop and continually refresh sound payments strategies to remain competitive in a market being reshaped by technology, new competition, and customer demands.”</p><h3>Postscript</h3><p>The discussion above relates to account payments (Bacs, Faster Payments etc). The commercial model for card payments is different; issuing banks receive a per-transaction interchange fee which represents a portion of the fee charged to the merchant. In this case it’s obvious how banks make money from payments that are free to customers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41c6716a5caf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>