Sergey Nivens - Fotolia
Microservices are an emerging architectural design pattern that brings agility and scalability to enterprise applications. A challenge of implementing microservices has been the need to have infrastructure for dynamically spinning up and interconnecting these services. The dynamic nature of cloud platforms is a key enabler in the shift to a microservices strategy.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
"A cloud platform and cloud technologies are required to implement microservices," noted Chris Haddad, vice president of technology evangelism at open source software company WSO2 and former Gartner analyst. "Without a cloud platform and cloud frameworks, the organization ends up with a fairly static environment."
Cloud platforms that support the move to microservices include Netflix projects like Hystrix and Eureka, and Apache Stratos. For example, Apache Stratos makes it possible to compose business services together and use a policy-based approach to defining how the dependent services will scale.
Time to take advantage of the cloud's dynamic nature
Microservices are based on the ability to spin up the business services in distinct containers and intelligently route from one container or endpoint to another. This means that having a cloud-service fabric is important in order to stand up microservices instances and have them connect and reliably offer the quality of service expected.
Enterprise IT solutions in general are fairly static. Applications are sized based on a 50% load. The application is provisioned by spinning up the number of instances that will handle the expected load.
"Even now," Haddad said, "five years after the cloud has gained mainstream awareness, enterprise customers are sizing systems for a static load rather than being dynamically scalable."
The dynamic nature of the cloud allows a new mindset that microservices embody. Cloud infrastructure lets IT turn on and off multiple instances while allowing the application to continue to run when parts break or are overloaded.
Rethink the system of record
The microservices approach looks at how a set of business domain capabilities touched by the system of record can be extended through services that can be called for a specific application. This also presents the opportunity to think about the system of record in new ways.
In traditional monolithic application development, the main application interacts with a primary system of record. What is unique about the microservices approach is it can scale out the system of record across a distributed topology to increase availability and resiliency. But these business services need to be implemented in a way that balances performance so that it can tolerate some level of inconsistency or eventual consistency.
The key difference with splitting the system of record into multiple microservices is that they must share some bits of information, but each likely has its own distinct copies or parts that they are authoritative on. Chris Moyer, vice president of technology at Newstex, an intelligent content aggregation service, said, "You'll need to make sure you have a good way to handle discrepancies between systems, and [you should] note which service is authoritative on which bit of information."
The idea of microservices basically means that no one service will solve all problems. Instead of making one silver bullet service that handles everything, IT splits architecture into multiple components. Moyers explained, "By separating all of the individual components you make sure that you are more fault tolerant, but you also open yourself up for partial-system issues. That means that if one service (like Active Directory) goes down, your entire system isn't down, but it enters a degraded state."
Addressing the complexity of identity and access management
One of the challenges with microservices compared with classic service-oriented architecture (SOA) lies in the complexity of orchestrating identity and access management in harmony with the dynamic nature of microservices components. With new services being spun up dynamically, the host names for the instances of each service become dynamic as well.
Chris Moyervice president of technology, Newstex
In addition, the applications are establishing multiple service calls across the entire solution. In the past, it was sufficient to authenticate the user or the machine. Microservices adds a new requirement: being able to authenticate the microservices container, which is more challenging because of the need to embed identity within a dynamically created service container.
API management systems can help ensure features like open authorization and analytics are implemented, said Apigee Vice President of Product Strategy, Ed Anuff. Apigee is an API management and analytics platform for developers. There becomes a need to harden some of those to be safer for external consumption (e.g., a mobile client).
In other cases organizations might use API management to make microservices available as a SOA service. "API management solutions can make it easier to build dynamic facades on top for the APIs, to make my microservices usable by other groups," said Anuff. In essence, the API management tools can help bridge the gap between microservices and more enterprise-grade SOA architectures.
Cache is key
Another challenge in implementing microservices lies in addressing the communication bottlenecks that can arise across smaller services. Developers will find that the latency for responding to requests can be higher than when making calls to application components on just one system.
Moyer said that the network overhead used for interconnecting can create delays. To address this bottleneck, he recommends intelligently caching frequently used data with microservices. He explained,
"Just like you don't want to query your MySQL database for the user account every time that user makes any single request, you don't want to query a microservice every time you need something from it that you use repeatedly."
Ease into microservices
The microservices philosophy is more about augmenting existing enterprise integration infrastructure than ripping and replacing. "Whenever you rip and replace something, you lose a bunch of good features," said WSO2's Haddad. Initially, organizations will use microservices for new green field projects or to create next generation systems. They will be looking at factoring out their applications differently and applying microservices principles.
The best way to approach microservices is from the user experience on down, said Haddad. One goal of microservices is to gracefully degrade the user experience when failures occur on the back end. The benefit of microservices is the ability to rapidly compose user experiences from discrete atomic units.
Microservices are an ideal approach for a mobile application project or for reaching out to partners and promoting the use of the microservices framework for integrating into business capabilities. A microservices framework that separates the different user-experience components is ideal for these scenarios. For example, business components like a shopping cart, product catalog, ordering and recommendation components are easy to understand as components that are autonomous and separate.
Mind shift required
This approach requires a mind shift in thinking about services in business domain categories such as between products, inventory, shopping cart and ordering that can be loosely coupled and separate from each other. The microservices approach is to have each of the top-level, user-visible business entities separate from the user interface and the database.
There are more challenges around security, configuration management and operations management that can inhibit microservices benefits. It is important to have cloud platforms, which many organizations are now just getting on board with in terms of strategy and implementation. It will be a slow adoption path. "What we really need to understand are the decision frameworks required to apply microservices principles correctly," said Haddad.
Software architecture moves from ESBs to microservices
What are microservices, and how do they relate to SOA?
Improving performance of cloud microservices