Global Warming …is it really?

November 1st, 2007  |  Published in General  |  2 Comments  | Add to del.icio.us

Dwight Hornbecker, the only geologist I’ve even known, had some very interesting facts about global warming. They sound kinda crazy, but I wonder if they are true. Here is what he told.

  • One volcanic eruption can contribute to global warming more than what humans can do in an year
  • The earth was actually warmer than what it is now.

Dwight went onto explain that there is evidence to support that, a few million years ago the earth was a lot more warmer than what it is today. Then came the ice age. And he maintains that we are still recovering from the ice age and earth is slowly returning back to it what it was. Not sure whom to believe. Is it Al Gore and his crew or Dwight?

All I know is that humans haven’t really figured it out yet. We think we do and try to mess around with nature, but I don’t think we are even close at guessing/figuring out the real situation.

Architecture is YOUR responsibility

October 29th, 2007  |  Published in Architecture  | Add to del.icio.us

I read this post on Steve Vinoski’s blog that quoted Ron Schmelzer of ZapThink, who makes an excellent point. “Architecture is YOUR responsibility“. Well guess what, as much as vendors would like to say it is not, the reality is that you need to make the critical decisions about the architecture. Instead of some vendor, you need to be in charge of the direction and overall vision in terms of the architecture. Instead of choosing a vendor/product and building your strategy/architecture around it, you need to think through your strategy/architecture and choose the right vendor/product that can help you achieve your vision. If anybody was lucky enough to attend a talk given by Dan Pritchett (eBay), you would have realized that companies who understood this reality and took responsibility for the architectural decisions eventually made it big.

Dan’s comments on architecture was very insightful (I want to write a separate post on what I learned from his talk at the recently concluded Colorado Software Summit). The underlying truth of everything he said, was that they understood and took responsibility for the architectural decisions they made, instead of relying on some vendor to provide direction and overall vision.

There is no vendor out there, that can provide you with some ESB that can magically transform your enterprise into a SOA platform or some messaging middleware that can help you scale your enterprise to whatever limits you want unless you know what you are doing and take ownership of the overall vision. You need to understand the overall architecture, make decisions and take responsibility for them. An ESB or a messaging middleware are merely a bunch of tools that help you get there or in other words they are just a means to an end not the end itself.

There is no framework out there that can force architectural decisions on your solutions that you are not willing to make yourself. During my REST in peace talk, there was a surprising number of folks who asked me about a framework that can help them develop RESFTful services. Guess what, the road to a RESTful approach (or for that matter any architectural style) starts with the architectural decisions you make (the way you think/design your services) and not with some framework where you have to flip a switch or use a bunch of annotations that turns your code into a RESTful service. That is precisely why the contract first approach is recommended over a code first approach when you do web services. You need to think about how you design your service first and then use some framework to generate your WSDL and your code from that, not the other way around.

We all remember how the EJB mania deceived us. Many companies paid millions of dollars to App Server vendors to solve their architectural problems. The whole notion of “you only need to think/write the business logic, and we will take care of the remoting, transactions, persistence, scalability ..etc” was just an illusion. Neither did it preclude people from making extremely stupid architectural decisions nor did it provide anymore scalability than the simple tomcat web server for most of the use cases.

You need to think carefully about the architectural decisions you make and understand the impact it has on the overall goals/vision of your enterprise. You need to be aware of operational, load, managerial and geographical scalability from day one. You cannot offset your lack of architectural vision by using some framework, product or vendor. It will only make your vendor happy, but not your customers.

Competition in open source is healthy

October 29th, 2007  |  Published in Open Source  | Add to del.icio.us

I read Sanjiva’s post on the $subject and like to add my own observations. It is true that the Apache Web Server is the statue of liberty that stands tall among all the commercial web servers out there and has no peers in open source. However that is an isolated use case. We need to think more pragmatically. The predictions are such that, most companies, in the future will have some form of involvement with Open Source. Naturally there will be some form of competition, and it is unavoidable. But the more choice (open source or otherwise) a user has the better it gets, especially if there are several open source alternatives instead of one. If there is only one open source alternative and the user ends up with a bad experience with that solution, it can color the perspective of how that company, will look at open source in general.

