Software Development

Microservices Tutorial for Beginners

This is a tutorial for beginners about Microservices.

1. Introduction

microservices tutorial

Dr. Peter Rogers spoke about “micro web services” at a cloud computing conference in 2005. A workshop of software architects held near Venice in May 2011 used the term “microservice” to describe a common architectural style. IBM defines microservices as an architectural approach to deploying a single application with many loosely coupled and independently deployable artifacts. In other words, Microservices architecture adapts the single-responsibility principle in the application deployment arena.

2. Monolithic Architecture

Monolithic architecture is a traditional way to deploy an application that packages all components as a single deployment.

Most desktop applications and earlier web applications are based on monolithic architecture because it’s a straightforward process to deploy at the end-user’s machine. For example, Ms. Excel, word applications, and Amazon’s earlier website.

Back in year 2000, I worked at a software company that built a software application based on monolithic architecture. Several teams worked at different parts of the same project. A dedicated team pulls the changes and builds them nightly. It becomes costly for any small change for the following reasons:

  • Testers have to test every feature for every small change to ensure that there are no negative impacts.
  • Developers have a longer learning curve for any small changes as the application is very complex.

3. Microservices Architecture

The psychologist George Armitage Miller stated “The Magic number 7 (plus or minus two) provides evidence for the capacity of short term memory. Most adults can store between 5 and 9 items in their short-term memory” in his paper “The Magical Number Seven, Plus or Minus Two”.

Business applications used to break the single deployment into a client-server architecture, 3-Tier architecture, or N-Tier architecture. But each deployment is still pretty complex. It’s a challenging task to understand a complex system and change without impacting other systems.

Amazon’s web e-commerce site was based on monolithic architecture and then converted to microservice architecture to reduce the overall cost of development starting in 2010. Please refer to this article to see how amazon adapts microservices architecture to de-couple a monolithic application into thousands of microservices.

According to Martin Fowler, there are foundational principles that microservices architecture follows. Here are common ones:

  • Single responsibility so it’s easy to update with new features
  • Domain-Driven Design
  • Encapsulation – easy to modify the implementation
  • Loose coupling
  • High availability and Easy to scale

4. Microservices Challenges

In monolithic architecture, the integration among components is in the single application. With the microservices architecture, there is no central orchestration place. Refer to the Amazon death stars. A service communicates with another service to fulfill its need which may depend on another service, and so on. The more microservices introduced, the more complex they became. There are a number of challenges due to the complexity.

  • Microservices dependencies management
  • Microservices monitoring

5. Microservices Tools

There are numerical tools that can assist microservices. Here are three main tools for the a Java developer:

  • Spring boot framework – it is an open-source Java-based framework used to create a Microservice. Please click here for a spring boot example.
  • Docker container – packages everything needed to run the application as an image, then builds containers from images. Please refer the hello world docker image example.
  • Kubernetes – it is a container-orchestration system that automates computer application deployment, scaling, and management. Please refer to this article.

6. Summary

In this example, I explained both microservices and monolithic architectures. I also compared the benefits and challenges they are facing. I also outlined three common tools to develop microservice as a Java developer.

You can also check our article: What are Microservices?

Mary Zheng

Mary has graduated from Mechanical Engineering department at ShangHai JiaoTong University. She also holds a Master degree in Computer Science from Webster University. During her studies she has been involved with a large number of projects ranging from programming and software engineering. She works as a senior Software Engineer in the telecommunications sector where she acts as a leader and works with others to design, implement, and monitor the software solution.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button