Web Application + Software Architecture Flashcards
What is Web Architecture?
Multiple components (DBs, message queue, cache, UI) all running in conjunction to form an online service
What is Client-Server Architecture?
Fundamental Building Block of the Web
Request-Response model - Client sends request to server for info, server responds with it.
What is a Thin Client?
Client that Just holds the UI of the app. No business logic. No business Logic.
For every action, client sends request to backend (just like 3-Tier App)
What is a Thick/Fat Client?
Holds all or some part of the business logic + the UI
When to use Thick Client?
When we need to minimize the network latency and reduce network calls to backend server. Keeps latency of the app low.
Need to reduce bandwidth consumption in the client server for a smoother user experience. Enhances user experience, reduces latency.
What is a web server?
A component in web application infrastructure.
Receives requests from client and sends response AFTER executing business logic, based on parameters sent from the client.
What is an application server?
A server running a web app.
Every service needs a server to run.
List some types of web server based on their core task
Proxy Server
Mail Server
File Server
Virtual Server
Data Storage Server
Batch Job server
What is a Request-Response Model?
Client and servers have a request-response model…no request, there is no response.
What is the HTTP Protocol?
Protocol for data exchange over World Wide Web.
Stateless protocol. Every request independent, has no knowledge of previous
What is a REST API?
Representational State Transfer - Architecture Style for building web services
What requirements do APIs need to adhere to in order to be REST compliant?
API must act as an interface
API must provide communication between client/server over HTTP Protocol
Communication must be stateless - every new request is completely independent of the last/next
API must send Auth info with every request
What is HTTP PULL data transfer between client and server?
Client sends request to server. Client pulls data from server whenever required. Done over and over to fetch latest data.
What is HTTP PUSH data transfer between client and server?
Keeps the server from being brought down by excessive HTTP requests. Uses Callbacks to to allow server to keep sending updates to clients when they’re available
What is a Callback for the HTTP Push Mechanism?
Mechanism for client to send request for certain info once. After the first request, server keeps pushing updates to client once they’re available.
Benefit of HTTP PUSH?
Saves network bandwidth. Cuts down load on server
Examples of HTTP PUSH Implementations?
AJAX Long Polling
Web Sockets
HTML5 Event Source
Streaming over HTTP
Message Queues
When to use HTTP PUSH?
Real-time applications like online multiplayer games, a LIVE sports app, etc
When we need to reduce the number of client requests hitting the server every now and then, checking for new information.
What are 2 ways of pulling data from Server over HTTP?
Triggering and event on the UI to send a request
Pulling dynamically at regular intervals without any human intervention (using AJAX)
What is AJAX?
- Asynchronous JS and XML -
- Adds asynchronous behavior to web page.
- Polls server repeatedly every X unit of time
- On receipt of the data, the segment of the page is updated dynamically bye the callback method (without the page reloading)
- Uses XMLHttpRequest object to send requests
What are Heartbeat Interceptors?
These are blank request responses between the client and server to prevent the browser from killing the connection.
Keeps the connection between client and server open
What are websockets?
Persistent, bi-directional, low-latency data flow communication between client and server. Think of it as an ongoing conversation.
Can keep a client-server connection open as long as we want.
Runs over TCP, not HTTP. Server + Client should support web sockets.
What are some use cases for websockets?
Use Cases: chat apps, real-time social streams, browser-based massive multiplayer games. Each use significant number of read writes compared to regular apps.
WHat is AJAX - Long Polling?
Instead of immediately returning empty response, server holds the response until it finds an update to be sent to the client
Connection stays open longer compared to polling.
Can be used for simple a sync data fetch where you do not want to poll the server
What are Server-Sent Events?
PUSH tech - Server automatically pushes data to client when updates are available. Incoming messages from server are treated as events.
Ideal for Real-time feeds (twitter), Stock Quotes in UI, Real time notifications.
What are some benefits of Server sent events?
Cuts out large number of blank Request-Response cycles.
Reduces Bandwidth consumption
How do Server Side events work?
Client establishes connection with initial request, then server initiates data transmission (Using HTML5 Event-Source API)
Server automatically pushes data to client when updates are available. Incoming messages from server are treated as events.
Streaming over HTTP Use
Ideal for streaming extensive data over HTTP by breaking it into smaller chunks
Used for streaming multimedia content (large images, videos etc) over HTTP