Competition provides choice and facilitates continuous growth and innovation in open source solutions. It drives a community to be more responsive and responsible towards it’s end users. This results in better support in the form of fixing bugs or answering questions on the list. Bcos if you are not growing or innovative or if you are not responsive or responsible towards the end users then they will look elsewhere. One could argue that there are companies that provide support. However one should not forget that these companies are built on top of the community and rely heavily on the community for it’s success. And any fixes/patches they make usually go upstream. Companies that don’t usually have problems and fade away.

Sometimes you would find that some community members are unhappy with the current direction of a project and they go ahead and form another project. The difference in direction or focus is perhaps an integral part of the evolutionary process. Some of these projects eventually create a company behind it. One could also argue that these companies fragment a community and promote competition. As long as this competition is both ethical and within the norms of standard industry practice, then the end users benefit from it. Why?? Bcos these companies will drive innovation, creativity and quality of the solutions they support, as their business model is based on it.

Therefore some form of competition that is ethical (not mud slinging or cut throat competition) is healthy for making open source a viable option in enterprise software. The process of evolution will weed out inferior solutions and ensure the survival of the fittest. However this should not be based on how much marketing muscle a project/company behind it has, but rather be based on the community aspect and technical merits.

AMQP in 10 mins : Part4 - Standard Exchange Types And Supporting Common Messaging Use Cases

October 13th, 2007  |  Published in AMQP  |  2 Comments  | Add to del.icio.us

AMQP defines four standard exchange types (routing algorithms) that covers most of the common messaging use cases. All AMQP brokers are required to support each of these exchange types and pre declare an instance of it identified by a standard name. The idea is to provide a simple out-of-the-box solution to most users. Users are free to create more instances of these exchange types with their own names. Also as mentioned in the previous post, users can create different exchange types and instances of them.

It is important to note that with any exchange type, a message can be matched with more than one queue if two or more queues are bound with the same routing criteria.

Direct Exchange
The exchange does a direct match between the routing key provided in the message and the routing criteria used when a queue is bound to this exchange.

(Click on image)

The most common use case is to bind the queue to the exchange using the queue name. However it is important to note that you could use any value for the binding.

A broker is required to provide an instance of this exchange named “amq.direct“. The Nameless Exchange is a special instance of the above exchange type where all queues are bound to this exchange automatically using the queue name as the routing criteria. This exchange instance has no public name, hence messages sent without specifying an exchange name are directed to this exchange.

Topic Exchange
The exchange does a wildcard match between the routing key and the routing pattern specified in the binding. The routing key is treated as zero or more more words, delimited by ‘.’ and supports special wildcard characters. “*” matches a single word and ‘#’ matches zero or more words.

(Click on image)

A broker is required to provide an instance of this exchange named “amq.topic“.

Fanout Exchange
Queues are bound to this exchange with no arguments. Hence any message sent to this exchange will be forwarded to all queues bound to this exchange.

(Click on image)

  • One use case, is to use exchange chaining in a tree like hierarchy that can be used to push messages to a large number of subscribers.
  • Another use case is where a direct exchange or a topic exchange can do the initial filtering which then forwards the message to a fannout exchange which will push the messages to all it’s queues.

A broker is required to provide an instance of this exchange named “amq.fanout“.

Headers Exchange
Queues are bound to this exchange with a table of arguments containing headers and values (optional). A special argument named “x-match” determines the matching algorithm, where “all” implies an AND (all pairs must match) and “any” implies OR (at least one pair must match).

(Click on image)

A broker is required to provide an instance of this exchange named “amq.match“.

How AMQP Supports Common Messaging Use Cases

The most common messaging use cases are point-to-point (or store and forward) and publisher/subscriber models. These models can be easily built on top of AMQP.

Point-to-Point
routing_key == queue_name

Pub/Sub
routing_key == topic_heirarchy_value

Next Part : Part5 - Lets look at some code - Python examples

Prev Part : Part3 - Flexible Routing Model

