Four Distributed System Architectural Patterns
Four Distributed System Architectural Patterns
Four Distributed System Architectural Patterns
Modern 3-tier
Sharded Architecture
Simple architecture
Fix the issue and delay, we can shard the Application server. We can divide the application server based
on the services and have a router which will route the requests from client to respective application
server.
SLACK is build using this architectural pattern.
We usually have database in master-replica format and have some layer to manage the configuraton.
For example, we can have “zookeeper”.
Zookeeper : selects the master, lead balance the reads and writes.
Now suppose the link between the replicas and master goes down.
The replicas which have lost the link with master will request zookeeper(shown at bottom left) to elect a
new master.
Now suppose the links are back and then there will be one replica pointing to 2 Masters and that will
cause a havoc.
Sharding must be decided upfront and difficult to reshard later. Few systems provide dynamic sharding.
Client isolation is easy(data and deployment). Example, usually messenger server are asked to
have their data centers in Same country.
Known, simple technology.
Weakness
Complexity: monitoring and logging in distributed is difficult
No comprehensive view of Data (ETL process is required to mine the data since we have
multiple DBs)
Oversized shards: Shard become big overtime.
Lambda architecture
Lambda make this distinction between streaming data and batch data.
Batch data: where the data is stored at certain place. We address that data by that place ex. File, DB.
Bounded data.
Lambda architecture assumes unbounded, immutable data. Usually events are immutable data and
unboundable.
We can have bounded analysis and Unbounded analysis. In bounded analysis the events are stored in a
DB and since the its stores the data for long time the volume increases and thus process them will take a
lot of time.
For an runtime analysis, we can have in temporary storage (some kind of queue). The data in that case is
unbounded data and we can have the analysis done at a fast rate because it’s a temporary storage.
Both the types can be connected to Cassandra at the backend to provide additional functionality
missing.
Combined:
KAFKA
In kafka we have producer, consumer and topics(named queues of Messages).
A topic lives on broker, a broker just a server running kafka. Topic can also be partitioned.
Because the message/data can increase.
In case the data/message increases, we need to have cluster to handle the topic.
Topic portioning
Let’s the topic is portioned in 3 brokers/servers.
Producers on right, Consumers on left.
Let’s suppose that the producers the generating massages.
We can look at some portion of message(accont id, ip address. etc) and hash the part and using
that hash we pump the message in topic.
After the messages are geneteared from different producers, they are pushed to topics.
Strength of Lambda
Weakness
It’s not a general purpose framework, its for analysis and logging.
Streaming Architecture