Skip to Content
Node与Express开发(第2版)
book

Node与Express开发(第2版)

by Ethan Brown
June 2021
Intermediate to advanced
290 pages
9h 21m
Chinese
Posts & Telecom Press
Content preview from Node与Express开发(第2版)
124
|
第
12
章
到,而你们的客户为此损失了
10 000
美元的销售额)。
网站发生故障是你控制不了的事,它们就像死亡和税收一样不可避免。然而,你力所能及
的、能让老板和客户信服的方式是:永远先于他们知道故障发生了。
第三方在线监控
在网站服务器上运行一个在线监控,就相当于给没有人居住的屋子安装一个烟雾报警器,
十分有用。如果是某个页面不正常,你要捕获错误或许还有可能,但如果是整个
服务器
停
机了,那么它甚至都不能向外界发出一个“求救信号”,更不用说捕获错误了。这就是为
什么你的第一道防线应该是第三方的在线监控。
UptimeRobo
t
可以免费支持多达
50
个监
控,而且配置起来很简单。警告方式有邮件、手机短信、
T
witter
和
Slack
(以及其他办公
产品)。对于一个网页,你可以检查它的返回码(除了
200
,其他返回码都被认为是错误
的),或者通过确认某个关键字是否存在来实现监控。不过要记住,如果你使用关键字监
控,就可能会影响到网站的流量分析(在大多数流量分析服务中,你可以把来自在线监控
的流量排除)。
12.6
 压力测试
压力测试
(或
负载测试
)的作用就在于给予你一定的信心,让你看到你的服务器能在数百
个或数千个并行请求之下运转如常。这是另一个很深奥的领域,可以写一本书了。压力测
试可以很复杂,而复杂程度很大程度上取决于项目本质。如果你确信你的网站将极其火
爆,就需要在压力测试上投入更多的时间。
让我们使用
Artillery
增加一个简单的压力测试
。首先安装
Artillery
:
npm install -g
artillery ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

面向对象的思考过程(原书第5版)

面向对象的思考过程(原书第5版)

马特 魏斯费尔德
精通模块化JavaScript

精通模块化JavaScript

Nicolás Bevacqua

Publisher Resources

ISBN: 9787115565099