AMQP in 10 mins : Part3 - Flexible Routing Model

October 13th, 2007  |  Published in AMQP  | Add to del.icio.us

Background
Most pre-AMQP models had several issues with their routing models.

  • Opaque routing models that were not explicitly defined.
  • Since the semantics are not visible or explicit manipulating the routing model through the protocol was difficult.
  • Rigid monolithic routing engines that had limited or no extensibility or compose-ability.

The AMQP Routing Model
One of AMQP ’s primary goals was to define a flexible, extensible and transparent routing model where the semantics are explicitly defined. This permits the definition of management commands to manipulate the routing model. The AMQP model consists of three components

  • Exchange
  • Queue
  • Binding

AMQP defines a set of rules on how to compose these components in to processing chains. The routing model is analogues to how email works. The following diagram illustrates the routing model from a publisher and consumer’s point of view.

(Click on image)

Exchange

This is analogues to a Mail Transfer Agent. Queues (or other exchanges) are bound to an exchange using a ‘Binding’. A publisher sends a message to an exchange. The exchange will accept the message and routes it to one or more queues (or another exchange) based on the bindings. An exchange completely decouples a publisher from queues and the consumers that consumes from those queues.

An exchange type defines a routing algorithm to match the bindings with a given message. Hence an exchange type represents a class of routing algorithm. An instance of an exchange type can be thought if as an instance of a routing algorithm. A broker can have multiple instances of an exchange type which are identified by there name. An exchange instance can have the following properties.

  • Durable/Temporary
  • Auto-Delete

Queue
This is analogues to a mail box. A queue will store the messages in memory or disk and deliver them to consumers. A queue binds itself to an exchange using a ‘Binding’ which describes the criteria for the type of messages it is interested in. Queues can have the following properties,

  • Durable/Temporary
  • Shared/Private (exclusive)
  • Auto-Delete

Binding
This is analogues to a Routing Table. A binding defines the relationship between an exchange and a queue. In other words it defines the routing criteria. The most simple case is where the binding equals the queue name. A binding decouples a queue from an exchange. The same queue can be bound to any number of exchanges using the same criteria or different criteria. Different queues can be bound to the same exchange using the same routing criteria as well.

Routing Key
Is a special field (Header) present in the Message Delivery Properties. It can be thought of as a virtual address, analogues to a ‘To’ field in an email. An exchange may use this field to route a message. The standard exchange types defined in AMQP use the routing key in different ways to route messages.

Standard Exchange Types
AMQP defines several standard exchange types that are described in detail in the next blog entry.

Extending The Routing Model
One can define new exchange types with arbitrary routing criteria (routing algorithms). For example one can define an exchange that routes messages based on content (content based routing). Thus AMQP provides a standard way of extending the routing model without impacting interoperability.

Next Part : Part4 - Standard Exchange Types And Supporting Common Messaging Use Cases

Prev Part : Part2 - Achieving Interoperability And Avoiding Vendor Lock-in

AMQP in 10 mins : Part2 - Achieving Interoperability And Avoiding Vendor Lock -in

October 12th, 2007  |  Published in AMQP  | Add to del.icio.us

Background
One of the key issues with any software is non-interoperability and vendor lock in. Most messaging systems prior to AMQP did not interoperate with each other. For example messages from Tibco’s Rendezvous couldn’t be routed through IBM’s MQSeries. If two messaging systems need to be connected, there are two options.

  • Using a message bridge you could convert from one format to the other. However a bridge would be slow as the conversion adds latency. Also you would need to understand the wire format of each of those systems.
  • Replacing one system with the other, which is costly and risky. Downtime can have a severe impact on the company’s revenue model.

Therefore once a messaging system is chosen, users are reluctant to change and locked in with the same vendor while spending large sums of money as licensing costs.

What if we have messaging systems(from different vendors) that can understand each other? If so connecting two messaging systems or replacing one system with the other can be done with minimum costs and risk. Since the semantics (behaviour) are the same the chance of something going wrong is relatively low. This is a key goal for the AMQP protocol.

