Microservices Best Practices You Should Know

A new trend that we see in DevOps teams is the adoption of microservices, where big and complex applications are broken down into independent and small processes and services. These microservices can communicate with each other through application programming interfaces (APIs). By breaking a monolith into microservices, developers are able to handle applications better, isolate problem areas without shutting the whole application down and focus on completing singular tasks.

While switching to microservices seems like a rather easy task, many developers can underestimate the complexity of the migration process, and that can eventually lead to disastrous results. That is why, before transforming your application’s monolithic architecture into microservices, it is important to set out best practices to avoid any challenges which might arise during the process.

Here are the Microservices Best Practice You Should Know

 1. Understand why do you want to migrate to microservices

Just switching to a microservice architecture because it is the latest technology may not do your organization any good. Switching to microservices can take months depending on your application’s size, and it can also be expensive since you will have to train your resources or hire new DevOps to handle the migration.

After all, if you have a working application that works just fine, then why disrupt that by changing the architecture? There has to be a driving force for the change.

Whether you are facing issues with your application or you want to make it faster, the reason has to be big enough for you to make the shift.

 2. Define what a microservice is

Before planning a strategy for microservices, you need to define what exactly a microservice will entail in your application’s architecture. Depending on your business requirements, you might want to go for medium-sized services, if bigger services align with your business and engineering teams better.

One way to determine the size of a microservice is checking which pieces of code, when changed, create exponential test cases. It is crucial to have a clear idea about what microservices, services, and functions look like for your company, because if you do not, then you could end up with either of these problems:

  •  Your application gets under fragmented, and you are not able to see any benefits of microservices
  • Your application gets over fragmented, and the weight of managing the numerous microservices takes away its value as a whole

 3. Create isolation between microservices at several levels

By isolating microservices from each other, you are able to change them as quickly as possible. Isolation needs to be done at several levels, including:

Runtime processes: One of the most common ways of isolation is differentiating microservices according to runtime processes. This could involve various http management approaches, event architectures, containerization, service meshes, and circuit breakers.

Teams: By partitioning your application, you are able to partition work among teams in a more well-defined manner and give autonomy to the team members as well.

Data: Of course the biggest advantage of implementing a distributed computing technology like microservices is that your data gets partitioned and it re-integrates at the system level.

4. Decide how services will find and communicate with each other

As you are building and deploying microservices separately, you also need to remember that these microservices need to be able to communicate with each other to create a logical workflow and finished application, which from the user’s perspective should look the same as the monolithic application.

While many developers try to hard code the locations of microservices in the source code, it can lead to an array of problems when the location of any of these services need to change. Better alternatives to this problem include a centralized router or a service discovery protocol since both require registration, deregistration, scalability, and high availability.

With service discovery, automatic detection of services becomes possible, and the router is able to work between systems to direct one service towards another. It is the responsibility of service discovery to tell where things are, while centralized router proxies all the traffic.

5. Selecting the right technology

While many companies spend a lot of time selecting the right technology to implement microservices, the truth is, it is rather overvalued. That is because most of the modern computing languages are equally flexible and fast. Most importantly, almost any problem can be solved with any technology.

While all languages have their pros and cons, the decision really comes down to personal preferences and not technical reasoning.

Choosing a language for implementing microservices will become a hiring decision since you will need developers on board who are comfortable working with that language. That is why it is also recommended not to mix too many programming languages, as it could make hiring people rather difficult.

In conclusion

Switching to microservice architecture can lead to many challenging. Before you start the migration process, make sure you have real reasons for it, take an incremental approach, and follow all the best practices.

Everything You Need To Know About Monitoring Kubernetes

It can be rather challenging for legacy monitoring tools to monitor ephemeral and fast moving environments like Kubernetes. The good news is, there are many new solutions that can help you with this.

When you are carrying out a monitoring operation for Kubernetes, it is crucial to make sure that all the components are covered, including pod, container, cluster, and node. Also, there should be processes in place to combine the results of the monitoring and creating reports in order to take the correct measures.

