Thinking About Micro-Services

Apr 5, 2016

I’ve been thinking about micro-services lately as a way to organize projects. I think I understand the concept better when I think of them like dynamically-linked libraries.  At first, it seemed inefficient to have different services communicate through HTTP calls instead of just using them in memory functions. However, by separating small components into different independent services, it allows updates to occur to only the service like updating a DLL, instead of having to update the entire app. The benefits are worth it, to try as an experiment, at least. They provide strong module boundaries, allow for independent deployment and allow an agnostic choice of technologies to work together as a system.

The strong boundaries between services are enforced at a functional level. The service has to have an API for other services to communicate with it. Each service has to check the status and health of itself and other services. Since each service is independent, they allow for a higher granularity of testing. To be truly independent, each service must manage its own database. The database can be collocated on the same machine, lowering the latency between the app and the database. To get data from another service, you need to use the other service’s API, not a database query. While projects with submodules can enforce more modularity, there is still a certain amount of glue code needed for reusability. The benefit of a truly independent service is that it’s easier to scale up to multiple instances based on the demand of said service, instead of the entire app.

Things you need for micro-services to work.

• A container technology like Docker, and a management of multiple containers to work together like kubernetes.
• A private container repository like Docker Hub for the containers.
• Kubernetes can deal with distributing the micro-service containers across the servers, automatically scaling across one or multiple machines to fully utilize resources. It can run locally on your laptop and have the same distributed container system used in production as when developing the code.

Negatives

The negatives of microservices are that it increases operational complexity, creates a distributed system, and is only eventually consistent. The operation complexity is dividing a project into independent service containers, instead of a simple project with all code inside one repository. Now you really need a container cluster manager like Kubernetes instead of a simple git pull. Its only eventual;y consistent because it decentralizes data management.

What happens when you rewrite your monolithic app into microservices? What if you increase complexity, make the app slower, and use more costly service providers? Technology keeps changing, container technology will keep improving in efficiency. I think its an idea worth exploring.

RECENT POSTS

The Agile Manifesto in Practice: Part 1

The Agile Manifesto in Practice: Part 1

  How Sourcetoad Values People Over Process The software development process can involve a lot of uncertainty for both development teams and clients alike, especially in the early phases of a project. How can the long-term vision of an application be balanced...

What to Consider When Building HIPAA-Compliant Software

What to Consider When Building HIPAA-Compliant Software

In 1999, the Department of Health and Human Services (HHS) passed the Health Insurance Portability and Accountability Act (HIPAA) as a measure to protect personal health information (PHI) and allow people control of their healthcare records. The HITECH Act was enacted...

The Evolution of Buy Now, Pay Later in eCommerce: Part 2

The Evolution of Buy Now, Pay Later in eCommerce: Part 2

In Part 1, we talked about the rapid growth of Buy Now, Pay Later (BNPL) and discussed its expansion across industries. In Part 2, we will consider how impending regulation may shake up the short-term lending space.   Impending Regulation of BNPL While consumers...