So what does it take to achieve interoperability and avoid vendor lock-in?

  • All brokers need to behave the same way
  • All clients need to behave the same way
  • Use a standard for commands on the wire
  • Use a language neutral type System
  • Use open standards and permit royalty free usage of such a protocol.

AMQP satisfies the above requirements by

  • Defining a network wire-level protocol
  • A defined set of messaging capabilities (The AMQP Model)
  • A simple language neutral type system
  • Using open, existing, unencumbered, widely implemented standards
  • Providing royalty free usage of the protocol

Broker semantics are defined explicitly. One can partially imply the semantics from the wire-protocol. However we need to define the semantics explicitly in order to guarantee exact behaviour in each broker/client implementation. So the protocol defines a set of commands to manipulate state in a peer. These commands are grouped by functionality into classes. For example the Queue class has various methods to manipulate state within a broker.
Ex. queueDeclare, queueBind, queuePurge, queueDelete & queueQuerry

More details on the wire protocol will be discussed later on. The next few posts will focus on discussing the semantic model.

Next Part : Part3 - Flexible Routing Model

Prev Part : Part1 - Introduction

AMQP in 10 mins : Part1 - Introduction

September 6th, 2007  |  Published in AMQP  |  2 Comments  | Add to del.icio.us

Advanced Message Queing Protocol is a an open standard with royalty free use. It has a strong focus on the financial services industry and provides the performance and reliability required by the said industry.

AMQP Working Group
The AMQP working group is responsible for defining and maintaining the sepcification. The website www.amqp.org provides details on licensing, FAQ, JIRA and a list contributors and a download page.

Version Numbering
The AMQP Version Numbering scheme consists of a major and minor revision number. Ex: 0-10.
Major versions > 0 will provide backward compatibility between minor versions. The current version of the protocol is 0-9. The AMQP WG is expected to release the 0-10 version shortly. Currently the specification is in a rapid growth stage.

Interoperability
AMQP provides complete interoperability via

  • A network wire-level protocol
  • A defined set of messaging capabilities a.k.a AMQP model

One can partially imply the semantics from the wire-protocol. However we need to define the semantics explicitly in order to guarantee exact behaviour in each broker implementation.

Reliability
The 0-10 (in-progress) version has provided functionality to ensure Guaranteed Delivery to satisfy the level of reliability required by the financial services industry. I will cover this topic in detail in a future blog post as part of the AMQP in 10 mins series.

Full Transaction Support
The 0-10 spec also provides protocol level functionality for distributed transactions. This topic will also be covered in detail in a future blog post.

Security
Security is the main focus for 0-11 version of the protocol. Currently there is only rudimentary support provided via TLS. Planned features include but not limited to partial encryption and payload signing.

Known Implementations
AMQP is platform agnostic and language neutral. Currently we have implementations from a wide variety of languages from procedural to object oriented to functional.

The Apache Qpid project has broker implementations in java and c++ and client implementations in java, c++, python, ruby and .NET.

RabbitMQ provides a broker implementation in Erlang and a client implementation in java

Open AMQ provides broker and client implementations in C.

What about JMS?
JMS can be implemented on top of AMQP. The AMQP WG is also working on standardising the AMQP-JMS mapping and is scoped for 0-11 version of the protocol. This will enable two different JMS over AMQP implementations to behave exactly the same way.
The Apache Qpid project provides an implementation of JMS over AMQP.

Next Part : Part2 - Achieving Interoperability And Avoiding Vendor Lock-in

Prev Part : Part0

AMQP in 10 mins : Part0

September 6th, 2007  |  Published in AMQP  |  1 Comment  | Add to del.icio.us

From time to time people ask me what is AMQP? and how it is different from JMS? or why do we need another standard ..etc On the other hand the AMQP spec groups is finalizing it’s work on the 0-10 version.

So I decided to write a series of blog posts titled “AMQP in 10 mins”, where each part can be read and understood in 10 mins. I hope to write a part every working day, or more depending on my mood. Comments and criticisms are equally encouraged.

Next Part, Part1 - Introduction.

Axis2 Clustering Support

August 14th, 2007  |  Published in Axis2, SOA  | Add to del.icio.us

