Home Backend Development PHP Tutorial nginx spdy protocol

nginx spdy protocol

Aug 08, 2016 am 09:31 AM
apache chrome google http

SPDY is an application layer protocol based on Transmission Control Protocol (TCP) developed by Google. The development team is promoting SPDY to become a formal standard (now an Internet draft). SPDY The protocol is designed to improve web page load times and improve security through compression, multiplexing, and prioritization. (SPDY is the nickname of Speedy, which means faster)

The relationship between SPDY and HTTP

The SPDY protocol only greatly optimizes HTTP in terms of performance. Its core idea is to minimize the number of connections. , and the semantics of HTTP have not been significantly modified. Specifically, SPDY It uses HTTP methods and headers, but deletes some headers and rewrites the parts of HTTP that manage connections and data transfer formats, so it is basically compatible with HTTP.

Google stated in the SPDY white paper that it will penetrate into the protocol stack and replace the transport layer protocol (TCP), but because this is currently very difficult to deploy and implement, so Google plans to improve the application layer protocol HTTP first, first adding a session layer on top of SSL to implement the SPDY protocol, while the GET and POST message formats of HTTP remain unchanged, that is, all existing server applications do not need to be modified. .

So at present, the purpose of SPDY is to strengthen HTTP and provide a better implementation and support for HTTP. As for whether SPDY will be replaced by a civet cat for a prince after it is widely used in the future. It's Google's job to revolutionize HTTP and revolutionize the entire Internet.

Why build a new SPDY?

It has been more than ten years since Tim Berners-Lee, the father of the World Wide Web, invented and promoted HTTP to become the most popular protocol on the Internet today (the current HTTP 1.1 specification has also been stagnant for 13 years), as now With the rapid development of WEB technology, especially the continuous evolution of HTML5, including the emergence of the WebSockets protocol and changes in the current network environment and changes in transmission content, the original HTTP specification has gradually been unable to meet people's needs. HTTP needs further development, so HTTPbis work A group has been formed and authorized to consider HTTP 2.0, hoping to address many of the limitations currently imposed by HTTP. SPDY is a protocol launched by Google when HTTP is about to cross from 1.1 to 2.0 in an attempt to become the next generation of Internet communications. It has long been considered the only viable option for HTTP 2.0.

Disadvantages of HTTP protocol

1. Single-way connection request is inefficient

The biggest disadvantage of HTTP protocol is that each TCP connection can only correspond to one HTTP request, that is, each HTTP connection only requests one resource. , the browser can only solve it by establishing multiple connections. In addition Requests in HTTP are strictly first-in, first-out (FIFO). If a request in the middle takes a long time to process, subsequent requests will be blocked.

(Note: Although HTTP pipelining has improved connection requests, the complexity has increased greatly and has not been popularized)

2. HTTP only allows requests to be actively initiated by the client

The server only Being able to wait for the client to send a request is a constraint in meeting the current status of preloading.

3. HTTP header redundancy

HTTP headers are sent repeatedly in the same session, and redundant information in the middle, such as User-Agent, Host and other information that does not need to be sent repeatedly, are also sent repeatedly. Waste of bandwidth and resources.

Advantages of SPDY protocol

1. Multiplexing request optimization

SPDY stipulates that there can be unlimited parallel requests within a SPDY connection, which allows multiple concurrent HTTP requests to share a TCP session. This way SPDY is multiplexed in a single TCP Multiple requests on the connection, instead of opening a separate connection for each request, so that only one TCP connection can be established to transfer all resources on the web page, which not only reduces the round-trip time for message interaction but also avoids the delay caused by creating a new connection. Make TCP more efficient.

In addition, SPDY's multiplexing can set priorities. Unlike traditional HTTP, which strictly processes requests one by one according to first-in-first-out, it will selectively transmit more important resources such as CSS first and then transmit them. Less important resources such as website icons can avoid the problem of non-critical resources occupying network channels and improve TCP performance.

2. Support server push technology

The server can actively initiate communication to the client and push data to the client. This preloading can keep users on a fast network.

