What are Microservices?
The term "microservices" refers to a delivery model for software applications that divides an application into smaller, self-contained components. Each component can be independently deployed, scaled, and updated. This helps to improve application functionality and reliability. It also enables developers to more easily create and maintain software applications.
Microservices are a key part of modern application delivery. From social networking apps to online retail to streaming video, almost every major software application today is built using microservices. But what are they? And how exactly do they improve software? In this post, we'll examine their real-world benefits and also discuss the potential disadvantages of using microservices.
What is a services oriented architecture (SOA)?
A service oriented architecture (SOA) is the evolution of a monolithic architecture when it comes to application development. SOAs precede microservices architectures and separate the application into smaller, more manageable pieces. These pieces are called services and they are designed to communicate with each other using messages. Services are also designed to be independent of each other so that they can be replaced or upgraded without affecting the rest of the application.
SOAs are often used in web-based applications where they provide a way to separate business logic from presentation logic and data access from data storage.
A service oriented architecture can be used to build applications that are easier to maintain and scale. It also helps in creating more modular and flexible applications.
The main benefits of using a service oriented architecture are:
- Easier maintenance and scaling
- More modular and flexible applications
- Reduced development time
What is an enterprise service bus?
An enterprise service bus (ESB) is a software application that provides a central point for inter-process communication. It is often used in the context of SOA to provide services to other applications.
The ESB allows an organization to build, deploy and manage service-oriented architecture (SOA) solutions with ease. It manages, monitors and coordinates all the services in an organization's IT infrastructure.
This type of technology is gaining popularity as it can be used for internal as well as external communication. Some examples of use cases are:
- Data integration
- Service discovery and registration
- Service orchestration
- Event notification and logging
Microservices architecture vs SOA
Microservices architectures are the new kid on the block when it comes to application development. Though very similar to SOA, a microservices architecture was created to fill in the gaps left by its predecessor. Not to make one sound inferior to the other, it really boils down to use case. SOAs were designed to meet the needs of enterprises, which means that despite the services being separate, the system was designed to be interdependent. The idea is to be able to reuse services for other parts of the business.
Microservices on the other hand, are truly independent. A microservices architecture pursues data duplication versus data sharing so there is no impact to performance. Microservices also eliminate the need for an enterprise service bus.
What are the benefits of using microservices?
The rise of SaaS apps and the widespread adoption of containers have created a growing demand for more efficient development methods. In response, applications themselves are changing. From monoliths that do many things well, to distributed collections of independent services that address specific functions. In fact, a recent study by RightScale found that the majority of modern applications are using a microservices architecture.
Some major benefits that microservices offer include:
Each microservice performs a single logical function within the greater application. For this reason, developers provide updates that are isolated to just the service that needs the changes. Typically there is a well defined interface between microservices within an application. And as long as that remains intact, the application can remain functional even as changes are being made-real.
Reduced development time
Individual services provide a well-defined set of functionality for each component that can be built around specific requirements. This makes it simple to horizontally scale development efforts across multiple team. And it makes it easier to quickly update or add new features.
Increased application functionality
As development teams are able to create individual components that can be reused in multiple contexts. They can create new applications that accommodate a broader array of users and deliver deeper functionality without duplicating efforts.
Loosely coupled resources
The architectural style is such that each microservice can serve multiple applications and interfaces. This reduces the amount of custom implementations for developers. The independent design also means that changes to one microservice won't impact another. However, this also means that load balancing is required to manage requests, both on the client and server-sides.
Ultimately, microservices enable developers to focus on the specific functionality of their applications. They also enable developers to avoid development issues that can arise from coupling multiple applications together. By breaking down an application into manageable pieces, developers can take advantage of new software development techniques. Techniques like automated testing to deliver high quality results more quickly than ever before.
Microservices are also easier to maintain because the associated services are self-contained. All dependent services run on their own platform with separate management tools, providing more consistency. It also makes managing the entire collection of related components easier than if they were embedded in a larger monolithic application.
What are the disadvantages of using microservices?
When developing enterprise applications, pursuing a microservice architecture is clearly superior than a monolithic architecture. But if we're being honest, this doesn't come without potential problems. There are some notable disadvantages to using microservices.
Defining microservices boundaries
If documentation and requirements are not well defined, it can be difficult to manage service dependencies and the overall application functionality. However, design patterns, also referred to as or architecture patterns, are reusable solutions that can be used to bypass common issues.
Security can also be a potential drawback with microservices. Each service is deployed independently and often has its own set of security controls. Consequently, it's not always clear who has access to which component and the potential for malicious activity increases as a result.
Calls between microservices are often API based, and as a result are made via network transport. The way these services communicate could potentially expose sensitive information to attackers. Developers have to use care when choosing the platforms and frameworks they will use to deploy their microservices. This also includes the configurations that will be used to secure them.
Complexity and difficulty to maintain code
The most significant disadvantage is that they are difficult to scale and maintain. This is because each service needs to be managed separately and independently from the other services in the system.
Errors can be hard to fix
Given the granular and distributed nature of microservices, remediating errors can be tough. Unlike a services oriented or monolithic architecture, adjustments to one area of a microservices architecture does not effect the rest. Which means your staff will be spending more time identifying and troubleshooting issues.
What are the different deployment options for microservices?
There are a number of different deployment options for microservices. Typically, developers choose to deploy their microservice as a container-based service on a dedicated host. Or they may choose to use a Platform-as-a-Service (PaaS) provider such as Amazon AWS.
Using a PaaS provider offers a number of cloud native benefits. Notably the ability to easily scale services and removing the need to maintain the host. However, developers need to consider the risks that are associated with relying on an external cloud service provider. This option carries more risk than deploying their own infrastructure.
What are the tools needed to develop and deploy microservices?
Developers need to have a number of development tools and environments in order to develop and deploy microservices. They need a development environment (IDE) for creating the service logic and writing the code. A containerization workflow is also necessary. This enables the microservice to be packaged in a way that can be deployed to the host server.
Developers also need a development environment for testing the service and verifying that it meets user requirements. Developers may opt to use continuous integration tools such as Jenkins to execute automated tests.
How to secure microservices
Developers should use encrypted transport (HTTPS) to ensure that all data is securely transmitted between endpoints. Applications should also be run behind firewalls to prevent the services and data from being accessed by unauthorized users. Finally, logging mechanisms should be put in place so any suspicious activity can be tracked. The ability to investigate logs in the event that a breach occurs is critical.
But that's just the first step. Beyond securing microservices themselves, it's also important to secure the communication between microservices. APIs enable microservices to talk to each other. APIs also play a critical role in the communication between Microservices and your backend services.
Noname Security is the only API security vendor to provide end-to-end security from code to production. Whether you need to test your APIs for vulnerabilities, inventory your API footprint, or block attacks in real-time, Noname Security has you covered. You can learn more about our platform here.