Axis2 1.3 release has experimental clustering support enabling you to deploy your services in a cluster for Scalability, Failover support and HA. In simple terms, we provide replication for Service Context, Service Group Context and ConfigurationContext. This enables you to deploy your services in a cluster and share state. Please give it a spin and provide feedback via the mailing lists.
Please check the Axis2 Clustering Guide for a good introduction.

In Summary, here are a few points worth remembering

  • For Stateful Web Services it is recommended to deploy in pairs using the primary/secondary model. i.e Each Node will replicate to one or more backups (secondary nodes) for failover.
  • There will be only one active node at any given time. This is to avoid conflicts as we don’t have a distributed locking mechanism.
  • To achieve Scalability, you need to deploy several of these pairs. In other words your cluster will consist of multiple pairs with one active node in each - and your pairs are isolated sub groups with no replication between them.
  • If your cluster consists of more than one pair, you need to use some sort of partitioning to avoid a user being serviced by more than one pair within a given session in order to avoid potential conflicts. You could use session affinity to achieve this.
  • There is no such restriction for Stateless Web Services.
  • If your Services read shared state more frequently and update very rarely, you could experiment with more than one active node. However conflicts are still possible.

Sanjiva asked me to help over a year ago and it got postponed month after month due to other commitments until I was finally able to produce a prototype. Many thanks to Afkam Azeez, Chamikara, Snajay and Sanjiva for the support they provided. Azeez and Chamikara was primarily responsible for bringing the clustering support to it’s current state after I contributed an initial implementation. If not for those two it would have been next to impossible to get it included in the release. Special thanks to Philip Hanik for answering questions on Apache Tribes even while on vacation.

SCA vs Spring (A reply to Dan’s post)

August 5th, 2007  |  Published in SOA  | Add to del.icio.us

In Dans blog entry, he compares SCA vs Spring with an excellent example which highlights the similarities.

I do not view them as competing technologies rather complementing as I see some synergy between these technologies.

Clearly SCA and Spring share several design principles and it is no surprise that the SCA spec group views Spring as an implementation technology for components and composites. In fact the SCA spec group has gone as far as formalizing this approach with SCA Spring Component Implementation Specification

So Ke Jin’s comment on InfoQ was right on the money when he said,

“As the matter of fact, the so-called SCA assembly model is merely a DSL (domain specific language) that can easily be realized on top of Spring or any decent POJO IoC containers, with few hundreds lines of code and half day of work”

On his InfoQ comment, Dan asks?

But why wouldn’t I just use Spring to begin with?

The simple answer is that SCA could become a standard and the ability to deploy my composites in any SCA runtime. The other SCA runtime could be using Spring or the next great thing under the covers.

Mike Edwards points out on the same InfoQ thread

What the SCA Assembly model then brings to the party is a organized and standard way of describing how the different components in your (distributed) system are linked together to build a particular application.

This will only add value if and when SCA becomes a standard through OASIS and is adopted across different languages by the masses. Spring is great and I really like it. However distributed systems are not built only using java. It would be nice if we have a standard way of expressing how different components are linked together to build your application.

Also unlike the EJB’s if SCA composites can be truly portable across different runtimes (Ex Tuscany java runtime to ABC java runtime) with zero code changes it can be a very good selling point. Vendors shouldn’t spoil the party with vendor specific addons in their runtime which can lock-in unsuspecting users.

Dan asked

Someone show me where Ke Jin is wrong and where SCA expands on Spring capabilties.

Technically the capabilities are more or less the same, albeit spring being a more simple model. The standardization and portability of SCA (if achieved) is where it can exapnd or add value on top of Spring. I am not advocating to replace Spring with SCA. You can continue to use Spring to realize SCA. They are certainly complementary. This white paper explains how SCA can be used with OSGi and Spring.

P.S I conveniently ignored the complexity issue. IMHO it is a red herring.
Distributed systems are complex in nature. Thinking we can provide simple solutions is the biggest misconception.
EJB, WS-*, REST, SCA they all prove this one after the other. That’s a good topic for my next blog entry :)