Archive for February, 2007

“Make as much stateless as possible” is the mantra but I wonder if we’re being a little over-zealous in our application? Consider this note in Fielding’s REST thesis:

“Like most architectural choices, the stateless constraint reflects a design trade-off. The disadvantage is that it may decrease network performance by increasing the repetitive data (per-interaction overhead) sent in a series of requests, since that data cannot be left on the server in a shared context. In addition, placing the application state on the client-side reduces the server’s control over consistent application behavior, since the application becomes dependent on the correct implementation of semantics across multiple client versions.”

Thus while statelessness is often claimed to achieve scalability, in certain applications that may not be the case due to the resultant load on the network.

Our pursuit of statelessness leads us to behaviours such as making a single entity responsible for the maintenance of all state. Often it’s a database that becomes a black hole sucking up hardware, network bandwidth, admin time and endless tuning effort. It also becomes the focus of our reliability concerns, with a need for clustering, RAID arrays etc. Stand around long enough and you’ll hear terrified utterings from staff such as “if we ever lose the database….”

Making some single thing responsible for all these aspects of our system is asking for trouble. Having all these heavyweight concerns squeezing down on a single element ultimately leads to breakage.

History shows that we aren’t entirely happy with this “single point of responsibility for all state”. We have cookies in browsers, local storage in browsers, thin clients that rely on servers to store all state and so on.

Perhaps we’re ignoring an underlying message: Maintenance of state is a shared responsibility for a system. We should seek to place that responsibility in appropriate places at appropriate times and be much more aware of responsibility boundaries and when it’s appropriate, share that responsibility amongst components.

Generally we consider TCP to be responsible for ensuring that state makes it to the other end of the connection. One hands some data to the TCP layer and we expect that it will ensure the data reaches the recipient. But is this true? What happens if we suffer a power outage before TCP transmits the data? When the machine restarts, is TCP going to restart and resend all that unsent data? Clearly not, whoever delegated responsibility to TCP for this data will now need to take steps to recover the situation.

What about a message queue? Typically we place some data in the queue and demand that it absolutely must deliver that message and not lose it in the meantime. That’s an awful lot of responsibility for a single component to carry! As an aside we’re also potentially making that queue a performance bottleneck of the future.

Then there’s the Web which in many cases puts responsibility on the client for maintenance of state. This is achieved through retries, restoring backups, re-entering details etc. Notably, this is the case even if the client “fails” e.g. your home router goes down or the PC overheats. There’s a certain amount of illusion here too where we believe the responsibility for state maintenance has been placed elsewhere e.g. Flickr. Ideally they don’t want to lose all your precious pictures but if they do, who will have to restore all that information?

I think it’s interesting that placing such responsibility with some single entity is perceived as the easy solution but it has a lot of hidden costs like redundant hardware, clustering, strict data-centre environment control, backups etc.

Spreading responsibility might ultimately be easier and fit with our desire for utility computing but it’s not commonplace and thus we’re lacking well documented patterns, software components etc. We are seeing some examples however, I would speculate that S3’s API is the way it is precisely because it relies on spreading responsibility for state across a co-operative shared-nothing system rather than placing it all in a single shared-everything cluster.

Technorati Tags: , , , ,

  • Share/Bookmark

Comments 1 Comment »

The “what is a JavaSpace debate” rages on………….

Fundamentally, I don’t see this as being an exercise in pragmatists vs purists. It’s a difference in engineering philosophy/taste. Personally, I see a JavaSpace as well, errr, a JavaSpace. There are lots of things you can do with it:

  • Co-ordination mechanisms
  • Systems of co-operating entities for e.g. locking, queues etc
  • Compute Servers
  • Messaging
  • Caching

Note that all of these things can be built on top of JavaSpaces. This leads to two different schools of thought:

  1. Make all these different things a part of a JavaSpaces implementation
  2. Make all these things layered frameworks that live on top of JavaSpaces