Before moving forward, your DevOps team has to understand that monitoring a distributed system like Kubernetes is completely different from monitoring a simple client-server network. That is because monitoring a network address or a server gives much less relevant information as compared to microservices.

Since Kubernetes is not self-monitoring, you need to come up with a monitoring strategy even before you choose the tool that can help you execute the strategy.

An ideal strategy will have highly tuned Kubernetes that can self-heal and protect itself against any downtime. The system will be able to use monitoring to identify critical issues before they even arise and then resort to self-healing.

Choosing Monitoring Tools And When To Monitor

Every monitoring tool available for Kubernetes has its own set of pros and cons. That is why there is no one right answer for all types of requirements. In fact, most DevOps teams prefer to use a combination of monitoring tool sets to be able to monitor everything simultaneously.

Another thing to note is that many DevOps teams often think about monitoring requirements much too late in the entire development process, which proves to be a disadvantage. To implement a healthy DevOps culture, it is best to start monitoring early in the development process and there are other factors that need to be considered as well.

Monitoring during development – All the features being developed should include monitoring, and it should be handled just like the other activities in the development phase.

Monitoring non-functionals – Non-functionals like requests per second and response times should also be monitored which can help you identify small issues before they become big problems.

There are two levels to monitor the container environment of Kubernetes.

  • Application process monitoring (APM) – This scans your custom code to find and locate any errors or bottlenecks
  • Infrastructure monitoring – This helps collect metrics related to the container or the load like available memory, CPU load, and network I/O

Monitoring Tools Available For Kubernetes

1. Grafana-Alertmanager-Prometheus

The Grafana-Alertmanager-Prometheus (GAP) is a combination of three open source monitoring tools, which is flexible and powerful at the same time. You can use this to monitor your infrastructure and at the same time create alerts as well.

Part of the Cloud Native Computing Foundation (CNCF), Prometheus is a time series database. It is able to provide finely grained metrics by scraping data from the data points available on hosts and storing that data in its time series database. Though the large amount of data it captures also becomes one of its downsides since you cannot use it alone for long-term reporting or capacity management. That is where Grafana steps in since it allows you to front the data which is being scraped by Prometheus.

To connect to Grafana, all you have to do is add the Prometheus URL as a data source and then import the databases from it. Once that integration is done, you can connect Alertmanager with it to get timely monitoring alerts.

2. Sysdig

Sysdig is an open source monitoring tool which provides troubleshooting features but it is not a full-service monitoring tool and neither can it store data to create trends. It is supported by a community, which makes Sysdig an affordable option for small teams.

Sysdig can implement role based access control RBAC into tooling, it has an agent-based solution for non-container platforms, and it also supports containerized implementation. Since it already has a service level agreement implementation, it allows you to check and get alerts according to response times, memory, and CPU. There are canned dashboards that you can use.

The only downside to using Sysdig is that to use it you need to install kernel headers. Though, the process has now been made much simpler with Sysdig able to rebuild a new module everytime a new kernel is present.

While Sysdig is the free and open source, there is premium support available for enterprise customers through Sysdig Monitor, and there are two types of solutions available- SaaS full-service monitoring and on-premise.

3. DataDog

DataDog is a SaaS-only monitoring tool which integrates APM into its services. It provides flexibility with alert monitoring, and you also get access to dashboards through a UI. It can also provide APM for Python, Go, Ruby, and there will soon be a Java support as well.

You can connect DataDog to cloud provider environments, and it can consume data from sources like New Relic and Nagios. With its dashboards, you can overlay graphs, and it can process other APIs which expose data.

There is a service discovery option which allows DataDog to monitor dockerized containers across environments and hosts continuously.

In conclusion

As we mentioned above, monitoring Kubernetes is not an option but a crucial requirement, and it should be implemented right from the development phase.

