NodeJS and the Distinction Between Microservices and SOA
To an enthusiastic podcast host, every RESTful call can look like a reason to write a new Node.js service.
As Yad Faeq points out, we need to avoid the hype vortices of web frameworks. Node fits into many different microservice or service oriented architectures, but poor implementation and callback hell can undermine performance.
One way to avoid hype is to define the buzzwords:
- Service-oriented architecture (SOA): an architectural pattern in computer software design in which application components provide services to other components via a communications protocol, typically over a network.
- Microservices: a software architecture style in which complex applications are composed of small, independent processes communicating with each other using language-agnostic APIs
In episodes of Software Engineering Radio, hosts and guests tease apart the differences between the two, as it is an important distinction between past (SOA) and present (microservices).
“Microservices are the kind of SOA we have been talking about for the last decade. Microservices must be independently deployable, whereas SOA services are often implemented in deployment monoliths. Classic SOA is more platform driven, so microservices offer more choices in all dimensions.”- Torsten Winterberg
If Uber were built with a SOA, their services might be:
- GetPaymentsAndDriverInformationAndMappingDataAPI
- AuthenticateUsersAndDriversAPI
If Uber were built with microservices, their APIs might be more like:
- SubmitPaymentsService
- GetDriverInfoService
- GetMappingDataService
- AuthenticateUserService
- AuthenticateDriverService
More APIs, smaller sets of responsibilities.
Node is not relevant to the delineation between SOA and microservices. If I’m mistaken about this, please let me know.
Node is relevant because:
- The single-threaded event model lets you serialize certain behaviors. Uber needed to do this when customers were requesting a driver and multiple drivers would be assigned to a single customer.
- JavaScript is the lingua franca of programming. As Atwood’s Law states, “if something can be written in JavaScript, it will be written in JavaScript”.