System Design Basics
When we are building any system in large scale that time system design is more important. In system design we have to take care of some things. like,
- What different component that can be used in architecture?
- how this component work with each other?
- How can we best utilise these components?
Key Characteristics of Distributed Systems
Key characteristics of a distributed system include Scalability, Reliability, Availability, Efficiency, and Manageability. Let’s look into it.
Scalability
Scalability is the property of a system to handle a growing amount of work by adding resources to the system. Scalability depend on how much request will system have to handle. like if system is for how much users or it is also depend on some scenario like for E-commerce system on festivals requests will be more so that time system need more resources then normal days. so, on that bases resources will be added or removed. Prioritising it from the start leads to lower maintenance costs, better user experience, and higher agility.
- Horizontal Scaling
- Scaling horizontally (out/in) means adding more nodes to (or removing nodes from) a system, such as adding a new computer to a distributed software application. An example might involve scaling out from one web server to three.
- Load balancer required.
- Resilient. i.e. If one of the machine fail, the request can be redirected to other machines.
- Network calls between two services. it will slow down system.
- Here, data is complicated to maintain. so, here data consistency is a real issue.
- It scale well as users increases.
2. Vertical Scaling
- No load balancar required.
- Single point of failure.
- Inter Process communication happen so it will be faster.
- Data is consistent here. because there is just one system on which all the data resides.
- There is hardware limit.
The hybrid solution is essentially the horizontal scaling only where each machine has a big box. Initially, you can vertically scale as much as you like. later on, when users start trusting you, you should probably go for horizontal scaling.
Reliability
Reliability is the probability that a system performs correctly during a specific time duration. During this correct operation:
- No repair is required or performed
- The system adequately follows the defined performance specifications
Take the example of a large electronic commerce store (like Amazon), where one of the primary requirement is that any user transaction should never be canceled due to a failure of the machine that is running that transaction. For instance, if a user has added an item to their shopping cart, the system is expected not to lose it. A reliable distributed system achieves this through redundancy of both the software components and data. If the server carrying the user’s shopping cart fails, another server that has the exact replica of the shopping cart should replace it.
For achieving reliability we need replica of server which produce redundancy. Obviously, redundancy has a cost and a reliable system has to pay that to achieve such resilience for services by eliminating every single point of failure.
Availability
Availability is the percentage of time in a given period that a system is available to perform its task and function under normal conditions. One way to look at is how resistant a system is to failures. The percentage of availability that a system requires depends on the business logic or usage of the system.
Air Traffic Control systems are among the best examples of systems that require high availability. In today’s world, where air travel is so complex and busy, a single error in directing airplanes can lead to catastrophic results. In contrast, a system with few visitors and not prone to catastrophic failures require slightly lesser available systems. High Availability comes with a cost, so we have to optimize according to our needs.
A system’s availability is measured as the percentage of a system’s uptime in a given time period or by dividing the total uptime by the total uptime and downtime in a given period of time.
Availability = Uptime ÷ (Uptime + downtime)
Reliability Vs. Availability
Reliability: Is any thing broken? and Availability: Is the system still available to the user?
If a system is reliable, it is available. However, if it is available, it is not necessarily reliable. In other words, high reliability contributes to high availability, but it is possible to achieve a high availability even with an unreliable product by minimizing repair time and ensuring that spares are always available when they are needed.