Why Technology Modernization?

73% of IT leaders believe that centralized/integrated technology systems must be a priority.

Economic activities are taking place digitally constituting great challenges for the IT department. The IT department has to not only oversee the daily computer operations, monitoring of communications and networks, keeping up with compliances etc., but work toward transformation and innovation too. For the same reason, IT modernization is slowly taking precedence for business and IT leaders to meet their business goals and keep ahead of the competition.

Why IT Modernization important:

With frequent changes in technology, the systems need to be changed/upgraded too. Systems that tend to just keep up, can be vulnerable and left behind fast. The need for IT modernization or integration of systems is for achieving goals, reducing costs, improving performance and operational efficiencies. With startups releasing products and applications with newer features in the market at a greater speed, it is no wonder that larger businesses and their business leaders have felt the need to push the efforts towards IT modernization and drive their businesses with agility, security, and efficacy.

Here are a few reasons which back IT modernization:

Efficiency: If IT infrastructure/data is decentralized, it is difficult to track, protect, supervise and manage. Cloud implies cost-effectiveness, innovation, and speed; hence must be integrated with the IT infrastructure augmenting connectivity and access. Integration of cloud in the IT infrastructure can readily ensue via the Integration Platform as a Service (iPaaS) while keeping security and efficacy intact. Through iPaaS, data can move securely and faster. This allows employees to concentrate, anticipate and solve issues with clarity due to them having operational recognition and control. It is advised to develop a data management strategy.

Security: It is vital to have complete control and visibility of data within the IT infrastructure. The movement of data within and outside the organization’s network and its usage by employees determine decisions. In decentralized structures, it is difficult to secure data leading to non-compliance at times.

Agility: The existing infrastructure must handle a responsive organizational environment. Data transfers must be speedy and efficient in organizations so they can stand out from competitors. In an enterprise data management strategy, a robust but flexible infrastructure is the key to working swiftly.

IT Modernization Steps

IT modernization includes a gamut of strategies such as planning, alignment with goals, and understanding loopholes while having a partner to make it a reality.

Assemble and modernize: It is imperative for organizations to take inventory of their applications and the infrastructure associated with it. Mobile users access data from anywhere at any time, and also generate data, hence organizations must deploy software-defined infrastructure and comprise a data center infrastructure to scale up.

Automate: Updating application infrastructure is a vital step in modernization. Manual steps which can stifle growth and increase delays/errors must be replaced with automation. Compliances must be followed with respect to provisioning, distribution, and scheduling. In this process, APIs must be mapped to pre-defined policies; and automatic allocation must occur in resources, tracking utilization etc. while ensuring standard repeatable processes.

Measure and examine: System parameters must be identified which can be used and metrics which should be monitored and reported. Through repeated monitoring of these metrics, deviations can be identified, vulnerabilities understood and rectified before any errors occur. These metrics ensure that the infrastructure and applications run smoothly adding to productivity. Proactive log analytics assists in determining issues which help the team in responding to failures before they occur.

Audits: When tools, technologies, and systems are introduced in the organization, audits are required. They are a must for security procedures, data lifecycle (available and recoverable at all times with minimal losses), and data governance. Modern data centers improve systems availability while lowering costs.

IT modernization’s implementation must be in phases with a partner – identification of new teams, technology, and new processes. Once successful, these services can then be scaled along with other new initiatives, and measurable benefits be gained.

Government’s Benefits From IT Modernization

75-80% of IT budget is spent on operations and maintenance, leaving very little room for innovation and modernization. The need is to push for modernization. Outdated infrastructure also gives the government a negative perception from its citizens. Hence, digital services must be enhanced while keeping costs low for citizens, for the services provided.
The federal government must invest in new applications/services for its citizens by using the latest technology. Using big data and analytics – programs in public safety, justice, reducing cybercrime, disaster response improvement, or streamlining other processes can be supported by an effective government. Automation through the artificial intelligence of simple questions can allow the agency employees to focus on other complicated matters.

