Are microservices just another term for service oriented architecture (SOA)? You might be forgiven for thinking so. Microservices and SOA are similar in many respects. But they’re not the same thing.
If you developed applications in the 2000s, you’re probably familiar with the SOA concept. Under the model, applications are separated into a series of distinct services. Each service is supposed to have clear boundaries and be able to run autonomously. The services usually communicate over the network.
SOA became popular as a way of breaking complex applications down into discrete parts that could be managed more easily.
In many ways, a microservices architecture is very similar. In Martin Fowler’s classic definition, a microservices application is composed of “a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.”
The goal of microservices architectures is also to simplify management by breaking a complex application into smaller pieces.
What, then, makes SOA different from microservices? If both types of architecture involve breaking large applications into smaller services, and having those services communicate via the network, how is one different from the other?
There is no official answer. Like most technology terms, the terms can mean different things to different people.
But in general, if you look at how microservices apps are deployed today and compare them, you notice the following differences:
- Microservices apps tend to involve more services. Whereas an SOA app might involve just two or three services—a storage service and a front-end service, for example—a microservices app could have dozens of services, each handling different aspects of storage, compute, networking and other functionality.
- Microservices apps are often deployed using containers. There’s no rule that says you have to use containers to deploy microservices, but containers and microservices tend to go hand in hand. The popularization of Docker over the past several years has helped drive massive interest in microservices. In contrast, SOA apps existed long before most people were thinking about or using containers.
- Microservices use complex APIs for communication. Communication between different services in an SOA app tends to use a relatively simple approach, like basic sockets. Microservices use complex APIs that permit fine-grained configuration and more rigorous security.
- Microservices usually don’t share data storage. Under the SOA model, it’s common to have a single data storage layer that is shared by all of the services in the application. Microservices apps tend instead to dedicate a database or other type of storage to each service that requires it.
You’ll notice that I’ve used the words “tend” and “usually” above. That’s because, again, there is no official definition of microservices or SOA. There is a gray area between them, and a certain amount of overlap.
In general, however, the characteristics described above are what separate them. They’re the difference between a modern microservices app that is designed to be as agile as possible and a more traditional SOA-based app.