COVID-19 has affected almost every people, every sector and every nation. There are millions of people suffering with various problems. It is we who are strong financially, physically and mentally have to help people who are in need and be a corona warriors.
How can I help during COVID-19?
Join SociallyGood a trusted first ever marketplace for social service sector to donate thousands of non-profits who are serving millions of people who got affected by corona virus pandemic. Volunteer and donate through SociallyGood
One of the important aspect of any platform is performance, to increase the performance to satisfy end users with quick access one can not escape from in memory cache. Database operations are always costly, executing complex queries to meet real time needs will make the entire platform slow. For faster access, in-memory cache is very much needed. People use Radis and Kafka.
Now interesting question is where do Caching service fits in my architecture? How do we represent it in platform architecture and where do we integrate caching?
Typically we should have a cache manager within the app which manages caching and database. For any request first we have to check whether required data is in cache ? if not then only hit Database else return from cache.
In case of data update or new insertions , the cache manager has to take care of updating the cache and then make the updated data available for further read operations.
The updated platform architecture looks as follows now
Redis or Kafka are well known services for in-memory cache, but both have their own purpose, so we have to decide upon what to use when ?
File Server for file storage in platform architecture
I thought of covering this also in the same article as it is a small but very important to consider. Because lot of developers have confusion regarding where to store files ? many people will create a folder in their application server and store all files there itself, which is a very wrong for ay real-time applications.
It is recommended to store files in file servers like Amazon AWS S3 bucket and Google Storage, if its publicly sharable multimedia file like image or video then go for Cloudinary kind of CDN services.
Why not to store files in application server?
Application servers like amazon EC2 or Google App engine are not made for file storage, their purpose is to run your app
Application servers are compute engines where you can install any software whichever you need for you app to run in cloud, where as file servers are just providing the storage to store huge files
File servers have different qualities altogether they can take you files backup, create replica if needed, they are capable to transfer huge data fast enough, they are cheaper than app servers
in case of app servers, for some reason if something goes wrong, u may need to create new server quickly and release your app again, if your all file data is also stored in the same server you may loose it permanently, but file server are more reliable for that matter
This is what amazon claims -> Amazon S3 is designed for 99.999999999% (11 9’s) of data durability because it automatically creates and stores copies of all S3 objects across multiple systems.
File servers also provide other services like securing files through authorised access, encrypt the files
Manage and access control – you can create multiple folders and access each folder for specific service so that other services won’t get access to it
File servers like Amazon S3 provide services like querying on the data stored in files, all such nice features you won’t get it in app servers because they are not meant for it
We all know how badly Corona Virus has affected millions of people. Daily wage workers and all other businesses are hit badly. Its time to help those who are in need, there are thousands of Non Profits working for COVID-19 situation.
Sewa USA is running Fund raiser program as Sur Surgam, donate for Sewa USA
United Nations is the country which is hit very badly during COVID-19 than any other nation. USA is struggling to come out of it. However its the time you can help USA by volunteering on different cause.
Find many such volunteering opportunities by Sewa USA. SociallyGood Platform is a trusted marketplace for Social Service Sector
COVID-19 pandemic has made our life miserable, almost every country is facing hardship due to corona virus. Corona Warriors like doctors, nurses and many millions of social workers are helping us to save us from Corona.
This is the time where everyone has to serve the society to help people and to stop pandemic. There are several Non-Profits working towards this goal. You can find several volunteering opportunities in a Social Service Marketplace called SociallyGood, a trusted platform for Social Service Sector. Here are some of the volunteering opportunities for COVID-19
Despite all of these inputs, I am still saying platform architecture depends upon various needs of the platform, hence there is nothing like one standard way, it will be always evolving. Hence let us look into some of the platform architectures to understand even better
For applications like Amazon, Netflix, Linked in the backend systems deals with billions of requests per second. It is not possible to handle such a huge traffic by having one consumer app or one seller app. The solution to such a huge systems is micro service architecture.
Probably Amazon has mastered in Micro Service Architecture which runs over more than 500 micro services, similarly Netflix has over 500 micro services and their API Gateway handles over 2 billion requests daily – Source
So dividing Amazon kind of apps into multiple micro services may have following services
Amazon Kind Of Platforms Micro Services
User & Identity Management Micro Service
Product Management Micro Service
Order Management Micro Service
Payment Management Micro Service
Delivery Management Micro Service
Data Mining Micro Service
AI Micro Service
The Micro Service Architecture Looks as follows for Amazon Kind of Platforms
Advantage of Micro Service Architecture
Highly Scalable: Systems of this kind are highly scalable, capable to handle billions of requests every day
Heterogenous Technology: Another major advantage is we can develop each micro service using different technology whichever is suitable for it. Example Order Management you can develop using nodejs and MongoDB, however for data mining management, you can use python and MongoDB. For payment management you can use Java with Postgres SQL
Easy to Build and Maintain: Your development team might have spread across the world, it is easy to maintain and build any service any time
Ever Evolving: Every micro service can evolve at any great extent without affecting other systems
After knowing all of these the question arises, is Micro Service architecture is the best? Should Every App has to adopt to it ?
The answer is NO : Architecture of every platform greatly varies depends upon the needs of the platform. Micro Services approach is suitable for highly scalable systems, however for smaller platforms having multiple apps under same platform is suitable.
API Gateway and Need of API Gateway in Platform Architecture
But for any platform the most important Managing the API Calls, what I mean here is there should be something in between clients and various services which will receive incoming requests, invokes various apis and return the appropriate results.
Also any backend platform should keep track of Api calls, rate limiting – it is defining the rate at which consumer can access apis, limit the number of api calls per second per user or per app, throttling – is controlling usage of apis for consumers for a given period of time, securing apis through api keys and user authentication.
in platform architecture API Gateway is like front facing for incoming client requests. Apigee is one very popular api gateway, however it is suitable for enterprise and big applications, for small apps and startups where one can’t afford Apigee, they can go for other API Gateways like Google Cloud End Points but it has very limited features OR Kong API gateway.
Boosting your Client Apps Performance and Stability by Adopting GraphQL
GraphQL is a query language for APIs, it is like giving control to clients/apps to fetch what exactly they want rather than decided by server.
Ask for What you need and Get exactly that 🙂
Send a GraphQL query to your API and get exactly what you want
<code>//GraphQL Query to API
//This will be input to your API and you will get only that in //response quickly
name: 'Micro Max G6',
price: '6599 Rs'
Get Multiple Information in Single Request
GraphQL will make your apps lightning speed which even out perform greatly in slow network speed as well, because GraphQL is powerful and returns multiple information in single request, which apps typically get it from different api calls.
There are multiple bunch of benefits of GraphQL and its worth to consider using GraphQL while architecting your Platform. Well where GraphQL fits in your platform architecture ? See the updated architecture diagram
There are many ways to design the platform architecture, however every platform has its own unique requirements. The architecture of every platform can vary totally to meet the needs of respective platform.
There are many case studies to look into platform architecture which I will cover in different article, we can look into linked-in, ebay, Amazon and netflix architectures to get better understanding on Platform architecture.
For now in this article we will understand first approach that Having Multiple Apps with its own independent Database and Backend. For our understanding purpose we will consider designing a platform for an Amazon Kind of Online Shopping Platform
Platform Architecture for Amazon Kind of Online Shopping Platform with Multiple Apps Approach
If you consider Amazon kind of Online Shopping Platform, we first have to identify which are the different huge modules which are candidates for making it as a separate app altogether
Sellers or Vendors who sell the products
Seller is the one who has his shop and sell products in amazon
He should be able to add his products
He should be able to manage discounts, offers for his products
He should be able to dispatch his product
He should be able to manage his revenue/profit and other finance aspects
The one who buy products in Amazon
He should be able to manage his Cart
He should be able to manage his delivery addresses
He should be able to do payment using his choice of payment mode
Product Dispatch Management
Tracking the product while dispatching from one place to another
Every city has a collection centers and products has to be managed for timely delivery
Products Delivery Management
Once product is reached the destination city it has to be picked by delivery person
Assign delivery person
Deliver to customer and update the status
receive cash in case is Cash-On-Delivery
Amazon Finance Management
This is kind of Super Admin Functionality
managing failed transactions
Transferring money to Seller
I listed only few functionalities however there will be many more under each of these main features.
Why Can’t be its one super big Monolithic Application ? Rather than multiple Apps ?
To answer this question we have to think of following important aspects which we covered in our first Article Which are as follows
Scalability : For Amazon Kind of Applications, millions of requests will be coming every second. There are millions of users buying and millions of sellers selling and millions of products listed, millions of transactions happening. It is highly impossible to handle everything in one huge monolithic server, because every server has some upper limits with respect to hardware and capacity, one huge database to scale it to that level we have to divide it into multiple pieces and manage it independently.
Maintainability: It is very hard to maintain one huge monolithic app for such a huge volume.
Resilient: Any major update to particular part of the platform should not affect to other parts of the platform
Development: For amazon kind of huge platforms, they have huge team spread across the world and each teach is enhancing their own module by doing lot of research within their small team. It is not possible to manage development activity effectively if its one huge monolithic app
Now let us see how the Architecture Diagram looks: You can use various apps for designing Architecture Diagram
In the above diagram, each app is one server and it has its own database. There are third party services used commonly across many apps, like
Elastic Search Service : For faster product search, Elastic Database is must for better searching capability.
Cloudinary is another service used for multi media file handling
Authentication service is like firebase, auth0 for user authentication
Many more such services will be used
Advantages of Multi Application Platform Architecture
Scalability: In this architecture the platform is scalable to handle high traffic, because during peak time like Amazon big billion day, more and more people will buy products, the traffic will be too high for Consumer App. So in that case if its independent server by itself, we can increase the capacity of that server alone to handle millions of requests, however other apps may not need so much so at this stage.
A platform architecture is an abstract high level design of the platform that answers to some of the key important factors of any platform like scalability, resilience, maintainability. It should cover almost all important big modules, multiple apps, all the servers, databases, caching, third party solutions and etc.
A platform should be ever evolvable, should be able to adopt to the new changes and needs of the platform and it helps to meet all technical and operational requirements with focus on optimising performance and security.
Desirable Properties of Platform Architecture
High level of Abstraction – It should be simple enough and comprehensive enough to get high level of understanding
Resilient – Each major module (app) should not be get affected so much due to one defective app
Scalable – Architecture should consider the scalability of the platform “Scalability” refers to the number of users, sessions, transactions, and operations that can be accommodated by the entire system
Maintainable – Should be able to make changes to any part of the system without breaking or damaging too much to other parts
Ever Enhancing – it should be able to evolve every-time when there is a need of change
Important Aspects to focus on while designing platform architecture.
How many servers we need to maintain, is it per app level or every major functionality
How caching is handled in platform
API Gateways for API security, metering, throttling
Searching functionality within the platform
Users and Identity Management
Third Party Services if any
Data query and Manipulation for faster data access like using GraphQL
Communication between each apps or each servers using event queue, event bus or intermediate app whichever way it is
Handling batch processes using cronjobs or cloud functions