In-depth analysis of Javaweb Technology Insider first chapter in-depth Web request process

Source: Internet
Author: User
Tags domain name server browser cache domain name registration domain server mail exchange mx record

Chapter One deep Web request process

b/S two advantages:

    1. The client uses a unified browser (Browser). Browser uniformity, shielding the differences in service delivery from different server providers. Also, browser interactivity makes the browser easy to use, and the user behavior is highly inheritable.
    2. Service-side (Server) is based on a unified HTTP protocol. Simplify the service provider development model and standardize the server developer morning development model.
1.1 b/S website Architecture overview

The HTTP protocol uses a non-stateful, short-connection communication method. The data interaction is usually completed once on a request and usually corresponds to a business logic.

The URL request DNS resolves the domain name to an IP address, locates the corresponding server according to the IP address, sends the request to the server, and the server returns the data resource to the user to access. Load Balancing assigns requests to the server, and requests data is stored in distributed caches, static files, and databases. The static resource initiates an additional HTTP request and the CDN server processes the request.

Internet Application principles:

    • All resources on the Internet are represented by a URL (Uniform Resource Locator).
    • You must interact with the server based on the HTTP protocol.
    • The data presentation must be done in the browser.
1.2 How to initiate a request

Before the browser establishes the socket connection, it must resolve the IP according to the DNS of the URL in the address bar, establish a socket connection to the remote server based on the IP address and the default 80 port, and the browser assembles a Get type HTTP request header according to the URL. Sent to the target server via Outputstream.write, the server waits for Inputstream.read to return data and finally disconnects.

1.3 HTTP protocol parsing

The core of B/S network architecture is the HTTP protocol.
HTTP headers are the most important of the HTTP protocol. The HTTP header controls the user's browser rendering behavior and the server's execution logic.

1.3.2 Browser caching mechanism

The Ctrl+f5 Refresh page must be able to request pages that are not cached.
Ctrl+f5 refreshes the page, the browser sends the request directly to the destination URL without using the browser cache.
Ctrl+f5 Refresh the page, the HTTP request header adds some request headers, Pragma:no-cache Cache-Control:no-cache .

    1. Pragmaand Cache-Control instructions that specify all caching mechanisms that must be obeyed throughout the request/response chain.

    2. Expires:Sar,25 Feb 2012 12:22:17 GMTCheck this field before the browser request, whether it expires, expires and re-initiates the request to the server.
    3. Last-Modified/EtagLast-Modifiedrepresents the last modification time of a resource on a server. The browser request header adds one If-Modified—Since:Sar,25 Feb 2012 12:22:17 GMT , asks whether it is up to date, is the latest return 304, and does not pass new data. EtagSimilarly, having the server assign a unique number to each page is more recent than Last-Modified flexible, but multiple back-end servers do not handle it.

1.4 DNS Domain name resolution

    1. The browser checks to see if the cache has an IP corresponding to the domain name.
    2. Browser to find out if the operating system has the corresponding DNS resolution results.
    3. The operating system sends the domain name to Ldns, the domain name server in the region.
    4. Ldns no, direct to the root server domain name server to request resolution. Ldns undertook the main domain name resolution work.
    5. The ROOT name server returns the primary Domain name server address of a queried domain to the local domain name server. gTLD International Top-level domain server, only about 13 units.
    6. The local DNS server sends requests to the GTLD server.
    7. The GTLD server that accepts the request looks for a name server address that returns this corresponding domain name. You register the domain name server, a service provider application domain name, domain name resolution to the domain name server.
    8. The name server nameserver address queries the domain name and IP mapping relationship table, along with the TTL value returned to the DNS server domain name server.
    9. Returns the IP and TTL values for the domain name, the Local DNS server caches the domain name and IP correspondence, and the cache time TTL value is controlled.
    10. Parse the result to the user, the user caches according to the TTL value to the local system, the domain name resolves the end.
1.4.4 several domain name resolution methods

A record, MX record, CNAME record, NS record, and TXT record.

    • A record, address, used to specify the IP address of the domain name. A record can resolve multiple domain names to an IP address and cannot resolve a domain name to multiple IP addresses.
    • MX record, mail Exchange, points a domain name under a mail server to your own mail server. DNS sends the [email protected] request at the mail server address, and the normal web request still resolves to the IP address of the a record.
    • CNAME record, Canonical Name (alias resolution). Set one or more individual names for a domain name.
    • NS records, specifying a DNS resolution server for a domain name that has a DNS server for the specified IP address to parse.
    • TXT record, set a description for a host name or domain name.
1.5 CDN Working mechanism

Content distribution Networks (contents Delivery Network). Cdn= mirrored mirror+ Cache cache+ overall load balancing gslb.
CDN caches static data in a Web-based site. Speed up the download of Web data content.

Goal

    • Extensible (Scalability). Performance is extensible. Costs can be expanded.
    • (security).
    • Reliability, response, and execution (reliability, responsiveness, and performance).

Access to the static file, the first to the local DNS server request, after the iteration to the domain name registration server resolution, the company DNS to the request to re-cname to another domain name, the domain name points to the CDN DNS load Balancer Server, by this GTM allocation user distance from the nearest CDN node. If the CDN node request does not exist, it will retrieve the file back to the original station and return it to the user.

1.5.2 Load Balancing

Load balance balances the work tasks and performs them on multiple operational units.
Link load balancing, cluster load balancing, operating system load balancing.

    • Link load balancing, DNS resolves to a different IP.
    • Cluster load Balancing.
      • Hardware load Balancing
      • Software load Balancing
    • Operating System load balancing: Soft interrupts and hardware interrupts at the operating system level.
1.5.3 CDN Dynamic Acceleration

In the DNS resolution of CDN, the best path of backtracking is found by dynamic link detection, and all requests are dispatched to the selected path by the DNS dispatch.

In-depth analysis of Javaweb Technology Insider first chapter in-depth Web request process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.