Arguments for the first option are often on the basis of improving performance or “making JavaSpaces more useful”. But JavaSpaces is already useful, acting as good simple underpinnings for all these different things.

And this is why I personally prefer the second option. I’m a minimalist, I like my JavaSpaces nice and simple and I like being able to construct cleanly layered frameworks on top of JavaSpaces. This allows me to have nicely separated responsibilities at each layer leading to (IMHO) better, more understandable, more maintainable design in my systems. I also like to avoid building such layers on top of JavaSpaces if there’s something out there already that can do the job better in a specific scenario.

[ Yep, read that paragraph again and realize that I am both pragmatist and purist. How annoying that I cannot be easily pigeon-holed as one or the other! ]

There’s no accounting for taste but let’s be clear that it has nothing to do with being pragmatic or purist. It seems like Cameron also has a taste for minimalism……

Technorati Tags: , ,

  • Share/Bookmark

Comments Comments Off

Hot news is the proposal for a REST API in Java. Equally interesting is that various members of the community are asking for a simple API with none of the usual cruft.

I’m left wondering if such an approach will just leave you with all the existing http libraries and web infrastructure (servers, caches and proxies) such as Apache’s HttpClient.

It might be that the real core of doing better REST is in tools for converting from REST-based designs into code and infrastructure rather than an API per se. Could be time to go look at what DHH and Rails have been doing in this area???

Technorati Tags: , ,

  • Share/Bookmark

Comments 3 Comments »

This is interesting:

W3C members have issues surrounding enterprise computing. Not just distributed computing, but the typical concerns around transactions, scalability, high availability, and so on. Not only that they’re also dealing with 15, 20, and 25 year old technology that works just fine but is getting more and more difficult to maintain and doesn’t play well with others. Finally, there’s the issue of interconnecting these systems to each other, to partners, and to the Web.

Once 15+ year old technology is getting difficult to maintain and doesn’t play nice with others, surely it’s time to considering throwing it out? Surely keeping it just forces all the new stuff we do to get bogged down and stifled supporting the old stuff?

I’m just wondering if the logical destination for this will be we can’t make progress any more because we get completely bogged down in our legacy? I certainly appreciate the companies holding on to so much legacy consider it important that the issue is tackled but should the rest of the world which is perhaps more flexible have to care? Should we constantly be bending all the good new stuff we do to cope with all this old crud?

If you buy a car there’s a limit to it’s useful life. You can keep running it after that but maintenance bills get higher and higher to the point where one gives up and just buys a new car because it’s cheaper.

Note also that the owner of this “legacy” car is the one suffering the high maintenance cost, not the manufacturer or the mechanic. Admittedly, the mechanic and the manufacturer must hold onto tools and parts but they can at a point of their choosing drop support. Should it not also be the case that companies holding onto legacy systems suffer similar high maintenance costs? Should these companies be able to displace those costs onto others in the form of horrendous complexity and endless legacy considerations in new products, specs etc?

Clearly there is no right answer for this dilemma but it might be time for us all to sit down and consider the whole cost of holding onto legacy which goes way beyond the simple increasing cost of maintenance.

If nothing else it strikes me as interesting that whilst IT pursues the concept of endless life for systems, nature provides many examples of limited lifespan as a useful tool for progress and sustainability.

Technorati Tags: ,

  • Share/Bookmark

Comments Comments Off

Blowing some cobwebs out of my life at the moment. More news on that soon but for starters I’m gonna be posting some more “human” stuff here alongside the usual tech.

To wit, I’m not generally a fan of anything Sophie Ellis-Bextor turns out but I heard Catch You a couple of weeks ago and felt it worth hitting the iTunes buy button for this morning. Punchy, fast-paced and suits Sophie’s voice well. Co-written by Cathy Dennis (Can’t Get You Out Of My Head and Toxic).

Likely to be making an appearance on my next back-road blast in the BMW…..

Technorati Tags:

  • Share/Bookmark

Comments Comments Off