|
September 2007
September 29, 2007
Space-Based Architecture – scalable, but not much to do with SOA
Space-Based Architecture (or SBA for short) just might be in your future if your building large-scale distributed systems. By focusing on high-throughput and low latency, SBA joins messaging and in-memory data caching and adds a good measure of load partitioning. However, with the entire industry enamoured with SOA, what place is left for SBA?
Before going too far ahead, you might want to take a look at my previous post "Space-Based Architectural Thinking, or listen to my podcast Space-Based Architecture for the Web. There's also a 30 minute webcast online describing SBA more fully here. I'm also going to try to stay away from things concerning Jini this time after already discussing the connection between Jini and SOA, and the tradeoffs between two general approaches: Tasks and Spaces vs Message and Handlers.
OK, so the issue of state-management is a big one. Everybody wants to work stateless, because it scales. The only problem is that the business processes that we are automating are long running, meaning that there are external systems or people involved. This makes these processes inherently stateful. So, we need a way to scale statefully - SBA gives us that. For some background on the "Shared Nothing Architecture", I suggest reading this post on inter-process SOA and this one as well.
Availability also has to be handled, not only in terms of having enough servers online to handle the required load but in having all the data required to process each request be accessible. This has often been handled by the database using ACID transactions - durability being that which solved availability issues, but also hurting latency the most. The problem with saving the state of our long-running business processes/workflows in the database is the load and the responsiveness requirements. In many verticals - telcos, financial, and defense to name a few, we need millisecond level latency on each stage of the workflow. This is what leads SBA to the in-memory, replicated data grid.
Note that SBA only intends to take these workflows out of the database, and not anything else - especially not Master Data. The lifetime of these workflows is incredibly short compared to that of master data like customers and products. It will have much different backup strategies as well. In terms of load, these workflows will be heavy on reads and writes together in the same transactions, but quite low in terms of just reads. If we have workflows that perform work in parallel, we easily end up with concurrency requirements that make DBAs cringe under the barrage of short transactions.
If you're worried that Workflow Foundation (WF) won't scale because of the above, you needn't be. You can (more or less easily) replace the persistence mechanism of WF with your own, saving your workflow instances to an in-memory replicated data grid.
By enabling the objects in the grid to call back into logic on your servers, you have, in essence, done messaging and more. The added benefit that SBA receives from this is a unification of technology between caching and messaging. This translates directly to savings when it comes time to cluster each of those technology's environments.
Finally, if we can find an attribute in the incoming stream of messages that creates a nice even distribution, we can then partition our load between our servers by that key. This will work up to the point where the load per key increases beyond a single server's capacity, and then we have to look at re-partitioning, a non-trivial problem. However, if we put objects in our grid that represent the master data, and tie them to our workflow instances with both of those tied to the key of our load, a smart infrastructure can make sure all that data is already resident on the server that is handling that piece of the load. That decreases latency even more since we no longer have to pay network roundtrips to collect all the data needed before we can process it. That's a substantial advantage for the above verticals.
But all of this has nothing to do with SOA.
Sure, it'll change how we implement our Services internally, but it has no impact on their interfaces or the top-level service decomposition. In the Java community, the word "service" is often used to describe the logic of a system. Great significance is placed on keeping these "services" simple, as in Plain-Old Java Objects. The fact of the matter is that the logic of the system should be simple and independent of other concerns like data access and communcations (a la Web Services), but that does not make it a service, not in the SOA sense.
For more information on what Services in SOA are like, check out this podcast on Business and Autonomous Components in SOA. Actually, SBA will probably have the biggest impact on the way autonomous components will handle service-level agreements.
So, it appears that even with SOA, SBA has its place. The former dealing with business level agility, the latter dealing with all the technical aspects of supporting that agility. If you're tasked with the designing the architecture of a scalable, available, high-throughput, low-latency distributed system, I'd strongly advise you to look at SBA - the technical value is overwhelming. Even if you don't utilize all elements of SBA and choose the Master Worker Pattern instead of load partitioning, you'll find the technologies supporting SBA to be quite flexible in that respect.
Will Space-Based Architectures be a part of your future? I don't know for sure, but they're a most welcome part of my present.
Posted by Udi Dahan at 11:10 AM Permalink
|
September 27, 2007
Don’t let the Jini out of the bottle on SOA
I’ve been following the development of Jini for quite some time. The idea of mobile code fascinates and frightens me, especially in aspects of security, and I’m not dropping the ‘A’ word for nothing. It is an intriguing technology that I have yet to use on a real project, and now that the guys behind Jini have jumped on the SOA bandwagon I thought I’d take another look. Here’s what the www.jini.org site has to say about services in SOA:
A service may be a computation, storage, a communication channel to another user, a software filter, a hardware device, or another user. Two examples of services are printing a document and translating from one word-processor format to some other.
It appears that they are very specific in their definition of a service. A service is, most definitely, some… thing, probably having to do with computers in some way. They have another go at it here as well:
In more pedestrian terms, a Jini service is usually code running under some JVM that is capable of being called remotely, by Jini clients or even by other services.
So according to this, one example of SOA is distributed objects. And the purpose of Jini is then:
Jini systems provide mechanisms for service construction, lookup, communication, and use in a distributed system. Examples of services include: devices such as printers, displays, or disks; software such as applications or utilities; information such as databases and files; and users of the system.
In other words, hooking computer related things together without any real restrictions or guidance as to how that should be done. Is that much different from CORBA? Or any of the other generic distribution technologies we’ve seen. Granted, the mobile code thing is different, but nothing about that gets into the SOA discussion.
It also seems to fail on two out of the three dimensions of coupling. They seem to have the spatial coupling down by use of mobile code, but that’s it. In terms of technology coupling, Jini is Java-only – there are some ways to get interoperability with .net and other platforms, but it doesn’t look like Jini set out to handle it. Finally, the issue of temporal coupling isn’t considered an issue – do synchronous calls, asynchronous calls, whatever. Nothing is mentioned in terms of reliable messaging.
So, my bottom line on Jini hasn’t changed – mobile code, cool, but I still don’t know what to do with it. As for SOA, Jini seems to have as much to do with SOA as does CORBA. Maybe somebody can do something on top of Jini to make it more relevant to SOA, but as it stands now, I’ll be sticking to my buses – ESBs and such.
Posted by Udi Dahan at 07:52 PM Permalink
|
September 15, 2007
Layering - too simplistic to actually work
After seeing Mark's post on Reasons for Isolation describing the ways Layered Architectures break down, and the ways making it more testable can change it, I've got to wonder -- is Layering just too simplistic to actually work?
Just the other day I was doing a design review for a fairly simple Smart Client whose design was layered. In order to stay away from interfaces that accepted dozens of ints, strings, and dates, they wanted to have each layer talk to the other using "entities". So where are these entities defined - oh, in a "vertical layer" that all the horizontal layers talk to.
OK, so we've taken the simplistic one-dimensional layered architecture and added a dimension. What now?
Well, it seems that having the business logic and the entities in separate layers goes against one of the most basic Object Oriented principles - encapsulation. So, let's put the entities back in the Business Logic Layer. But then how will the Data Access Layer accept those objects as parameters?
So, that is solved by keeping Entity Interfaces in the "vertical" shared "layer", and having the entities in the business logic layer implement those interfaces. That way, the data access layer can still accept parameters corresponding to those interfaces:
void InsertCustomer(Shared.Entities.ICustomer customer);
So far so good. Now, we want more testable UI layer code - so we use Model-View-Controller (MVC) - of whichever flavor suits your fancy. I'd say that Supervising Controller is a must. You could also add another presenter for more complex screens as in Passive View, but I'd be less strict on that. So, in which layer do these Controllers/Presenters sit? And is the Business Logic Layer the Model? Or is the Model just part of it?
Well, our Supervising Controllers are those who decide what action to do and when, where to get the data from, etc. That sounds like business logic to me. So let's put them in the BLL. Presenters for the Passive View are much more UI centered, so let's put them in the Presentation Layer. But we don't want them tied to the implementation of the view, so we'll put them in a separate package, and have them depend only on the view's interface. So we'll put the view interfaces in a package separate from the view implementation as well.
If it wasn't clear up to this point, all the questions raised in this post are architectural in nature - as in they have a substantial impact on the structure and flow of the system, and will definitely have a profound effect on its maintainability. In other words, if you think that Layer Diagram covers your design - you're probably deluding yourself. Personally, I think that's why many developers consider architects to be "out of touch with the real world".
When you have a design that answers these, and other architectural concerns, you'll find that layering is of little importance. The specific constraints on each package are what counts. The fact that the Presentation Layer can talk to the Business Logic Layer doesn't mean that the classes in your Views Implementation Package can. A large part of an architects work is to specify these constraints, and communicate them to the team. Tools like FxCop may help in terms of enforcing these constraints, but I believe that getting the team to actually "buy-in" is more effective.
Single-dimensional layered architectures don't work. They violate Einstein's maxim:
Make everything as simple as possible, but not simpler.
Layering - "simpler" to the point of simplistic.
Posted by Udi Dahan at 08:35 AM Permalink
|
|