3. SPDY compresses HTTP headers

discards unnecessary header information. After compression, it can save the waiting time and bandwidth caused by redundant data transmission.

4. Mandatory use of SSL transmission protocol

Google believes that the future development direction of the Web must be secure network connections. After all requests for SSL encryption, information transmission will be more secure.

The meaning of SPDY protocol

According to Google, SPDY was created for the sole purpose of making the Web faster (strive to make the whole web fast), and its name SPDY (Speedy) also seems to be hinting at this. So what is the significance of SPDY?

1. Ordinary users:

For users, there is no difference between SPDY hidden under the browser and HTTP, but we can feel that Google services are extremely fast under Chrome. This is Credit goes to SPDY. In addition, after website information transmission is encrypted, there is no need to worry about information being intercepted, etc., which greatly increases security and confidentiality.

2. Front-end staff:

For front-end engineers, improving page efficiency is a very important thing. Currently, most methods like CSS Sprites are used to optimize the website. Because each page is loaded when the page is loaded, pictures, icons They all request one connection and even reference different images on different pages to reduce the number of image requests on one page. Now with SPDY's request optimization, the order of requests can be rearranged, which can largely alleviate the impact of image requests when the page is loaded. For example, if there are too many registered users on the registration page of Geek Park, such as the 2012 Innovation Conference of Geek Park or the 27th Great Wall Conference of Geek Park, it can be clearly felt that the request for avatars will slow down the overall page loading or even slow it down. I believe that those who often go to Taobao or Weibo will have a deep understanding of this. Once the Internet speed is slightly slower, page loading abnormalities will occur. There are also products like the Apple App Store (excluding server delays due to regions). Application icons on application distribution platforms such as Doujia are slow to refresh, as shown in the video below.

3. Operation and maintenance personnel:

While reducing the number of connections, SPDY also reduces the resources occupied by each client on the server, thus freeing up more memory and CPU. In addition, SPDY combined can double browsing speeds and improve page loading latency by up to 64%.

  SPDY protocol supported by everyone

If you are using the Chrome browser and Google network services such as Gmail, you are actually no longer accessing these services through HTTP. Open in browser chrome://net-internals/#spdy will find that you are already using the SPDY protocol. (In addition to Google's own Gmail, Google Plus and other Google services, other public sites such as Twitter and Webtide have also supported this protocol. In China, Wandoujia 2.0 based on WebKit has also stated that it will introduce Chrome's SPDY technology to further improve Speed.

The implementation of SPDY requires support from both the browser client and the web server. Needless to say, Google’s own Chrome and Chromium series already support SPDY on the client browser; Mozilla's Firefox also supports SPDY by default since Firefox 13. Amazon's Silk's use of SPDY is actually no worse than Google's own Chrome and Firefox.

In terms of web servers, including the most popular and widespread Apache, Netty, Jeety, Varnish, Erlang and Hightide application servers and Node.js servers have also announced support for SPDY. (Nginx also said it will support SPDY)

How to deploy SPDY?

Recently, Google has officially released the plug-in mod_spdy for the most popular web server Apache. After downloading and installing it, your Apache server can use it. The SPDY protocol communicates with browsers that are compatible with the SPDY protocol, such as Chrome, FireFox, etc. As mentioned before, SPDY runs over HTTPS, and non-HTTPS traffic will not be affected by mod_spdy.

SPDY deployment requirements:

1. Apache 2.2 (≥2.2.4)

2. mod_ssl module enabled

SPDY deployment steps:

1. Download mod_spdy module

Go to the download page to download the installation package for the corresponding system

2. Install the mod_spdy module

Run the following command line in the system terminal

dpkg -i mod-spdy-*. deb

apt-get -f install

-The system is Debian/Ubuntu

------------------------ ----------------------------------

yum install at (if you do not already have ' at' installed)

rpm -U mod-spdy-*.rpm

-The system is CentOS/Fedora

3. Restart the server (Apache)

sudo /etc/init.d /apache2 restart (Debian/Ubuntu)

