[go: up one dir, main page]

0% found this document useful (0 votes)
17 views16 pages

Introducing HTTP

The document introduces HTTP as a stateless and insecure protocol, detailing its request and response structure, including headers, methods, and content types. It discusses how clients, such as browsers and mobile libraries, make HTTP requests and handle responses, emphasizing performance optimization techniques like compression, caching, and CDN usage. Additionally, it highlights potential issues in mobile applications and tools for monitoring HTTP performance.

Uploaded by

mauryasurya22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views16 pages

Introducing HTTP

The document introduces HTTP as a stateless and insecure protocol, detailing its request and response structure, including headers, methods, and content types. It discusses how clients, such as browsers and mobile libraries, make HTTP requests and handle responses, emphasizing performance optimization techniques like compression, caching, and CDN usage. Additionally, it highlights potential issues in mobile applications and tools for monitoring HTTP performance.

Uploaded by

mauryasurya22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Introducing HTTP

Capabilities, Collaboration and Culture

Proprietary + Confidential
You MUST Know

➢ It is stateless protocol and insecure protocol


➢ Blocking call (although client may move on)
➢ Server can queue so you would not know if server is stressed out (unless it exceeds
queuing limits) and hence performance is the ONLY way to know if server is stressed
out
○ 10 calls
○ 5 being processed
○ 5 being queued
➢ What i say about HTTP, is also true for HTTPS other than it being secure
What all comes through HTTP?
A page with 100 images of Amitabh Bachchan
A separate HTTP request for:
➢ HTML
➢ Each CSS inclusion
➢ Each JavaScript inclusion
➢ Each Image
➢ Each Font
➢ Each Ajax (XHR)
How can I make an HTTP Request? (aka Clients)

➢ Browser
○ Chrome, IE, Firefox, Safari
○ Lynx
○ PhantomJS
➢ Curl
➢ Google Chrome Postman
➢ Mobile Networking Libraries
○ Volley, Retrofit
○ Alamofire, URLSession, AFNetworking
➢ Single Page Application
○ Axios in ReactJS and VueJS
○ HTTPClient in AngularJS
➢ Note a logged in user is user and NOT client
You MUST Know

➢ HTTP Request consists of:


○ Header
○ Body
○ QueryString
○ Cookie/Session
○ User Agent
○ Method
■ GET, POST
■ PUT, DELETE
You MUST Know
➢ HTTP Response consists of:
○ Content Length
○ Content Type
○ Status Code
■ 200
■ 404
○ Compression
■ Why is it important?
○ Cache
■ Why a few times the content doesn’t change?
○ KeepAlive
What Clients (browsers) Can Do?

➢ Request compression through header


○ Note that if you send this header, server may or may NOT compress
➢ Decompress compressed content
➢ Compress the content while sending them as modern servers handle decompressio
now
○ Image Uploads
➢ Read from Cache instead of making new calls for unchanged content
○ MaxLife
○ Beware that there are Firewall level caching that ignore ?ver=101
Where Clients Spend Time?
What clients do with the response?

Decompress the content


➢ Draw the UI
➢ Manipulate the DOM
➢ Change things on the UI
➢ If clients disconnect, responses are not received
Cases to Handle in Mobile

➢ Purchase App
○ You buy 2 chocolates and store it in local DB
○ When network comes, you send the Data and on success response, you
remove the 2 chocolates from local DB
➢ Case that you have to handle
○ Everything goes as planned
○ Request did not reach server
○ Request did reach server but client went offline BEFORE response came
○ Client came online again and you send the request again and now server has
4 chocolates instead of 2
How to find what is going on?

➢ Google PageAudit
➢ YSlow?
➢ Follow recommendations of PageAudit
➢ If a site is on HTTPs and you are loading content (CSS, JS, font and Images)
from HTTP, it would give an error.
○ https://www.whynopadlock.com/
Improve Performance

➢ Minification and Bundling


➢ Compression
○ What to compress and what not to compress
➢ Caching of the content
➢ CDN for static content
○ Even when same server is dishing out static
➢ Image Sprites for icons
(https://www.w3schools.com/css/css_image_sprites.asp)
➢ HTTP2?
○ https://searchengineland.com/everyone-moving-http2-236716
Questions?

You might also like