Q1: What are the main goals for system design in software engineering and computer science?
Answer: The primary goals of any system design are scalability, reliability, and maintainability. Other system design goals include security, performance, cost-effectiveness, enabling collaboration and communication across teams and components, and reusability of components.
Q2. What is scalability?
Answer: Scalability means scaling a system to tackle more workload. A weather application handling five users today should be able to operate efficiently without any speed problems when demand increases to 5000 users. Also, it should be able to downsize when it requires to handle fewer user requests.
Q3. What is single-server design?
Answer: When a single server, possibly with multiple processors in it, handles all the aspects of an application or all the requests from the clients, it is called single-server design.
Q4. What are the problems with single-server design?
Answer: The main problem is a single point of failure and lack of backups. Other problems with the single-server design are limited scalability, downtime during maintenance or updates, lack of isolation in case of security issues, contention of resources, and inefficiency in resource utilization.
Q5. What are the simplest steps in scaling a single server as a first step?
Answer: The minimal steps that can be taken to scale a system include vertical scaling, i.e., increasing the number of CPUs or going for higher-performance components in the hardware. Another simple step is to separate the individual components in your application, such as the web server, database, and other components. And increase the particular systems used for each component to higher configurations.
Q6. Will vertical scaling avoid all the problems in scalability for single-server design?
Answer: No, the problems of single-server design discussed in previous sections will remain in vertical scaling. The specific component, such as a database and web server, is still a single server handling all the requests. However, robustness may cause fewer issues than a less vertically scaled system.
Q7. What is the meaning of stateful and stateless?
Answer: Systems, components, and servers are stateless or stateful. For example, HTTP or REST API is primarily stateless. This means processing any request can be done without information or knowledge of previous transactions. Consider FTP or session-based web applications. Processing any request must be done only after an earlier request or need information on what happened before.
In system design, we create as many components as possible as stateless so that we can scale the processing servers as and when needed, as each transaction can be processed in parallel.
Q8. What is the first step that is used for scaling in System Design?
Answer: The basic step is to see an opportunity for using a Load Balancer and have requests sent to multiple processing servers. These servers can be increased or decreased based on the number of requests and workload. This is possible, particularly if the requests are stateless. This is called Horizontal Scaling.
However, Horizontal Scaling is the only go-to solution for many cases. We need to see what keeps everything simple, cost-effective and what is the requirement. Vertical scaling or no scaling, a mix of these scaling techniques, can be the need of the system design.
Q9. Can you give some characteristics based on which we can decide on horizontal scaling, vertical scaling, and no scaling?
Below are some guidelines to consider on deciding on horizontal scaling, vertical scaling, and no scaling. Again, a system might contain a mix of these, but at the individual component level and system level, these are some guidelines.
|Vertical Scaling||The application cannot be parallelized.|
The current server has room for an increase in CPU, RAM, or room to upgrade.
The current server is underutilized.
You understand the cost will increase beyond a limit, and you are clear about the limit after which to stop.
|Horizontal Scaling||The application can be easily partitioned and parallelized.|
The ratio of Computation parallelization vs. communication bottlenecks is minimal.
You understand there can be initial costs, but it is a long-term plan.
The components of the application – compute servers, database servers, and routing servers, can be easily deployed on the cloud, can be containerized, and are easy to scale.
|No scaling||When there is no extra workload, it just needs maintenance.|
You need a budget and resources to maintain more than a single server.
Q10. Is it true that we do not need to know any system design using cloud services such as Amazon, Azure, or Google?
Answer: False. These cloud services allow some amount of systematic organization of the VMs, Kubernetes clusters, networks, and databases based on your requirement. However, you still need to plan the entire design, requirements and planning for upcoming years yourself.