4. Confirm whether it is enabled or not

Open the Chrome browser, enter and go to the chrome://net-internals/#spdy page, and check whether the host name appears in the identification bar middle. If it appears, it means the deployment has been completed. If it does not appear, check the server error log (error.log).

The above introduces the spdy protocol of nginx, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Google Pixel 9 Pro XL gets tested with desktop mode Google Pixel 9 Pro XL gets tested with desktop mode Aug 29, 2024 pm 01:09 PM

Google has introduced DisplayPort Alternate Mode with the Pixel 8 series, and it's present on the newly launched Pixel 9 lineup. While it's mainly there to let you mirror the smartphone display with a connected screen, you can also use it for desktop

Google Tensor G4 of Pixel 9 Pro XL lags behind Tensor G2 in Genshin Impact Google Tensor G4 of Pixel 9 Pro XL lags behind Tensor G2 in Genshin Impact Aug 24, 2024 am 06:43 AM

Google recently responded to the performance concerns about the Tensor G4 of the Pixel 9 line. The company said that the SoC wasn't designed to beat benchmarks. Instead, the team focused on making it perform well in the areas where Google wants the c

Google opens AI Test Kitchen & Imagen 3 to most users Google opens AI Test Kitchen & Imagen 3 to most users Sep 12, 2024 pm 12:17 PM

Google's AI Test Kitchen, which includes a suite of AI design tools for users to play with, has now opened up to users in well over 100 countries worldwide. This move marks the first time that many around the world will be able to use Imagen 3, Googl

Google Pixel 9 Pro XL ranks 2nd in DxOMark\'s \'Global\' smartphone camera ranking Google Pixel 9 Pro XL ranks 2nd in DxOMark\'s \'Global\' smartphone camera ranking Aug 23, 2024 am 06:42 AM

Google's new Pixel 9 series has introduced a new variant that wasn't present in previous lineups, the Pixel 9 Pro XL. It is essentially identical to the non-XL variant (pre-order at Amazon), but as the name suggests, it has a larger screen. The two e

Pixel 9 Pro XL vs iPhone 15 Pro Max camera comparison reveals surprising Google wins in video and zoom performance Pixel 9 Pro XL vs iPhone 15 Pro Max camera comparison reveals surprising Google wins in video and zoom performance Aug 24, 2024 pm 12:32 PM

The Google Pixel 9 Pro and Pro XL are Google's answers to the likes of the Samsung Galaxy S24 Ultra and the Apple iPhone 15 Pro and Pro Max. Daniel Sin on YouTube(watch below) has compared the Google Pixel 9 Pro XL to the iPhone 15 Pro Max with some

Google confirms Pixel 9 Pro Fold incompatibility with official wireless charging accessories thanks to curious design Google confirms Pixel 9 Pro Fold incompatibility with official wireless charging accessories thanks to curious design Sep 01, 2024 am 06:31 AM

The Pixel 9 Pro Fold is akin to a volte-face for Google's nascent foldable division. In fact, such are the differences between thePixel 9 Pro Foldand the Pixel Fold that the former has been compared more against the OnePlus Open (curr. $1,399.99 on A

First Google Pixel 9a footage shows full redesign with much earlier release also rumoured First Google Pixel 9a footage shows full redesign with much earlier release also rumoured Aug 27, 2024 am 06:35 AM

Hardly any time has passed since Google announced its first Pixel 9 series smartphones. In fact, it has only just started shipping the Pixel 9, Pixel 9 Pro and Pixel 9 Pro XL (curr. $1,099 on Amazon). By contrast, Pixel 9 Pro Fold pre-orders will not

Google responds to lackluster benchmark scores of Tensor G4 inside the Pixel 9 line Google responds to lackluster benchmark scores of Tensor G4 inside the Pixel 9 line Aug 20, 2024 pm 09:49 PM

From the get-go, the Google Pixel series was never about beating the top-performing competitors in performance benchmarks. The case for the Google Pixel 9 lineup isn't much different, as the early benchmark results show that the Tensor G4 is quite be

See all articles