So how can the government provide highly agile, secure and flexible services through a robust infrastructure? While data can assist in taking decisions, cloud can be used for focusing on mission related decisions. Agencies must move the applications to cloud (using DevOps and agile methodologies). Also, through application modernization, codes can be re-hosted, new programs developed, and agile development to join dissimilar systems together. APIs can be used and applied to data sets to assist in new development. These systems will ensure that needs of the citizens are met faster in conjunction with safety, while providing high quality of goods and services.

The Modernizing Government Act (MGT), passed by the bill is waiting for consideration from the Senate. “It would place $250 million fund managed by the General Services Administration and overseen by the Office of Management and Budget, that agencies can tap into for modernization for projects with cybersecurity challenges, can move to other shared services or are expensive to maintain.” It is time the government works with private partners to begin transformation, improve services and efficiencies.

Listen to a few leaders speaking on IT modernization in the federal government:
https://federalnewsradio.com/sponsored-content/2017/09/jumpstarting-it-modernization-in-government/slide/1/

Sources:
https://gcn.com/articles/2017/04/10/it-modernization-taxonomy.aspx

https://www.globalscape.com/blog/why-it-modernization-important

https://www.itbusinessedge.com/slideshows/5-tips-to-successfully-plan-for-it-modernization-02.html

https://fcw.com/articles/2017/07/06/comment-paul-it-modernization.aspx

Why Companies Like Netflix, Uber, And Amazon Are Moving Towards Microservices

In case you have been living under a rock, let us break the news for you- Monolith is out, and now most internet companies have moved towards microservice architecture including Netflix, Uber, Amazon, and Apple.

There were many reasons for the shift, but the most important one was that monolithic is a big autonomous unit and handling it becomes more difficult by the day as the monolith grows bigger when you add new functionalities. Even the smallest change or bug fix requires a complete re-coding and re-deploying of a new version of the application. With microservices, all the processes get simplified, scalable, and streamlined as all the functionalities are divided into independent units.

When we focus on the industry disrupting companies like Airbnb, Uber, and Netflix, we see organizations that are continuously building custom software to get a competitive edge. In fact, many of the companies are not even core technology companies. Instead they use software to provide unique offerings. The results, as we know, drive great revenue for the companies.

Why Microservices Is A Better Option For Breaking Down Monoliths

Even with all the various open source tools and products, maintaining and deploying applications on the cloud is still difficult and time-consuming. Since most of these companies were launched over six to seven years ago, they had no other option but to create their own cloud platform on raw infrastructure.

There was a need for management layers between the applications and cloud infrastructure that they were being created. But it still proved to be better than the monolith architecture, since with microservices they can manage all the different operations of the application separately. So, even if a part of the application is down or needs bug fixes, the rest of the application will still be up and running with no downtime.

Let’s discover how companies like Netflix, Uber, and Amazon are moving towards microservices:

Netflix

In 2009, when Netflix started to migrate a monolithic infrastructure to a microservices one, the term ‘microservices’ didn’t even exist anywhere. Working on a monolithic architecture was proving to be difficult for the company with every passing day and the service would have outages whenever Amazon’s servers went down. After moving to microservices, Netflix’s engineers could deploy thousands of different code sections every day.

Forced to write their own entire platform on the cloud, the company has been pretty open about what they learned with the move, and they have even managed to open source many of the components and tools to help the community. Though Netflix hasn’t put up their entire platform code on Github, which could also help new companies. Overall, moving to microservices was incredibly beneficial for Netflix, and it has led to decrease their application’s downtime to a large extent.

Amazon

Back when Amazon was operating on a monolithic architecture, it was difficult for the company to predict and manage the fluctuating website traffic. In fact, the company was losing a lot of money as most of the server capacity was being wasted in downtime. Back in 2001, Amazon’s application was one big monolith.

