It all started with an invite to give a session on Microservices from our training group. Microservices has been one of the most buzzing word in the tech industry for sometime now. This all started with applications being built around the computation needs of the features within over a common computation need for the entire application and the need for feature/service level isolation for better integration. Well let me clear the cloud a little.
You can find the associated code at – Microservices Training Github Repo
The agenda of the session was more to setup the thought of building microservice based applications as a mindset and culture change over just another technology buzzword. All the while we might have been building applications either for the desktop, web and/or mobile as a single large installment, also know as a ‘monolith’. The monolith way developing applications has been prevalent for a while and has successfully excelled the art of digitizing a large number enterprises from their traditional book keeping approach to a more sophisticated mainframe and later to a desktop, web and mobile. As the transition progressed and enterprises saw the advantages of moving to a digitized world, they also saw the need for improving the speed to market in terms infrastructure and maintenance.
Let’s start with building a simple online e-commerce store, for simplicity and readability lets name it eStore. I have considered Java to code this application.
The eStore would primary have the following features –
- Home page – The user lands onto a default homepage which would showcase all the various products available in the eStore catalog.
- Login/Registration page – The Login/Registration page would allow a user to login with their credentials or register a new user into the system.
- Add to Cart – Let users to add items they choose to a cart.
- Shopping Cart – Display all the products the user had chosen earlier with the applied tax and the total the user would end up paying.
- Check-out – Let the user check-out the items in the cart and place an order.
- Orders – View all the orders placed by the user.
The above diagram depicts the basic architecture of the eStore monolith. The user interacts with the Home Page to navigate to the other views in the system like Catalog view, Login/Registration view, Cart view, Order Confirmation View and Orders View. The functionality of each of the views is as listed above. The views would depend on the underlying service and data layers to retrieve and/or update the data to/from the data source.
Well, this seems to be a near perfect solution, what could go wrong with this? Yeah, I too had the same view. As we start adding more features to the application, the application deployable starts bloating in size from a few KB’s to a couple of GB’s and this would become a support’s nightmare, well how? As the application deployable’s start growing in size, so would the time taken to deploy the application. Along with that in peak holiday season’s like Thanks Giving, Christmas the site would start seeing a sudden surge in the number of hits and the current infrastructure would give up. So we start scaling the application by adding more infra, well how much more? At a point even adding more infra would not be recommendable anymore.