Categories
Programming

Thinking About Microservices Architecture

In the past 2 weeks I was so busy with many things. Had an interview with a well known media company. It was the longest interview process that I ever had.  and I was busy finishing a system I’m developing and collecting data for the green system here.

Right now, at AiU, I have to think a lot about how to implement IoT solution. How the overall of the architecture looks like.

And I chose microservice architecture.

From microservices.io:

Microservices – also known as the microservice architecture – is an architectural style that structures an application as a collection of loosely coupled services, which implement business capabilities. The microservice architecture enables the continuous delivery/deployment of large, complex applications. It also enables an organization to evolve its technology stack.

Why do I choose microservices architecture?

At AIU, I won’t be connecting just one type of device (the switch), but I’ll be connecting with the door and the solar, the battery and the grid.

I don’t like a single point of failure even though using just one system may make the system easier to make.

Another challenge that I have is that all these devices “speak” different languages. One is Java, another is C++ and another… Microsoft Access.

Since I have to connect to multiple types of devices with multiple languages at the same time, I doubt that a monolithic architecture is a good way to integrate all these devices.

From Wikipedia, monolithic applications are:

In software engineering, a monolithic application describes a single-tiered software application in which the user interface and data access code are combined into a single program from a single platform.

Drawbacks of Microservices Architecture

  1. To debug is quite hard. You have to write all the loggings for all the different services and it may have different languages
  2. Consumes more time to develop than a monolithic one. Each type of devices has its own so-called “controllers”. Instead of one big one that manages everything.

Pros of Microservices Architecture

  1. Easier to add new functions. If I wanted to add new function to the smart switch like scheduling, I just whip open the smart switch controller’s project, I can add that function.
  2. Know exactly what’s going on – instead of guessing, I know which device caused problem. Can’t get the data from solar panel, OK it’s autoswitch controller’s problem. I can debug from there.

Microservices is not a silver bullet to me. It’s just that I felt that using this architecture is the best for this situation of mine.