MVC Design:
-
Advantage:
- Easy to debug
- Easy to deploy
-
Disadvantage:
- very difficult to scale. Each request is handled by the server and one page can have many requests which will consume lots of server resources
- whenever there is a server issue, entire site goes down
- deployment goes with both front end or backend end
- Health Checks make sure that our actual server is still up and running
- Routing forwards a request to the right endpoint
- Authentication makes sure that a user is actually permitted to access the server
- Firewalling ensure that users only have access to the parts of our network they are allowed to use ... and more
- Reverse Proxy can act as load balancer
How to ensure data consistency:
- Master/Slave setup or Write with Read-replicas: split into multiple parts where each part does its own thing
- each service can be scaled individually, enabling us to better adjust to demand
- development teams can work independently, each being responsible for their own microservice's lifecycle (creation, deployment, updating etc.)
- each microservice can use its own resources
- cache the static content
Advantages:
- it decouples tasks and processors. Sometimes a lot of images need to be processed, sometimes only a few. Sometimes a lot of processors are available, sometimes its just a couple. By simply adding tasks to a backlog rather than processing them directly we ensure that our system stays responsive and no tasks get lost.
- it allows us to scale on demand. Starting up more processors takes time - so by the time a lot of users tries to upload images, it's already too late. By adding our tasks to a queue we can defer the need to provision additional capacities to process them
- Sharding can be based on any number of factors, e.g. letters, location, usage frequency (power-users are routed to the good hardware) and so on.
- You can shard servers, databases or almost any aspect of your stack this way, depending on your needs.
- DNS (Domain Name System): allows us to specify multiple IPs per domain name, each leading to a different load balancer.