Practical Node.js (2018版) 13章, Node HTTP/2 Servers
新增的章节。
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的更多相关文章
- Practical Node.js (2018版) 14章, async code in Node
Asynchronous Code in Node 历史上,Node开发者只能用回调和事件emitters. 现在可以使用一些异步的语法: async module Promises Async/aw ...
- Practical Node.js (2018版) 第7章:Boosting Node.js and Mongoose
参考:博客 https://www.cnblogs.com/chentianwei/p/10268346.html 参考: mongoose官网(https://mongoosejs.com/docs ...
- Practical Node.js (2018版) 第5章:数据库 使用MongoDB和Mongoose,或者node.js的native驱动。
Persistence with MongoDB and Mongoose https://github.com/azat-co/practicalnode/blob/master/chapter5/ ...
- Practical Node.js (2018版) 第10章:Getting Node.js Apps Production Ready
Getting Node.js Apps Production Ready 部署程序需要知道的方面: Environment variables Express.js in production So ...
- Practical Node.js (2018版) 第9章: 使用WebSocket建立实时程序,原生的WebSocket使用介绍,Socket.IO的基本使用介绍。
Real-Time Apps with WebSocket, Socket.IO, and DerbyJS 实时程序的使用变得越来越广泛,如传统的交易,游戏,社交,开发工具DevOps tools, ...
- 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.一种 ...
- 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 ...
- 《深入浅出Node.js》第1章 Node简介
@by Ruth92(转载请注明出处) 第1章 Node简介 一.Node的起源 高性能Web服务器的要点:事件驱动.非阻塞I/O. 选择JavaScript的原因:高性能.符合事件驱动.没有历史包袱 ...
- Practical Node.js (2018版) 第4章: 模版引擎
Template Engines: Pug and Handlebars 一个模版引擎是一个库或框架.它用一些rules/languages来解释data和渲染views. web app中,view ...
随机推荐
- java的几种对象(PO,VO,DAO,BO,POJO,DTO)解释
一.PO:persistant object 持久对象,可以看成是与数据库中的表相映射的java对象.最简单的PO就是对应数据库中某个表中的一条记录,多个记录可以用PO的集合.PO中应该不包含任何对数 ...
- JDBC 和连接池
1 JDBC概述 Java DataBase Connectivity,Java数据库连接,一种执行SQL的Java API,为多种关系数据库提供统一访问规范,由一组Java语言编写的类和接口组成.数 ...
- 点击鼠标出现漂浮字体("自信", "自强", "坚持"...)效果实现
前面我们谈到了漂浮磁力线/鼠标吸铁石特效你也可以实现,现在来聊聊点击鼠标出现漂浮字体("自信", "自强", "坚持"...)效果的实现,这 ...
- airsim 无法打开包括文件corecrt.h
原因: 显示无法打开包括文件corecrt.h.在网上找了很多方法,最后综合起来发现,这个问题网上很多人反映,应该是vs2015的一个BUG,如果是选择"从父级或项目默认设置继承" ...
- java中equals()和==的区别
java中的数据类型 基础数据类型 基础数据类型有byte.short.char.int.long.float.double.bool.String.除了 String 会比较地址,其它的基础类型的比 ...
- node os模块
const os = require('os'); console.log(os.homedir()); console.log(os.hostname()); console.log(os.plat ...
- [js]作用域链查找规则获取值和设置值
作用域链查找规则获取值和设置值 <script> /** 1.作用域链查找规则 私有作用域出现的一个变量不是私有的,则往上一级作用域查找,上级作用域没有则继续向上级查找,一直找到windo ...
- [js]js原型链继承小结
这是之前总结的, 发现有很多的毛病,就是重点不突出,重新翻看的时候还是得耗费很长时间去理解这玩意. js中的继承 js中什么是类 1,类是函数数据类型 2.每个类有一个自带prototype属性 pr ...
- SPP空间金字塔池化技术的直观理解
空间金字塔池化技术, 厉害之处,在于使得我们构建的网络,可以输入任意大小的图片,不需要经过裁剪缩放等操作. 是后续许多金字塔技术(psp,aspp等)的起源,主要的目的都是为了获取场景语境信息,获取上 ...
- centos----------centos下安装谷歌浏览器
1.首先你已经安装了带有可视化界面的centos系统. 2.打开里面自带的一个浏览器,输入网址 http://chrome.richardlloyd.org.uk/install_chrome.sh ...