Even though it was divided into different tiers and those tiers had different components, they were tightly coupled with each other, and they behaved like a monolith. The main focus of the developers was to simplify the entire process, and for that, they pulled out functional units from the code and wrapped them in a web service interface. For instance, there was a separate microservice was calculated the total tax at check out.

The company’s move to Amazon Web Services (AWS) cloud for microservices helped them scale up or down according to the traffic, handle outages better, and save costs as well. Since microservices allows to deploy code continuously, engineers at Amazon now deploy code every 11.7 seconds.

Uber

Just like any other startup, Uber too started with a monolithic architecture for their application. At that point, it seemed cleaner to go with a monolithic core since the company was just operating in San Francisco and only offered the UberBLACK option to users.

But as the ride-sharing startup grew multi-fold, they decided to follow the path of other companies like Amazon, Netflix, and Twitter and moved to microservices. The biggest advantage of migration was, of course, the fact that each microservice can have its own language and framework.

Now, with more than 1300 microservices, Uber focuses on applying microservices patterns that can improve scalability and reliability of the application. With so many microservices, a big focus is also on identifying the ones that are old and not in use anymore. That is why the team always ensures to decommission the old ones regularly.

In conclusion

While its natural for new companies to take the monolithic-first approach because its quick and you can deploy quickly as well, over time, as the monolith gets bigger, breaking it down into microservices becomes the most convenient solution.

5 Reasons Why You May Want To Stick With A Monolithic Architecture

Microservices and distributed computing have become the new buzz word among DevOps. Everyone wants to migrate their architecture to microservices, mostly because it is the new trend. Because of that, monolithic applications seem more like a burden on cloud computing.

The strange thing here is that monolithic appalications were never claimed as the best option, they just seemed like the most common and convenient option. That is why many companies still start their operations by coding a monolithic core.

Monolithic architecture brings with it many sturdy benefits that we cannot ignore, all because it doesn’t fit well with the modern architectural practices. On the contrary, microservices add complexity to an application, which is not always necessary.

Here are some reasons why you may want to stick to a monolithic architecture:

1. Monoliths are better for complex enterprise apps

The reason why microservices have gained popularity in the last few years is that a number of leading internet companies have migrated to it, including Uber, Netflix, Apple, and even Amazon. While implementation of microservices makes more sense for these cloud-based companies since they have a large customer base and downtime in one of part of the application does not affect the whole. It is also easier for developers to continuously update the code or add bug fixes without any downtime.

But the complexity that microservices brings with it, may not be worth it if the application is not that big or it is an enterprise level application. With a monolithic core, developers do not have to deploy changes separately; they can do it all together — thus saving them a lot of time.

2. Testing and Debugging

It is much easier to debug monolithic applications, as compared to microservices. That is because, with microservices, there are hundreds of new variables introduced, and any of them could go wrong and create problems.

Not to mention, lesser dependency among variables in microservices means, it can be difficult to determine when an interface contract or compatibility is broken. To put it simply, you may not even know what has gone wrong until you are at runtime.

3. Performance

For an application that is accessed by millions or thousands of users every day, adding the complexity of microservices may be worth the extra effort. But, what you need to remember as a developer is that most enterprise business applications do not even come near that many number of users.

Now, if you create a new application that takes several seconds to load every new screen all because it needs to make 50 API calls to 50 microservices, then your end users are not going to care about your modern architecture. All they will see is an application which takes a lot of time to load. You could add request collapsing and clever caching, but that is just an extra set of complexity that you did not even need in the first place.

4. Security

Diving an application into hundreds of microservices does not just mean that you will have to decide how these microservices interact with each other but you will also have to decide a security protocol for each one of them. For instance, some microservices might have access to sensitive company data, while some may not. To manage a coarse-grained application like that, you will have to define security borders, even before you start to segment microservices.

5. Designing the Architecture

