Event-Driven SOA – a misnomer

Having built a system in Event-Driven SOA fashion I’ve come to realize that the moniker applied to this style of architecture actually misses the point.

I’d argue that the focus of such an architecture shouldn’t be services. As a case might be, only some of the actors involved would actually be Services, but you’ll also have Distributors, Workers, Sagas etc. What is important distinguishing characteristic in each case is the type of message these actors are meant to handle.

Should a message be a Notification, a Command or something else?

When I had to work with FIX to implement a trading system I didn’t really appreciate how well the protocol captures the ideas of Event-Driven architecture in its message types. Now I do – well-designed messages are the primary outcome of such an architectural approach.

Event-Driven SOA – a misnomer

Arriving at Scalability – part 3

This is a part 3 of the series started in part 1 and part 2.

One of the things that becomes obvious when tackling Scalability is that calculating certain things on the fly takes too long to be practical. Another obvious thing is that the logic that deals with data needs to be executed somewhere close to the data.


By structuring the data in such a way that we can hold on to the results of the calculation we can take advantage of the cloud processing capabilities we have on the backend. We end up with copies of many things, but by partitioning the data into Aggregates we are free to modify any bits w/o any locking issues. It also opens the doors to further distribution – if you have your own copy, it doesn’t matter where you work on it. The interested parties, such as UI, will eventually become consistent all along returning a cached copy of data.

Event-Driven Services

Introducing copies of data means we need to know when to update them. By communicating via messages that represent domain events taking place, we let our services work within their narrow scope with their own copy of the data. Once they modify their little part of the domain, all they have to do is notify the parties that depend on it with particulars of what was done.

Push notifications for UI

UI becomes just another publisher and subscriber of business events, triggering the changes and minimizing the reads. The delays between a change taking place and the UI reflecting it has to be kept an eye on, but by computer standards humans are slow.  We read and write at glacial pace and while computers carry out all this eventing, processing and copying of the data, a human would barely make a click or two.


Taking a lot of data in and promising to get back with the results via asynchronous means is another thing made possible once you embrace fire-and-forget methods of communication. By looking at a batch, we can employ more intelligent strategies about resource acquisitions and aggregate the events, enabling all the parties involved to do their thing more efficiently.

Putting it all together we can take our scale-out efforts pretty far: If a particular calculation is very demanding, we can put the service carrying it out on a separate machine and it’s not going to affect anything else. This is very powerful, but eventually we’ll hit a wall again – even within a narrow scope we’ll accumulate too much data. The data we have partitioned “vertically” will have to be partitioned “horizontally”. It’s a big challenge, but also the “holy grail” of scalability and we have some ideas as to the approach and maybe one day I’ll be able to tell about it as well.

Arriving at Scalability – part 3

Arriving at Scalability – part 2

Several decisions we’ve made earlier became powerful enablers for our first pass at Scalability.


Queryable Repository

Data reads take time, reading less than everything is always a good idea. Implementing Repositories as queryable allowed us to switch to paged, ordered and generally highly selective views.


Unit of Work

Effectively building small projections for the UI from large datasets was possible due to request-scoped Unit of Work implementation, enabling underlying ORM to read data across multiple Repositories.


Aggregate Roots

Root Aggregate, defined as a cluster of associated objects treated as a unit for the purpose of data changes. By implementing Repositories one per aggregate, we isolated data affected by transactions and avoided deadlocks. With a bit of per-ID synchronization we were able to avoid optimistic concurrency exceptions as well.


Message passing

By integrating message passing early, we were able to move all the writes to backend services and avoid distributed locks in exchange for eventual consistency. Moving the backend services to another machine after this was trivial.


And that’s how by scaling out we were able to get that x100 performance gain, on the cheap. We’ll do it again a few months later by batching, denormalizing the data and embracing Event-Driven SOA.

Arriving at Scalability – part 2

Arriving at Scalability

This is going to be a series of posts exploring my revelations stemming from last couple of years designing a SaaS solution for IT organizations.

Probably like most startups, or even most new product developments we set out to deliver the features. Scalability was one of the desired quality attributes, but considering how prioritizing one attribute affects all the others, it wasn’t on top. Moreover, knowing about experiences at places like MySpace, it’s a given that we’ll end up rewriting some parts of the system with every other increase in the order of magnitude of user transactions. As our understanding of our domain and our users improves, as the usage metrics become available we’ll figure out what needs to change to get the next x10.

With this in mind, we set out to work with these priorities for the code:

  • Small and easy to maintain
  • Secure
  • RAD-supported, rich UI with dynamic query capabilities
  • Low friction data access
  • Low coupling between interacting bits

Simple. No Scalability here. Leaving aside Security, this is what it translated into:

  • Lightweight, POCO domain model with Root Aggregates
  • Unit tests and Continuous Integration
  • Silverlight with 3rd party controls and RIA services
  • An ORM and SQL Server backend
  • Message passing with guaranteed delivery

Here is where it gets interesting, with some of the patterns we used in implementation:

  • A Repository capable of carrying out dynamic queries
  • Unit of work
  • Dependency injection
  • Lightweight service bus with publisher/subscriber

At this point we’re in our second or third month of development, with the staging environment getting ready for testing on EC2. Every developer has a complete system running on their machine. We handle the entire projected load while running on a single virtual machine and we haven’t even had to make any sacrifices or do anything in terms of optimizations.

These may or may not seem impressive, but if felt good to get some stuff done and done right. All along the features are the focus and we can handle several concurrent users and hundreds of data entities.

Next I’ll talk about our first Scalability endeavour and how relatively small an effort that was for x100 gain.


Continued in Part 2

And concluded in Part 3

Arriving at Scalability

Great set of posts on selling SOA

Great set of posts on selling SOA