A Beginner’s Guide to Microservice Architecture

Zoe Lavena
SW|D
Published in
3 min readJan 23, 2019

Definition

Microservice architecture structures an application as a set of loosely-coupled collaborating services.

Example

We are going to use SpongeBob as our software application. SpongeBob lives in Bikini Bottom and grills patties for a living. SpongeBob provides a service to the customers of Krusty Krab by grilling the juiciest Krabby Patty.

Sponge Bob the Software Application

If we program SpongeBob to provide more services than grilling a patty, our application will expand. As a result, it will be challenging to handle.

Sponge Bob doing more than one service

One way to manage SpongeBob is to apply the idea of Microservice. With reference to the definition “set of loosely-coupled services” and “composition of services,” we have to dice SpongeBob into cubes and divide the services that he can provide.

Sponge Bob Microservice Application

One of the advantages of using microservice is the flexibility when changing or updating codes. In a monolithic architecture, we have to shut down the entire application in order to make some changes. In a microservice architecture, only the service that needs to be changed or updated has to be shut down.

In our SpongeBob Application, if our vacuum (refer to illustration above) needs some upgrade, only that service will be inaccessible. Patrick the Star can still access 3 out of 4 services that SpongeBob provides.

Benefits

The microservice architecture has the following benefits:

  1. It enables the continuous delivery and deployment of large, complex applications. Because each service in a microservice architecture is relatively small, automated tests are much easier to write and faster to execute, easier to deploy changes, and development velocity is much higher.
  2. Services are small and easily maintained. The code is easier for a developer to understand, and starts faster than a large monolith which makes developers more productive and speeds up deployments.
  3. Services are independently scalable. Each services are scaled independently of other services, and can be deployed on hardware that’s best suited to its resource requirements.
  4. It has better fault isolation. Unlike microservices, one misbehaving component of a monolithic architecture will bring down the entire system.
  5. It allows easy experimenting and adoption of new technologies. When developing a new service, the developers are free to pick whatever language and frameworks are best suited for that service.

Challenges

No technology is a silver bullet, and the microservice architecture has a number of significant drawback and issues.

  1. Finding the right service is challenging. Microservice architecture has no concrete and well-defined algorithm for decomposing a system into services.
  2. Distributed systems are complex. Developers deals with additional complexity of creating a distributed system. Services must use an interprocess communication mechanism.
  3. Deployment needs careful coordination. Deploying services requires careful coordination between the various development teams.
  4. Deciding when to adopt is difficult. Another issue with using the microservice architecture is deciding at what point during the lifecycle of the application you should use this architecture.

Conclusion

Microservice architecture is a composition of services. It handles complex applications gracefully and allows flexibility in the software application. The monolithic architecture is a good choice for simple applications, but microservice architecture is usually a better choice for large, complex applications. It accelerates the velocity of software development by enabling small, autonomous teams to work in parallel. Microservices is not a silver bullet — there are significant drawbacks, including complexity. This type of software architecture answers most of the issues of a monolithic application which will be discussed in a greater detail on my next blog “Microservices: Understanding the Background of Microservice Architecture.”

References

Richardson, Chris. Microservices Patterns with Examples in Java. 2019.

You can get a copy of this book at Indigo online, or by clicking this link: https://www.chapters.indigo.ca/en-ca/books/microservices-patterns-with-examples-in/9781617294549-item.html?ikwid=microservices&ikwsec=Home&ikwidx=2

--

--