--

Building Micro-servies — Part 1

Brief Introduction

Micro-services architecture is the new wave in building scale-able, manageable, independently deploy-able, isolated and maintainable web services.
Micro-services has created enough hoopla in tech world rightly so due to the advantages it brings in. With the stunning advancements in the cloud infrastructure building micro services has become very easy. In fact cloud infrastructure has some synergies with micro-services architecture.
Micro-services can be built using simple physical servers to complex containers managed by Kubernetes. However, not every massive enterprise application needs to be built using containers nor every medium to small sized enterprise application needs to be built using it. Depending on various trade-offs such as cost, shelf life, strategic direction enterprises can choose various infrastructural elements suited for their applications (I have to admit this is where most organizations get it wrong - they either over-choose or under-choose infrastructure)

Major Components

Almost every micro-service based application I've encountered has certain aspects to handle. I will try to be as much comprehensive as I can (I cannot guarantee though due to ever-changing technology changes in terms of new componentry being added)

  • Independent development of micro-services
  • Scale-able infrastructure
  • Continuous Integration/delivery/deployment
  • Continuous monitoring
  • Independent development of micro-services

The fundamental idea behind micro-services architecture is to divide all aspects of SDLC (well most of it if not all) so that the otherwise monolithic architecture is broken down into fine grained (not too fine though) services bringing agility into the development.
A typical Agile team consists of 5-8 developers. Depending on how big the application to be built is, agile teams can be aligned to the micro-services for independent development. This makes the development more manageable.

Scale-able infrastructure

One of the driving forces behind micro-services architecture is to scale each service independently either vertically or horizontally or both.
A typical infrastructure used to build micro-services is a Platform-as-a-Service (PaaS) cloud. Every major cloud vendor today offers some kind of PaaS infrastructure. Cloud Foundry is one such PaaS cloud. There are others from Amazon, Microsoft, Google and many others.
PaaS clouds provide both vertically (increasing RAM or resources on an server instance) or horizontally (increasing the number of server instances).

Continuous Integration/Delivery/Deployment

This is one of the most important aspects (and which is often ignored) of building micro-services. The reason for this is that once micro-services development starts often integration between these independent services becomes important and without automated CI/CD pipelines it would be a gigantic task to develop, test and build these services.
Jenkins is the most common tool used to build the CI/CD pipelines today. The pipelines automate tasks such as running unit tests, generating code coverage metrics, building artifacts, deploying onto DEV/TEST environments, running sanity tests, sending build notifications etc.,

Continuous Monitoring

We can't certify an application to be enterprise-y if there is no monitoring for that. Given that there are going to be numerous different services for a decently large application, appropriate monitoring should be in place to enable SRE/DevOps teams to alert and identify problems.
Monitoring should be enabled at various levels.

Service-level monitoring: Monitoring whether the service is up and running. For example by exposing a health check endpoint which gives nothing but a 200 HTTP response.

Dependency-level monitoring: Monitoring the external dependencies of a service. Netflix, for example, open-sourced many libraries/tools such as Hystrix which provide the ability to granularly monitor the external calls made by a service. This helps in checking the health of dependent services and taking appropriate actions (such as retrying an operation or alerting and adding diagnostic information into logs) upon failures.

I will go into more details in Part 2 of this blog.

#microservices #scalablearchitecture #webservices

--

--

Prasanna Sagar Maddu
Building Enterprise Applications in Python

Vice President — Data Scientist Leader, Data Strategy, Applied ML and Machine Learning/Deep Learning/Python Expert