Speed up your website and improve server management with Microservices

Mushrooming applications and growing development teams provide challenges to keep all the growth manageable.

Most platforms start with a monolithic application at the beginning. As the application grows, more and more functions and / or modules are added into the application. Of course, the code base grows as well. This presents a challenge to efficiently manage a large application and development teams. Does this sound familiar? Read on for some ideas to master your challenges.

There are some solutions that have a crack at solving the problems, such as Agile Software Development, Horizontal Scaling, and Database Clustering. However, these are still not as efficient as we need. Because it’s a single application and everything is packed inside together, development teams or developers struggle to work independently to develop and deploy their own modules. No worries, help is at hand in the shape of microservices.

What are Microservices ?

 Microservices is a software architectural implementation approach for Service-Oriented Architectures (SOA). Microservices architecture aims to break down large applications into small independent containers. Each container has its own system library, web services and databases, so it can run independently. Containers communicate with each other using HTTP API requests like REST. The main application is built up with many microservices containers.

Microservice architecture organises each element of functionality into autonomou

As you can see from the above diagrams, the main application container sends content to front-end users. Module 1 and 2 containers help the main container to build up some of the contents, and send them to the main container via API calls. These API communications can be real-time or cached, depending on the requirements.

The Advantages of Microservices

Different development teams can deploy their own modules or apply a hotfix independently as long as the APIs aren’t changed.

  1. Each microservice container can be developed in any language and stack that is the best fit for the requirements.
  2. Code bases remain very small.
  3. Easy to develop a new module with minimum changes of main application in most cases.
  4. Reduction in temporary failures of some microservices
  5. Best fit for continuous delivery with DevOps

Microservices Project Example: Better Hotel Room (BHR)

Better Hotel Room (BHR) operates an online hotel booking system covering thousands of quality hotels available in Australia, New Zealand, Hong Kong and around the world on both Australian and Chinese websites.

 Internetrix recently created a cutting edge website for BHR. The screenshot that follows shows that the design is contemporary, the highly visual look and feel well matched to a quality front end without clutter.

We choose this example because it demos our technical skills and booking implementation teamed with creative credentials to deliver a website that looks great and functions perfectly.

Technically, Internetrix pulled out all the stops to meet highly complex integrations for this website to connect to Sabre Global Distribution System (GDS) – the world’s largest electronic booking system.

BetterHotelRoom

BHR is also a good example of Microservices in action because the website is built with lots of modules. I’m going to demonstrate how we implemented 2 important modules as microservices.

 Implementing modules as microservices:

BHR website connects to a GDS provider using APIs. When we started, it could take up to 10 seconds to get a list of hotel availability from the GDS API. That was simply not viable because most people will just give up with that kind of delay and leave the website. To improve performance of the hotel search page, we set out to build 2 modules:

  • Hotel search cache module
  • Latest room rate module

Both these modules are hungry ones needing lots of computing and network resources. Fortunately, it is not necessary to pack them inside the main application, so we decided to build 2 microservices for BHR main website.

Hotel Search Cache Module

This module runs a couple of background jobs to create hotel search results with defined combinations of check-in, check-out dates and guest number for most of the popular cities. When users search for hotels in a city, the website quickly gets the result from the cached records instead of waiting for a response from a GDS API request.

The main application sends a ‘Cache Popular Cities’ API request to the container of this module every couple of hours. This module then creates and schedules caching jobs for each city. Once a job is completed, it sends hotel search results of all combinations back to the main application via API.

Latest Room Rate Module

When the main application returns the cached result of the hotel search to front-end users, the cheapest prices of some hotels may not be correct because the data could have been cached for more than 12 hours. By using the Latest Room Rate Module, we can fetch the latest room rate for each hotel and cache the data for only a short time like 5 minutes.

On the hotel search page, AJAX requests are sent to the server of this module to get the latest room rate for each hotel displayed on the user's browser. This module then sources the latest room rates from the GDS API. Results are not only sent back to the browser as an AJAX response, but are also sent to the main application for short time cache.

Summary

The above example of microservices architecture provides an excellent demonstration of the usefulness of microservices within the BHR website. There are many ways to build microservices which have the following handy characteristics:

  • Easy to be deployed and replaced
  • Full-stack application
  • Decentralized
  • Work independently for requests
  • Communicate with other services over reliable lightweight API

Next time you are puzzling over a solution for your applications, why not look to Microservices architecture which is agile and suitable for cloud products / platforms, agile software development.

Thank you for browsing this post, stay tuned for more from Internetrix. Pick up the phone, Live Chat, or email us if you would like us to share our web development skills, case studies, and knowledge to achieve your business goals and targets.

Need help with your web development? Talk to us

Internetrix combines digital consulting with winning website design, smart website development and strong digital analytics and digital marketing skills to drive revenue or cut costs for our clients. We deliver web-based consulting, development and performance projects to customers across the Asia Pacific ranging from small business sole traders to ASX listed businesses and all levels of Australian government.

Comments (0)

No one has commented on this page yet.