Designing a microservices architecture can takes weeks to months of initial planning just to get your project off the ground. It also means that you would have a higher upfront design cost and may even need to hire more developers just to break down microservices. There is a continuous risk of over-architecting and you may end up creating more microservices than you need, which will, in turn, increase the complexity of the architecture.

With a monolithic architecture, the development takes much lesser time, both in planning and designing. It also saves overall costs.

Breaking Down A Monolithic Application: Microservices vs. Self-Contained Systems

In modern architecture, monolithic architecture and applications have become a thing of the past, and every organization is moving forward to break them down. After all, moving away from monoliths is a logical decision since its more complicated and there are also many dependencies and issues with deployment and testing.

For most developers, microservices seem like the most obvious solution to replace monoliths. But in this article, we will be discussing how self-contained systems can also be a successful option for breaking down monoliths.

Microservices

One of the most obvious benefits of microservices is that it allows users to do continuous deployment and change, debug, or replace a part of the application without affecting the rest of the application. Using microservices architecture means, if anything goes wrong in a part of the application, it is contained in that very part, and the rest of the application continues to work without a glitch.

However great microservices may sound, transforming a monolith into microservices architecture is easier said than done. Depending on the size of the monolithic core, it can take a few months to years, just to convert a monolithic core into multiple microservices.

Pros

  •     Maintaining microservices is comparatively much easier because each one of them has its own purpose and built with a laser-like focus on that very purpose. It also allows developers to jump in and out of microservices quickly. They are easy to run and quick to deploy.
  •     Since all the microservices in an application are isolated from each other, if one part fails, it does not affect the other and does not lead to downtime. For instance, even if the microservice that handles adding new orders is down, your customers would still be able to check the status of their existing orders.

Cons

  •     Every application may have hundreds of microservices, making them operationally complex. Developers cannot manage it all at once on the same server or deploy them one by one. Instead, they will require automation to handle everything.
  •     Communicating messages from one microservice to another takes a lot of effort because developers need to make sure the data is transferred sensibly and consistently. More often than not, you will have to create a new microservice to handle transfer and authentication of data.

Even with those cons, microservices are still preferred over monoliths. The initial time taken to break down a monolith into microservices may be a lot but after that, what you get is an easy to manage architecture.

Though, if the initial costs and time for creating microservices is a lot for your organization and handling monolithic applications has become incredibly complicated, you might want to consider the self-contained system as an option.

Self-Contained System

Self-Contained Systems (SCS) are similar to microservices in the way that they allow you to breakdown a monolith into smaller and independent parts. But, there are many differences between SCS and microservices:

  •     In SCS, you break a monolith down into replaceable and autonomous web applications, which isn’t the case with microservices
  •     The SCS units are within software and larger than microservices
  •     SCSs have their own autonomous user interface (UI), data storage, and business logic, making them more customizable than microservices
  •     While API level integration of SCS is possible, UI level is a more preferred integration

Since SCS is bigger than microservices, when you break down a monolith, creating SCSs takes much lesser time than microservices. Instead of being a complete redesign, SCS makes an application more agile by dividing it into small steps to reduce chances of failure.

Pros

  •     One of the biggest advantages of a self-contained system is that you can build several SCS units, each with different databases and languages.
  •     With monolith broken down, you can easily handle the coding and deployment of the application. Since the data is internal, you do not need to worry about how messages get passed from one SCS unit to another.

Cons

The line between SCS and microservice does exist, but it is slightly blurry, which means, it can be difficult for you to define an SCS architecturally. There is a lot more planning that goes into it before you can begin to break a monolith down into a self-contained system

Choosing Between Microservices Vs Self-Contained Systems

If you want to break down a monolithic and your end goal is microservices, you could still start with a self-contained system and then move towards microservices. Though you have to be patient while breaking down SCS units to make your software more agile.

As mentioned above, planning is more important than ever otherwise you might end up with SCS units that get bulkier and bigger with time. If that does happen, you will have to start breaking them into microservices.