COE 558Lecture 01Part 04
The Web and network applications
The Web as one network application, decentralized versus distributed designs, the two-dimensional design space, and the request-response loop.
- Concepts
- 5
- Slides
- 30-39
- Reading
- 30 min
Why this part matters
Part 03 described the Internet as plumbing: a stack of layers that moves bytes between machines. This part climbs to the top of that stack and asks what people actually build on it.
Every edge or cloud system you will study or design for your research is a network application whose server side has been cut into components. The story here runs in one line: an application uses the Internet, its server side is really several components, each component can be placed on a different layer and resource, and every request a client sends makes those components spend compute, storage and communication. The central question, which component goes on which layer and why, is the core question of edge computing research and a very likely exam question.
By the end you can
- Explain why the Web is one network application on the Internet, and sort any app by the protocol it speaks.
- Use the lecture's definitions of decentralized and distributed correctly, and name your definition when papers disagree.
- Break a server side into components and place each one in the design space as a layer choice plus a resource instance.
- Justify a placement with latency, compute, storage, cost, privacy, sharing and availability.
- Separate the logical HTTP conversation from the physical path of bytes through sockets and the TCP/IP stack.
- State who starts the request-response loop and what each response costs the server.
Picture two things you do before lunch. You open a KFUPM page in a browser. Then your mail program hands a message to the KFUPM mail server over SMTP. Both need the Internet. Only the first one is the Web. Getting this distinction right is the first step to thinking clearly about applications.
Infrastructure and the services built on it
The Internet is the infrastructure: the TCP/IP stack, the routers and the providers that carry packets. The World Wide Web (WWW) is one application built on top of that infrastructure. What makes something "the Web" is that it fetches linked resources using HTTP. MDN puts it plainly: "The Internet is an infrastructure, whereas the Web is a service built on top of the infrastructure."
History makes the order of events obvious. The Internet was carrying remote logins, email and file transfers for years before anyone had heard of a web page.
What counts as a network application
Once the Web is seen as one application among many, the natural next question is what the whole family looks like. Open HungerStation on your phone and order dinner. The app on your phone (the Client) sends the order across the Internet to the company's backend (the Server), which passes it to the restaurant and a courier. Without the network the app is just a menu picture.
The lecture's definition of a Network application is broad on purpose: any application that uses the Internet as its transport medium. That phrase has a precise meaning in the stack you met in part 03. The application hands its messages to the Transport layer through the Socket API, and everything below that line is someone else's job. What the messages mean is decided by the application.
Familiar apps hide an interesting mix. Some run inside a browser, some are native programs, and one exchanges its files with other users instead of a company server. Try sorting them yourself before reading the table.
| App | Runs in | Talks to | Architecture |
|---|---|---|---|
| Chrome (opening a site) | A browser | Web servers over HTTP | Web, client-server |
| Gmail in a browser tab | A browser | Google's mail servers over HTTP | Web, client-server |
| Outlook desktop | A native program | A mail server (over SMTP or IMAP) | Client-server, mail protocols |
| Netflix or HungerStation app | A native phone app | The company's backend servers | Client-server, HTTP APIs |
| uTorrent | A native program | A tracker to find peers, then other BitTorrent peers directly | Peer-to-peer |
uTorrent is the odd one out. It speaks the BitTorrent protocol, where the specification says that when many people download the same file at once, "the downloaders upload to each other". Each copy of the program acts as a client and a server at the same time. This arrangement is called peer-to-peer, and it returns in the next concept when we ask what decentralized means.
The protocol decides the circle
A useful picture, adapted from Connolly and Hoar's Fundamentals of Web Development, draws the Internet as a large circle with several smaller circles inside it: the Web, email, online gaming and FTP.
The rule for deciding which circle an application belongs to is its Application layer Protocol. If it speaks HTTP to fetch web resources, it is in the Web circle. If it speaks SMTP to move mail between servers, FTP to move files, or a custom game protocol, it sits in a sibling circle. Siblings share the Internet but not the Web. The circle sizes are illustrative only; they make no claim about traffic shares.
Email is a good exam trap. When you read Gmail in a browser tab, your browser talks HTTP to Google, which is the Web. When Google then delivers your message to a KFUPM mail server, the two mail servers speak SMTP, which is not the Web. One everyday "email" experience touches two circles.
Recall
Name two network applications that are not part of the Web, and say what protocol makes them not Web.
Quick check
Which statement correctly describes how the Internet and the Web relate?
Take one calculator and build it three ways. First, a desktop calculator: one program on one machine. Second, a browser page that sends "2+3" over HTTP to a separate server program, which sends back 5. Third, the same service, but the server's work and data are spread over several machines, with addition on one node and the history database on another.
By the lecture's definitions, the first build is neither decentralized nor distributed. The second is a Decentralized application: the application is split into two standalone components (Client and Server), usually on different machines, that talk through a Protocol using sockets. It is also a Distributed application in the lecture's sense, because computation is shared between client and server and state lives on both. The third build pushes distribution further: the server's own computation and data are spread over several machines.
Keep these two questions apart, because they become the two axes of the design space in the next concept: decentralization is the vertical axis, distribution the horizontal one.
| Aspect | Decentralized (lecture) | Distributed (lecture) |
|---|---|---|
| What is split | The application itself, into separate client and server programs | The computation and state, between client and server or across several machines |
| What the definition stresses | Structure: separate programs that talk through a protocol and sockets | Resources: where computation and state physically live |
| Lecture example | BitTorrent, Bitcoin | Google Cloud |
| Design-space axis | Vertical: which layer a component sits on | Horizontal: which compute or storage resource it uses |
The lecture's examples fit. BitTorrent and Bitcoin have no single controlling center: the Bitcoin paper opens with the goal of sending payments "directly from one party to another without going through a financial institution". Google Cloud is one provider that spreads computation and state across its own machines in many regions and zones around the world.
Recall
Using the lecture's definitions, what makes an application decentralized, and what makes it distributed? Give the lecture's example of each.
Quick check
Using the lecture's own definitions, which example is labelled a distributed application?
So far "the server" has been a single word. Look inside the calculator's server side and it turns out to be several separate pieces, and that discovery is what makes edge computing possible: separate pieces can live in separate places.
The server side is a set of components
Follow one request. The Client sends "multiply 6 by 7". It does not know or care how the server side is organized. It simply knocks on one door. That door is the API gateway, a single entry point that receives every client request and routes it to the right service. AWS describes its own gateway product as a "front door" for applications to reach backend services. Behind it sit four operation services (Add, Sub, Mul, Div), each exposing its own Interface, like a small Web API, and each able to read or write a Database.
Sends one request and waits.
Reads the operation and picks a service.
Each does one kind of arithmetic.
Keeps results and history.
Worked example
One multiply request, step by step
Client sends
The client sends an HTTP request asking for 6 × 7 to the gateway's address.Gateway routes
The API Gateway sees the operation is multiply and forwards it to Mul.Service computes
Mul computes 42 and writes a history record to the Database.Answer returns
Mul replies to the gateway, which returns the response to the client.Result
One client request touched three server components (gateway, Mul, Database). The client saw only one door.
Everything except the client forms the Server layer, typically hosted in the Cloud. But nothing forces those components to live together. Because each one is a separate program with its own interface, Mul could run close to the user while the Database stays in a large data center. The question becomes: can we assign server components to different layers, and if so, how do we describe and justify the assignment?
Two coordinates for every component
The answer is a grid that works like a seating chart. "Mul sits on Layer 1 using Compute 1." "The Database sits on Layer 3 using Compute 2 plus Storage." Every component gets two coordinates.
The two-dimensional design space separates two independent decisions about each Component, and they are exactly the two questions from the previous concept. Moving a box up or down changes its Layer: that is the decentralization axis, how far the server side is split across layers. Moving a box left or right changes the resource it uses on that layer: Compute 1, or Compute 2, which can also offer storage (only the Database uses it). That is the distribution axis, how computation and state are spread across resources.
A column is a type, each layer has its own instance
One subtlety makes the grid precise. A column names a resource type, not a machine. Each layer has its own copies of those types, and the lecture marks them with suffixes: Compute 2_a + Storage_a on the Database, Compute 1_b on Add, and Compute 2_b on Sub. The letter tells you which layer's copy: _a belongs to Layer 3 and _b belongs to Layer 2. So Add and Sub share a layer, but run on two different instances.
This is what makes the application a Distributed application in practice: the same kind of resource exists as several instances in different places, and the application's computation and state are spread across them. "Compute 2" could be a virtual machine type in a Cloud region, a server in a Fog micro data center, or a box at the Edge.
Worked example
Name the instance for every box
Database (Layer 3, column 2)
Compute 2_a + Storage_a, given in the lecture.Add (Layer 2, column 1)
Compute 1_b, given in the lecture.Sub (Layer 2, column 2)
Compute 2_b, given in the lecture.API Gateway (Layer 3, column 1)
Following the pattern, Compute 1_a.Mul (Layer 1, column 1)
Following the pattern, Compute 1_c.Div (Layer 1, column 2)
Following the pattern, Compute 2_c.Result
Six boxes, six separate instances. Two boxes share a letter only when they share a layer, and share a number only when they use the same resource type.
Criteria for assigning components to layers
The grid tells you how to write a placement down. It does not tell you which placement is good. For that the lecture asks: what criteria decide which layer a component goes on? There is no single right answer, only trade-offs. Each criterion pushes a component in a direction.
| Criterion | Pushes component toward | Calculator example | Source |
|---|---|---|---|
| Latency | Lower layers, close to the client | A live result preview that must update as you type | Satyanarayanan 2017; NIST SP 500-325 |
| Compute demand | Higher layers, where capacity exists | A heavy matrix-inversion service added to the calculator | Satyanarayanan 2017 |
| Storage and state | A well-provisioned layer with durable storage | The Database holding every user's history | Lecture design space |
| Cost (bandwidth) | Lower layers, near where data is produced | Summarize raw sensor input locally, send only results up | Satyanarayanan 2017 |
| Privacy and residency | Lower layers, or a region inside the right borders | Strip personal data before anything leaves the site | Satyanarayanan 2017; Google Cloud locations |
| Sharing across users | A layer every client can reach | The API Gateway, the single entry point for everyone | AWS API Gateway guide |
| Availability | Add a nearby fallback below the cloud | Keep basic Add working during a short cloud outage | Satyanarayanan 2017 |
The evidence behind the table comes from the edge computing literature. Satyanarayanan writes that "reliance on a cloud datacenter is not advisable for applications that require end-to-end delays to be tightly controlled to less than a few tens of milliseconds." NIST adds that Fog computing "minimizes the request-response time" by working close to end devices. So a time-critical component moves toward the Edge, lowering Latency and Response time (RT).
The pull goes the other way too. Heavy computation and durable, shared data need resources that shrink as you go down the layers, which is why the Database sits on the top layer. Satyanarayanan also notes that analyzing raw data near its source cuts the bandwidth sent to the cloud, that a nearby cloudlet "can enforce the privacy policies of its owner prior to release of the data to the cloud", and that local resources give the "ability to mask transient cloud outages". Google Cloud, for its part, sells regions partly so data can stay resident inside a country's borders.
Quick check
In the lecture's two-dimensional design space, what does moving a component up the vertical axis change?
Quick check
A face-blurring component must process camera frames before any raw video leaves the building. Which criterion mainly pushes it to a lower layer?
Recall
List five criteria for assigning a server component to a layer, each with a one-line reason.
Placing components on layers only works because they can talk to each other across a network. So zoom in on one conversation. Open the calculator in a browser and press equals. The front-end JavaScript sends GET /add?a=2&b=3. A Node.js back-end reads that request from its socket, computes 5, and writes the response back. Along the way the bytes travel through routers you will never see.
Three levels in one conversation
At the top is the application conversation: an HTTP request and response. In the middle are the endpoints, the sockets. At the bottom is the network path through the Internet. The Frontend runs in the browser, and the Backend runs in Node.js.
Builds the request and renders the answer.
Reads the request, computes, replies.
Shows the result to the user.
RFC 9110, the HTTP standard, defines the roles by behavior. A Client "is a program that establishes a connection to a server for the purpose of sending one or more HTTP requests". A Server "is a program that accepts connections in order to service HTTP requests by sending HTTP responses". And HTTP itself "is a stateless request/response protocol for exchanging messages across a connection".
Sockets are endpoints, connections are pairs
A socket is named by an IP address plus a Port number. The connection is the pair of sockets, one at each end, as in this example using documentation addresses:
One HTTPS connection seen as a socket pair
- Client socket
- 192.0.2.10:52814
- Server socket
- 198.51.100.7:443
- Transport protocol
- TCP
- Connection
- Identified by both sockets together, set up by TCP after the client calls connect()
The HTTP arrow is logical, the bytes move vertically
Protocol pictures usually draw a dashed arrow between the two HTTP boxes, as if browser and server talked to each other directly. They do, but only logically. No HTTP byte ever travels sideways along that arrow.
The real journey is vertical. The browser writes an HTTP message. It goes down through TCP on the client and the Socket, into the TCP/IP network (the "pipe"), and back up through TCP on the server until Node.js reads it. This is Encapsulation from part 03: each layer wraps the data on the way down and unwraps it on the way up. Peer layers "talk" to each other only through that round trip.
The same picture also shows who owns what. The Application layer (AL) is the web application, written by developers: HTML, CSS and JavaScript in the Frontend, and Node.js in the Backend. The Transport layer (TL), Network layer (NL), Data link layer (DLL) and Physical layer (PL) are infrastructure, provided by the operating system, network cards, cables and routers. That split is the same line that defined a network application in the first concept: the app owns meaning, the infrastructure owns delivery.
Recall
Why is the HTTP arrow between browser and server drawn dashed, and what path do the bytes really take?
Step back from a single message to the rhythm of the whole exchange. Your browser asks the calculator for a result. The server wakes up, spends processor time computing it, reads and writes the history, and sends bytes back. Then it waits for the next request. It never phones you first.
That cycle is the Request-response loop. The Client initiates, and the Server only responds. RFC 9110 builds HTTP around exactly this pattern: a client sends a request message, and a server answers it with a response message.
Every response has a price
This is where the part comes full circle. Preparing each response costs the server three resources. Compute is the processor time, which you will later measure as Processing time (PT). Storage is reading and writing data. Communication is sending the response back over the network. For one user that is trivial. Multiply it by, say, 10,000 users pressing equals at once, and those three costs decide where each component in the design space should live.
It is also why placement matters to users. The time a user waits, the Response time (RT), is the trip to the server, the processing, and the trip back. NIST describes Fog computing as a way to minimize the request-response time. Moving the right component closer shortens the loop.
Quick check
Who initiates communication in the request-response loop between browser and server?
Recall
In the request-response loop, who initiates, and which three server resources does each response consume?
Recap
If you remember nothing else
- The Internet is the infrastructure. The Web is one network application on it, using HTTP.
- A network application is any app that uses the Internet as its transport medium: web, email, streaming, peer-to-peer.
- Lecture definition: decentralized means split into separate client and server programs that talk through a protocol and sockets (BitTorrent, Bitcoin).
- Lecture definition: distributed means computation is not on a single machine but spread between client and server, and state is distributed too (Google Cloud).
- The server side of an app is several components (an API gateway, services, a database), and each can be placed separately.
- Design space: the vertical axis picks the layer (decentralization). The horizontal axis picks the compute or storage resource type (distribution); the layer's copy of that type is the instance.
- Placement criteria: latency, compute demand, storage and state, cost, privacy, sharing and availability.
- A socket is an endpoint. HTTP talks logically between application layers, while the bytes move through the TCP/IP stack.
- The client initiates. Each response costs the server compute, storage and communication.
Sources
- RFC 9110: HTTP SemanticsRFCIETF / RFC EditorClient, server and request/response definitions, sections 3.3 and 3.4(opens in a new tab)
- A short history of the WebArticleCERN(opens in a new tab)
- How does the Internet work?DocsMDN Web Docs (Mozilla)(opens in a new tab)
- Fundamentals of Web Development, 3rd ed. (Connolly and Hoar, 2021)BookPearsonLikely origin of the nested-circles and request-response figures(opens in a new tab)
- Computer Networking: A Top-Down Approach, 9th ed. (Kurose and Ross)BookPearsonApplication layer, sockets and layered communication(opens in a new tab)
- A brief introduction to distributed systems (van Steen and Tanenbaum, Computing 98, 2016)PaperSpringer (open access)(opens in a new tab)
- Distributed Systems, 4th ed. (van Steen and Tanenbaum, 2023)Bookdistributed-systems.net(opens in a new tab)
- Bitcoin: A Peer-to-Peer Electronic Cash System (Nakamoto)Paperbitcoin.org(opens in a new tab)
- BEP 3: The BitTorrent Protocol SpecificationDocsBitTorrent.org(opens in a new tab)
- On Distributed Communications: I. Introduction to Distributed Communications Networks (Baran, 1964)PaperRAND CorporationCentralized, decentralized and distributed topologies. Verified via search listing(opens in a new tab)
- The Meaning of Decentralization (Buterin, 2017)ArticleMediumArchitectural, political and logical decentralization. Verified via search listing(opens in a new tab)
- Google Cloud locationsDocsGoogle Cloud(opens in a new tab)
- What is Amazon API Gateway?DocsAmazon Web Services(opens in a new tab)
- RFC 6455: The WebSocket ProtocolRFCIETF / RFC Editor(opens in a new tab)
- NIST SP 500-325: Fog Computing Conceptual Model (Iorga et al., 2018)PaperNIST(opens in a new tab)
- The Emergence of Edge Computing (Satyanarayanan, IEEE Computer, Jan 2017)PaperIEEE Computer Society (author copy, CMU)(opens in a new tab)