新增的章节。

If you are not using HTTP/2, then you are losing out on big improvements.

HTTP/2相比http/1有很大的区别。例如:

  • multiplexing 多路复用
  • server push of assets

如果您没有用HTTP/2优化代码,那么您的应用程序可能比使用HTTP/2要慢。

大量http/1的网页优化实际已经不需要了,甚至它们可能会伤到HTTP/2。

本章介绍一些主要功能,你需要阅读它并跟着它进行更多的在线阅读。

相关连接:

https://nodejs.org/api/http2.html

http://expressjs.com/en/4x/api.html


Brief Overview of HTTP/2

  • 多路传输Multiplexing: Allows browsers to include multiple requests in a single TCP connection that enables browsers to request all the assets in parallel.
  • 服务器推送Server push: Servers can push web assets (CSS, JS, images) before a browser knows it needs them, which speeds up page load times by reducing the number of requests.
  • 流优先Stream priority: Allows browsers to specify priority of assets. For example, a browser can request HTML first to render it before any styles or JavaScript.
  • 头压缩Header compression: All HTTP/1.1 requests have to have headers which are typically duplicate the same info, while H2 forces all HTTP headers to be sent in a compressed format.
  • De facto mandatory encryption: Although the encryption is not required, most major browsers implement H2 only over TLS (HTTPS).

作为web开发者需要知道的是:

原先的大多数优化计策已经不需要了。尤其是文件串联the file concatenation。

Stop doing that (image sprites, bundled CSS and JS), because H2 can make parallel requests and because each small change in your big file will invalidate cache.

It’s better to have many small files with H2.

I hope the need for build tools like Grunt, Gulp, and Webpack will drop because of that.

Don’t do domain sharding in HTTP2.

请学习所有的HTTP/2细节,可以从这篇文章开始:https://http2.github.io/faq/

SSL Key and Certificate

当浏览一个https网页,地址栏上有一个

Practical Node.js (2018版) 13章, Node HTTP/2 Servers的更多相关文章

  1. Practical Node.js (2018版) 14章, async code in Node

    Asynchronous Code in Node 历史上,Node开发者只能用回调和事件emitters. 现在可以使用一些异步的语法: async module Promises Async/aw ...

  2. Practical Node.js (2018版) 第7章:Boosting Node.js and Mongoose

    参考:博客 https://www.cnblogs.com/chentianwei/p/10268346.html 参考: mongoose官网(https://mongoosejs.com/docs ...

  3. Practical Node.js (2018版) 第5章:数据库 使用MongoDB和Mongoose,或者node.js的native驱动。

    Persistence with MongoDB and Mongoose https://github.com/azat-co/practicalnode/blob/master/chapter5/ ...

  4. Practical Node.js (2018版) 第10章:Getting Node.js Apps Production Ready

    Getting Node.js Apps Production Ready 部署程序需要知道的方面: Environment variables Express.js in production So ...

  5. Practical Node.js (2018版) 第9章: 使用WebSocket建立实时程序,原生的WebSocket使用介绍,Socket.IO的基本使用介绍。

    Real-Time Apps with WebSocket, Socket.IO, and DerbyJS 实时程序的使用变得越来越广泛,如传统的交易,游戏,社交,开发工具DevOps tools, ...

  6. Practical Node.js (2018版) 第3章:测试/Mocha.js, Chai.js, Expect.js

    TDD and BDD for Node.js with Mocha TDD测试驱动开发.自动测试代码. BDD: behavior-driven development行为驱动开发,基于TDD.一种 ...

  7. Practical Node.js (2018版) 第8章:Building Node.js REST API Servers

    Building Node.js REST API Servers with Express.js and Hapi Modern-day web developers use an architec ...

  8. 《深入浅出Node.js》第1章 Node简介

    @by Ruth92(转载请注明出处) 第1章 Node简介 一.Node的起源 高性能Web服务器的要点:事件驱动.非阻塞I/O. 选择JavaScript的原因:高性能.符合事件驱动.没有历史包袱 ...

  9. Practical Node.js (2018版) 第4章: 模版引擎

    Template Engines: Pug and Handlebars 一个模版引擎是一个库或框架.它用一些rules/languages来解释data和渲染views. web app中,view ...

随机推荐

  1. sqlserver开启远程访问

    1.通过本地连接数据库,选择数据库——右键——属性 2.在连接选项勾选“允许远程连接到此服务器” 3.打开sqlserver配置管理器 4.到sqlserver网络配置——XXX的协议——TCP/IP ...

  2. Recurrent NN vs Recursive NN

    https://www.bilibili.com/video/av9770302/?p=8 李宏毅深度学习 图很清楚的反映出两者的不同 Recurrent可以看成Recursive的特殊形式,即以特定 ...

  3. 部署WEB项目到服务器(三)安装mysql到linux服务器(Ubuntu)详解

    突发奇想,想在自己电脑上部署一个web网站. 1,首先是下载一个适合自己已安装服务器版本的mysql数据库. 这里使用网上的链接http://dev.mysql.com/downloads/mysql ...

  4. 把项目运行到本地环境及mysql配置

    1. 添加本地域名C:\Windows\System32\drivers\etc\hosts 127.0.0.1 local.v7.com 2. 添加一个apache虚拟站点D:\wamp64\bin ...

  5. python练习题-day10

    1.继续整理函数相关知识点,写博客. 2.写函数,接收n个数字,求这些参数数字的和.(动态传参) def fun(*args): sum=0 for i in args: sum+=i return ...

  6. Spring Data JPA框架

    1.前言 扔一个 spring data jpa 的代码,可运行,后续补充博客内容. 环境:eclipse + tomcat8 2.部分截图 3.源码 https://gitee.com/niceyo ...

  7. PHP自定义curl请求

    function http_post($url,$param,$post_file=false,$headers=[]){ $oCurl = curl_init(); if(stripos($url, ...

  8. Django配置相关及其它

    配置 模板 TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ os.pat ...

  9. DTCC2019第十届中国数据库技术大会将于5月在北京召开

    作为国内顶级的数据领域技术盛会,10年来,DTCC见证了国内数据库技术的迅猛发展,各种分布式数据库.NoSQL.NewSQL技术异军突起,与Oracle.DB2等分庭抗礼,甚至大有超越之势.在这种背景 ...

  10. Python基础(二)自定义函数

    1.判断字符串,内容是否为数字 我们用python:xlrd读Excel内容时,本来只是输入的整数字,经常读出来的是float类型 我们需要自动转成整型,意思就是说,读出来的和我们输入的一样,但是,我 ...