(a) Introduction to Compute
(a) Introduction to Compute
COMPUTING CONCEPTS
WHAT IS COMPUTE?
Client-Server Three-Tier
Computing Architecture
Distributed system
–Wikipedia
• There are several autonomous computational entities, each of which has its own
local memory.
• The entities communicate with each other by message passing.
▪ Characteristics:
▪ - Resource sharing
▪ - Scalability
▪ - Heterogeneity
Characteristics:
▪ Separation of Concerns: Each layer handles specific responsibilities, making the
system easier to manage and maintain.
▪ Scalability: Each layer can be scaled independently to handle increased load.
▪ Flexibility: Changes in one layer don’t affect the others, facilitating easier updates
and maintenance.
Example:
❖Presentation Layer: The user interface, typically a web browser or mobile app.
❖Business Logic Layer: The server-side application logic, often running on a web
server.
❖Data Access Layer: The database server that stores and retrieves data.
WHAT IS WEB SOCKET AND HOW IT’S DIFFERENT FROM HTTP?
▪ HTTP and WebSocket both are communication protocols used in client-server communication.
▪ HTTP protocol: HTTP is unidirectional where the client sends the request and the server sends
the response.
▪ Let’s take an example when a user sends a request to the server this request goes in the form of
HTTP or HTTPS, after receiving a request server send the response to the client, each request is
associated with a corresponding response, after sending the response the connection gets closed,
each HTTP or HTTPS request establish the new connection to the server every time and after
getting the response the connection gets terminated by itself.
▪ HTTP is a stateless protocol that runs on top of TCP which is a connection-oriented protocol it
guarantees the delivery of data packet transfer using the three-way handshaking methods and re-
transmits the lost packets.
▪ When a client sends an HTTP request to the server, a TCP connection is open between the client
and server and after getting the response the TCP connection gets terminated, each HTTP request
opens a separate TCP connection to the server, for e.g. if the client sends 10 requests to the server
the 10 separate TCP connection will be opened. and get closed after getting the response/fallback.
WHAT IS WEB SOCKET AND HOW IT’S DIFFERENT FROM HTTP?
WHAT IS WEB SOCKET AND HOW IT’S DIFFERENT FROM HTTP?
▪ WebSocket is a computer communications protocol, providing a simultaneous two-
way communication channel over a single Transmission Control Protocol (TCP)
connection.
▪ WebSocket is bidirectional, a full-duplex protocol that is used in the same scenario of
client-server communication, unlike HTTP it starts from ws:// or wss://. It is a stateful
protocol, which means the connection between client and server will keep alive until it is
terminated by either party (client or server). After closing the connection by either of the
client and server, the connection is terminated from both ends.
▪ Let’s take an example of client-server communication, there is the client which is a web
browser and a server, whenever we initiate the connection between client and server, the
client-server made the handshaking and decide to create a new connection and this
connection will keep alive until terminated by any of them. When the connection is
established and alive the communication takes place using the same connection channel
until it is terminated.
▪ This is how after client-server handshaking, the client-server decide on a new connection
to keep it alive, this new connection will be known as WebSocket.
WHAT IS WEB SOCKET AND HOW IT’S DIFFERENT FROM HTTP?
▪ Once the communication link establishment and the connection are opened, message
exchange will take place in bidirectional mode until connection persists between client-
server.
▪ If anyone of them (client-server) dies or decide to close the connection is closed by both
of the party. The way in which socket works is slightly different from how HTTP works,
the status code 101 denotes the switching protocol in WebSocket.
WHAT IS WEB SOCKET AND HOW IT’S DIFFERENT FROM HTTP?
WebSocket Connection HTTP Connection
WebSocket is a bidirectional communication
The HTTP protocol is a unidirectional protocol that
protocol that can send the data from the client to the
works on top of TCP protocol which is a connection-
server or from the server to the client by reusing the
oriented transport layer protocol, we can create the
established connection channel. The connection is
connection by using HTTP request methods after
kept alive until terminated by either the client or the
getting the response HTTP connection get closed.
server.
Almost all the real-time applications like (trading,
monitoring, notification) services use WebSocket to Simple RESTful application uses HTTP protocol
receive the data on a single communication which is stateless.
channel.
When we do not want to retain a connection for a
All the frequently updated applications used
particular amount of time or reuse the connection for
WebSocket because it is faster than HTTP
transmitting data; An HTTP connection is slower than
Connection.
WebSockets.
REMOTE PROCEDURE CALL (RPC)
▪ A remote procedure call is an interprocess communication technique that is used for client-server based
applications. It is also known as a subroutine call or a function call.
▪ A client has a request message that the RPC translates and sends to the server. This request may be a
procedure or a function call to a remote server. When the server receives the request, it sends the required
response back to the client. The client is blocked while the server is processing the call and only resumed
execution after the server is finished.
▪ The sequence of events in a remote procedure call are given as follows −
✓ The client stub is called by the client.
✓ The client stub makes a system call to send the message to the server and puts the parameters in the
message.
✓ The message is sent from the client to the server by the client’s operating system.
✓ The message is passed to the server stub by the server operating system.
✓ The parameters are removed from the message by the server stub.
✓ Then, the server procedure is called by the server stub.
*** Client stub and server stub are pieces of code that convert parameters during a remote procedure call.***
REMOTE PROCEDURE CALL (RPC)
REMOTE METHOD INVOCATION (RMI)
Java API for object communication over a network.
▪ There are some tasks which are performed by the server program i.e., to creates some
remote objects, to make references to this objects and also wait for the clients so that they
invoke methods on these objects.
▪ A client program obtains a remote reference to one or more remote objects on a server and
invokes methods on them. Basically, RMI provides the mechanism through which server
and client can communicate and pass information back and forth.
▪ The RMI consists of three layers :
• Stub/Skeleton layer
Example: Java distributed computing tasks.
• Remote Reference layer
• Transport layer
REMOTE METHOD INVOCATION (RMI)
MESSAGE QUEUES AND MESSAGE BROKERS
Message Broker
• Type: Middleware system
• Use Case: Facilitating communication between different applications, systems, or services
• Core Features: Routing, transformation, and integration of messages
Message Queue
• Type: Form of message broker or a component within a message broker
• Use Case: Managing and maintaining the order and delivery of messages
• Core Features: Temporary storage and management of messages until they are processed
Differences
Integration Integrates diverse protocols and formats Typically specific to a certain protocol or system
Designed to handle high throughput and Scalable but mainly in the context of message
Scalability
diverse workloads storage and delivery
Can perform complex transformations and Focused on reliable message delivery without
Flexibility
apply business logic transformation
Suitable for complex enterprise systems Ideal for scenarios where order and delivery
Use Case
requiring integration guarantees are critical