Geek Culture
Published in

Geek Culture

System Design-I

A system is a set of components clubbed together to fulfill different kind of users and their requirements. Design is the process of selecting services/components etc. Designing a system is generally based upon he user base, type of product etc. For example large scale systems like Facebook, Viber etc have huge scaling capacities. They are designed to expand drastically with minimal efforts and maximum customer satisfaction. The intuition of designing a system comes with experience but kicking off from somewhere, so the basic components of a system are usually entities. They are tangible things which make up a system. Broadly speaking, entities are of two types:-

1. Logical entities

2. Tangible entities

Logical entities are made up of databases, applications, communication protocols (tcp/udp etc), https requests like REST, Soup. All these components run on a system or platform and actually come under system requirements. To be precise things like Cache, messageQueues, infrastructure etc.

Photo by Kelly Sikkema on Unsplash

Tangible entities are those which provide bulk to the logical entities. They are software/databases etc which fulfills the above. Eg:- Redis, mysql, RabbitMq, API’s etc.

A system is a fully functional structure which is made up of complex things like databases, servers, environment, proxies etc. than. Deeply diving into few of these concepts, a system consist:-

· Client-Server architecture: — As the name suggests, client and server are the two parts of any system. Client is responsible for creating requests etc whereas server is responsible for processing. These two works together to form a fully functional application. However it’s important to note two terminologies: -

Ø Thin client:- A client or rather a system in which bulk of processing occurs at the server side is called a thin client. Eg- Netflix

Ø Thick Client:- A client or rather a system in which bulk of processing occurs at the client side is called a thin client. Eg- Outlook, Gmail etc

Client server architecture can be of various types depending upon the requirement and one such type is N-tier architecture. Systems where data is huge and it’s not feasible for server to do everything, usually uses N-tier architecture. Client-server architecture is broken into multiple parts and processing units/logic units are organized to process bulk of data.

· Proxies:- A proxy is basically a system/machine which talks to the server on behalf of a client or vice versa. It’s usually used to reduce the effort of communicating b/w client and server. Proxies can be of two types:-

Ø Forward proxy:- These proxies are used by clients to communicate with servers. All the traffic b/w client and server would first pass from proxy and then to the server. This is usually done to block client access to certain sites, forming a firewall for client because accessing server, traffic monitor etc.

Ø Reverse Proxy:- Here, the proxy sits for server and acts as a middle man for the server. The client doesn’t know about the IP of server. Any requests of client pass through proxy and then to server. Similarly, any response first goes to server. This is very useful in cases like load balancing, deflating DDos attacks etc. Reverse proxies can become a bottleneck in case if they fail. How? Servers will be directly expose to client and hence are vulnerable to cyber attacks etc.

· Data and Data flow: — Data is the information which flows through systems. It’s a pretty famous term but the important thing here is understanding what type of data flows through what type of layer or application. Eg:- In Tcp/Udp packets flow etc. Futher understanding type of storage facility is also important. Eg:- Frequent request/response should be stored in cache etc. Flow of data b/w the devices also needs to be taken to consideration. Further, storage strategies like security, type, volume of data etc, should also be factored into the design for a system.

· Applications/Services: — Skipping the obvious basics of the terms, development of an application mainly requires considering the following:-

v Requirement of the application. Eg:- building a shopping mall

v Layer of interaction i.e. webapp, android app etc.

v Tech Stack based on layer of interaction, eg:- android is java/kotlin etc

v Code structures/ design patterns

v Consideration about Data store interactions i.e. communication b/w client and db

v Performance and cost

v Deployment

v Monitoring and logging

v Reliability

· Caching:- Caching is the process of temporarily storing data in memory storages called cache. Caching is usually done when we have data which is accessed frequently by a user or set of users. Moreover, caching reduces the memory cost in terms of db access and algebraic/other computations. Caches also undergo process of cache validation and invalidation.

Caching in real world systems follow certain patterns to optimize it’s performance. Cache-aside strategy is one such method where the cache only communicates with the server or client and doesn’t have anything to do with the storage or database.

Second strategy is read-through cache. Here cache sits b/w server and database. The server can only contact the cache and not to the database. There are many such patterns which can be known from here.

· Scaling:- Suppose we have a restaurant having maximum capacity as 10. In busy season or in case of a holiday the crowd may increase two-fold or three-fold in the restaurant. In such case, the restaurant owner needs to increase his capacity in order to server the new requests. This process of increasing the current capacity according to the demand is called scaling.

Now in order to scale he can do two things, he can increase more chairs per table or he can add more number of tables or both. The first one is called vertical scaling and the latter one is called horizontal scaling. Technically speaking, vertical scaling occurs when we increase the current capacity of the existing resource and horizontal scaling occurs when we increase total number of resources.

Scaling can be both horizontal or vertical based on the requirement. There are many technical differences b/w the two but generally speaking, vertical scaling is be better if the demand can be handled by twerking existing resource or the resource can be able to hold the scale. Horizontal scaling is better where the above fails or where the demand is much more. Always, cost, flexibility and performance are the factors which dictate these things. For more details, you can hop on to here.

So the above are few basic things which are kind of needed and very useful to know in case you are going to learn system design. Although apart from the above, there are three terms which might be helpful to know. First is load balancing where we distribute the load of a server to other sub servers. Second are message queues. Message queues are basically carriers which are used to carry data packets from one microservice/server to the other. Apart from message delivery, they can also queue requests from one server to other and can also help to detect service failure/ breakdown or service latency etc. Third are the pub/sub models which are commonly called publisher and subscriber models. Pub/sub models are used mainly in case of microservices where we can subscribe a client to listen to a server in case it publishes any response.

Of course, there are many other components/things which might be needed but they can be learned as we go along knowing things and terms in the learning curve.

Thanks for reading! Hope you enjoyed the article and look forward to part 2 of this article where we talk about a system design of an existing system.

Also, subscribe to my page to get my articles straight to your mailbox.. :)

--

--

--

A new tech publication by Start it up (https://medium.com/swlh).

Recommended from Medium

4 Overlooked Aspects Required for a Successful Product Requirements Document

Prologue to Prolog

Covid 19 and the mobile Disney World application.

7 Simple Ways to Improve Website and Database Performance

Random Thoughts on Building APIs

Top 10 Java frameworks You Should Know In 2021

Monolithic, SOA, Microservices, Serverless and API REST

Learning How to Learn — A guide to navigating a self-paced coding bootcamp

picture of lightbulb illuminating a book

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nikhil Bhatnagar

Nikhil Bhatnagar

A tech enthusiast who loves to read and write about new technologies and trends.

More from Medium

[Leetcode] Design Add and Search Words Data Structure

Heap Data Structure

Design Patterns — Prototype Pattern

Interview Question 7 - Popular Interview Question