InfoQ

Interview

Eric Evans Interviews Greg Young on the Architecture of a Large Transaction System

Interview with Gregory Young by Eric Evans on Jun 24, 2008 08:10 PM

Community
Architecture
Topics
Tags
Transactions ,
Repository ,
Domain Driven Design
Summary
Eric Evans, the author of Domain Driven Design, interviews Greg Young about the architecture implemented for a system processing tens of thousands of transactions per second. It's not just the sheer number of transactions that is challenging, but the time constraints imposed are those specific to real-time systems. Greg reveals some of the architecture elements of the system's design.

Bio
Greg Young is co-founder and CTO of IMIS, a stock market analytics firm in Vancouver BC. With over 10 years of varied experience in computer science from embedded operating systems to business systems and everything in between, he brings a pragmatic and often times unusual viewpoint to discussions.
Hi, I am Eric Evans and I am here with Greg Young who has been doing some very interesting work involving applying Domain Driven Design on an application that has very large transaction binds. So I wanted to know more about what they did and what it led to. Greg can give us a quick summary of what you did and the problems you encountered with the solutions?
Most people think of a repository as this set of abstraction of a collection and objects live there. We go there and ask for an object, we have object state change and the repository puts the new state in. But you found that you had to do it a different way.
So the repository is still responsible for knowing what to do with the state changes.
You've mentioned that these objects can give you their state changes, since they were initialized. Can you tell us the scenario sort of what are some of these state changes?
So every time the best bid goes up you have a best bid increase?
Tell us then the sort of life cycle of an order.
Now at some point all the volume has been removed from an order and then what happens?
Basically your messages, coming from a bounded context, and being kind of transformed by an anticorruption layer and then picked up by some process in another context, which either subscribes to that message or perhaps is the receiving end of a pipeline.
In your case the requirements and the nature of the domain actually makes these delta based objects. Those are actually central concepts. It isn't just like "Ok I had an order and it was for 1000 shares and now it's just for 500 shares." The fact that I executed a trade and that caused a 500 share reduction is an important concept in its own right that you are making explicit.
So I can see how this is clarifying in the model itself and it might have potentially evolved as a domain model without the constraint of the high volume. But tell me something about the implications for this on your ability to scale.
It's is clear that you want a different representation of this data, a different model, than you would in the actual transaction processing.
Basically the message goes out transformed by the anti corruption or by some translator and then goes on through the pipeline.
In the bounded context within where your core is or within the receiving?
That's kind of an example of the analysis and reporting where you use the pipeline. What's an example where you use the publish-subscribe?
Since you mentioned partitioning, what governs the partitioning; you don't replicate all your data on every server.
So there a several symbols related to the Nortel company and you keep all the Nortel symbols together.
Now, this is a pretty interesting example of where the ability to partition across different servers, the understanding of the domain is critical, and the fact that you have modeled these things in ways that allow you to take a company, to know that you can safely take everything of one company and separate from another company's is basically domain knowledge.
Yeah I have seen this. Aggregate boundaries seem to cover several different issues. The one that is talked about in the book most is the transaction boundaries and determining what has to be synchronously kept in sync according to the rules. They make good boundaries for partitioning and distribution.
Since you are actually tracking state change rather than the state primarily, do you look at the state change of the whole aggregate, all these little messages?
Because you say "I want all these state changes from this aggregate", and therefore you are going to deal in that transaction with all the state changes from that record.
If you were going to give people a couple of takeaways of what you have learned from this, what would the critical insights that allowed this scaling to tens of thousands of transactions per second, distribution over many servers, etc. But what are some of its takeaways?
You mean that the subsystem that handles the actual trading is a few seconds ahead of the reporting system.
The things that allowed you to do this were first of all that you represented state changes explicitly and sent those messages across as opposed to reporting of the current state, you report of a stream of changes to state and that you allow these processes to run asynchronously by feeding this message queue from one side and picking it up from the other side.
The other thing I am hearing is that you have one component there which has the most critical need to be up to date, which is the actual transactional processing. This is the part which says "These are the orders, the trades come in and now the orders are adjusted accordingly". That part has to be as close to real time as possible, you probably have some parameters for this. Can you give us a feeling as how far behind can you be on that?
Generally less than 20 milliseconds. Oh, great! That was really interesting, thanks, and I look forward to hearing more about where this leads, and I think that a lot of people can use some of these ideas. This is the first time that I have been an interviewer instead of an interviewee
show all  show all

2 comments

Reply

Domain and Architecture by John Donaldson Posted Jul 3, 2008 8:26 AM
Congratulations! by Rafael Peixoto de Azevedo Posted Aug 8, 2008 6:46 AM
  1. Back to top

    Domain and Architecture

    Jul 3, 2008 8:26 AM by John Donaldson

    Well, very interesting - normal developers don't often get to work on such extreme systems. I would have appreciated a couple of diagrams, and occasionally the dmain knowledge (well, lack of it on my part) got in the way of understanding the application architecture. Lots of follow on questions!

  2. Back to top

    Congratulations!

    Aug 8, 2008 6:46 AM by Rafael Peixoto de Azevedo

    No need for forgiveness!
    I actually deeply thank you both.
    <p>
    The reported experience is very rich. The design solutions to address such challenges of speed, reliability and complexity are certainly useful in other design situations.
    <p>
    I am looking forward to learn more about this excellently done work.</p></p>

Educational Content

JRuby: The Pain of Bringing an Off-Platform Dynamic Language to the JVM

Charles Nutter discusses bringing JRuby to the JVM, why Ruby is hard to implement, JIT compilation, precompilation, core Ruby implementation, Java library access, library challenges and future plans.

Performance Anti-Patterns in Database-Driven Applications

Alois Reitbauer specifies several architectural anti-patterns that one should stay away from and which can downgrade an application’s performance.

Making TDD Stick: Problems and Solutions for Adopters

Teams in large organizations still struggle to adopt TDD. In this article Mark Levison shares problems he uncovered when he surveyed teams, and his own strategy to introduce TDD into an organization.

Testing is Overrated

In this talk from RubyFringe, Luke Francl asks: is developer-driven testing really the best way to find software defects? Or is the emphasis on testing and test coverage barking up the wrong tree?

VM Optimizations for Language Designers

John Pampuch discusses the HotSpot compiler, the history of Java performance, HotSpot development philosophies and challenges, optimization, JVM library improvements, and tips for better performance.

Keith Braithwaite, an Agile Skeptic

In this interview, Keith Braithwaite, an Agile developer, consultant and trainer, says that we should show a good deal of skepticism towards today’s Agile practice.

Workflow Orchestration Using Spring AOP and AspectJ

This article demonstrates how to build and orchestrate highly configurable and extensible yet light-weight embedded process flow using AOP techniques with Spring AOP and Aspect J.

Embrace Uncertainty

Jeff Patton explains why one needs to embrace uncertainty in order to succeed with his/her Agile project and how to avoid some of the common mistakes leading to project failure.