Distributed Computing

Real Examples

REAL EXAMPLE: MongoDB, Apache Kafka

C++ libs: MQTT (Message querying elementary transport)- mosquitto

Distributed Systems

Distributed System - is a network of computers that communicate with each other in order to achieve a certain goal

Messages – pieces of information transferred from one computer to another over a network,

tell other computers to execute procedures with particular arguments,

send an receive packets of data

Different types of distributed system

Client/Server Systems

A way of getting a service to run on a central source.

Clients make requests, the server then serves those requests, and makes a response, so that the client can do a certain task.

Example: A browser requesting for a webpage off the website server, the website server will respond by sending the (HTML and CSS...) and the browser will then show the user that page.

OR your mouse and keyboard to your program (client)

Server - a unit that provides a service, possibly to multiple clients simultaneously

Client - a unit that consumes the service

The clients do not need to know the details of how the service is provided, or how the data they are receiving is stored or calculated, and the server does not need to know how the data is going to be used.

Disadvantage

Peer-to-Peer Systems

Peer-to-Peer - a network where all systems have equal labour divided between them

Advantage

Master Slave

Master node has complete information about the system and controls the decision making.

Message Passing

Content

  1. Sender - so the recipient knows who it was sent from
  1. Recipient - so other computers on the network knows who to send it to
  1. Content - data, signal, instructions

Architecture

  1. In the messaging passing architecture, publishers publish messages into topics that can be subscribed by multiple subscribers.
  1. Each device in the network can have one or more subscribers and publishers.

For example, a smart camera may publish the image frames into a topic and subscribe to the configuration parameters (e.g. resolution, speed, etc) from a different topic.

The message passing architecture only requires a message broker that is responsible manage the messages being published into the topics.

  1. sender and recever are identified
  1. sender and recever are encoded into the message
  1. data also attached
  1. dispatch function then sends the message over the network

Message Protocol - set for rules for encoding and decoding messages

Messsage Protocols are not typically a lib, but just a set of rules

CAP Theorem

Defining the constraints on a distributed system in terms of the attributes that can guarantee. Essentially a distributed system cannot have all three.

Consistency – every read receives the most recent right or an error

Availability – every read receives a non-error response even if it may not be the most recent wright

Petition tolerance – the system continues to function even if a part of the network fails

Cons of Distributed

  1. Has to choose between consistency and availability
  1. Data Distribution: complex algorithms to efficiently partition data and later combine the data
  1. Coordination: complexe protocols to coordinate

Cloud vs Distributed

Distributed

  1. Spreads tasks across many machines
  1. Aims to create a clubs resource sharing and providing size and geographical stability

Cloud

  1. Uses network hosted service for storage, processing and data management
  1. Cloud computing is about delivering and OnDemand environment using transparency, monitoring and security
  1. Is less reliable since relies on other services, thus giving you less control

Decentralised vs Distributed

Decentralised - Distributed on a technical level, but usually decentralised system is not owned by a single source

Therefore it is harder to manage a decentralised system, Since you can't manage all the participants

Distributed dash single course design where one tram/company owns all the

Benefits of a Distributed system

Scaling – distributed system allows you to scale horizontally so you can account for more traffic (baso you can put machines in parallel, and not have to replace the entire system (vertical))

Modular growth – there is almost no cap to how much you can scale

Fault tolerance – distributed systems are more fault tolerant than a single machine

Cost-effective – the initial cost is higher than a traditional system, but because of their stability, they quickly become more cost-effective

Low latency – uses have a node in multiple locations, so traffic will hit the closest node

Efficiency - distributed systems break complex data into small pieces

Parallelism – multiple processes divide up into a complex problem into pieces

Deficits of a Distributed system

Failure handling – since multiple processes are running the same function, if one function fails the others will carry on running, this is good if you are doing a large data set and don't want the entire system to fail, but is a pain in the arse when troubleshooting

Concurrency – there is an issue when several clients attempt to access the same shared resource at the same time, must ensure that all resources are in a safe concurrent environment

Security issues – data security and sharing have increased risks and distributed to computer systems, the network has to be secured and users must be able to safely access replicated data across multiple locations

Higher initial infrastructure costs – it is cheaper to vertically increase the size of a system at first, but eventually it is cheaper to upgrade horizontally