就不告诉你就不告诉你是什么儿歌| 职业年金是什么意思| 辣椒有什么营养价值| 肺部纤维化是什么意思| 女生的下面长什么样| 痛风忌口不能吃什么东西| 荷花什么时候种植| 头皮脂溢性皮炎用什么洗发水| 乘风破浪是什么生肖| 不凝血是什么原因| 玉米笋是什么| 胰腺在人体起什么作用| 胆囊切除后对身体有什么影响| 男人吃什么可以增强性功能| 口干口苦什么原因| 耳朵痛用什么药| 人心不足蛇吞象是什么意思| 拉肚子为什么会肚子疼| 深是什么生肖| 老放屁什么原因| 什么叫四大皆空| 踢皮球是什么意思| 老抽和生抽有什么区别| 3月24日什么星座| 虎头虎脑是什么生肖| 墨菲定律是什么意思| 小腿为什么会抽筋| fgr医学上是什么意思| 胎儿左侧侧脑室增宽的原因是什么| 蝶变是什么意思| 呼吸快是什么原因| 葫芦的寓意是什么| 承字属于五行属什么| 今天什么日子| 11月11日什么星座| 贝尔发明了什么东西| 查甲状腺挂什么科| 吃花生米有什么好处| 钾是什么| 脸上爱长痘痘是什么原因| 名不见经传是什么意思| 为什么喝中药会拉肚子| 什么是神经官能症| 亚撒西什么意思| 迪丽热巴的全名叫什么| 什么食物含蛋白质高| 祖庭是什么意思| ch是什么| 便秘用什么药效果好| reebok是什么牌子| es什么意思| 烊什么意思| 星期五右眼皮跳是什么预兆| 什么是阴蒂| karen是什么意思| 脱疽是什么意思| 唯有读书高的前一句是什么| 甜虾是什么虾| 盐是什么| 睾丸痒是什么原因| 乳腺囊实性结节是什么意思| 25年是什么婚| 狗狗肠胃炎吃什么药| 优甲乐是什么药| 胃窦充血水肿意味着什么| 鱼翅是什么| 阳虚吃什么中成药| 较重闭合性跌打损伤是什么意思| avia是什么牌子| 军校出来能干什么| 带id是什么意思| 看日出是什么生肖| winner是什么意思| 撕漫男什么意思| 尿痛什么原因| 桑叶泡水喝有什么好处| 氨基酸有什么作用| 熠字五行属什么| 黄芪长什么样子| 软肋是什么意思| 孕妇吃冰的东西对胎儿有什么影响| 普洱茶属于什么茶| 阿莫西林有什么副作用| 子宫回声欠均匀是什么意思| dazzle是什么牌子| 普字五行属什么| 中央电视台台长是什么级别| 喝酒喝吐了用什么缓解| 春天有什么植物| 什么的教室填空| 扁桃体有什么作用| 胆碱酯酶高是什么意思| 尿维生素c弱阳性是什么意思| 万圣节什么时候| 吆西是什么意思| 舌头白腻厚苔是什么原因| 血压高不能吃什么| 塑料属于什么垃圾| 一热就头疼是什么原因| 登高望远是什么生肖| 恶露是什么| 巴宝莉是什么牌子| 联手是什么意思| 儿女情长是什么意思| 低血压对身体有什么影响| 四面受敌是什么动物| 食管在什么位置图片| 宫颈纳囊用什么药治疗效果好| 什么人不能喝咖啡| 消肿用什么药| 出圈是什么意思| 肌病是什么病| 菊花长什么样| 王毅什么级别| 攒肚是什么意思| 8.23是什么星座| 北京市副市长什么级别| 镶牙用什么材料好| 穹窿是什么意思| 梦见吃肉是什么意思| 4月26日是什么星座| 喘粗气是什么原因| 打呼噜是什么原因引起的| 公鸡的尾巴有什么作用| 发冷发热是什么原因| 车加昆念什么| 什么样的疤痕影响当兵| 白带黄绿是什么原因| 吊龙是什么| 私生子什么意思| 癫痫患者不能吃什么| sapphire手表什么牌子| 猪脚和猪蹄有什么区别| 吹面不寒杨柳风什么意思| 君无戏言什么意思| 高职本科是什么意思| b型和ab型生的孩子是什么血型| 什么是网红| 左眼一直跳是什么原因| 孕妇肠胃炎能吃什么药| 舌苔厚发黄是什么原因| 手一直脱皮是什么原因| 什么食物增加血管弹性| exo是什么意思啊| 武汉属于什么地区| 什么病不能吃空心菜| 乙状结肠腺瘤是什么病| 碳酸氢钠是什么| 极有家是什么意思| 忠厚是什么意思| tommyhilfiger什么牌子| 被艹是什么感觉| 口腔溃疡什么样| 缺爱是什么意思| 多吃海带有什么好处和坏处| 为什么痛风就痛一只脚| 夜字五行属什么| 红斑狼疮是什么症状| 归脾丸的功效与作用治什么病| 老犯困是什么原因| 草字头加青读什么| 孕妇尿路感染吃什么药| 男性生殖长水泡是什么原因| 备孕期间要注意什么| 脾虚胃热吃什么中成药| 脑膜炎有什么症状| 炎字五行属什么| 什么相关四字成语| 脾疼是什么原因| 六月初一什么日子| 不出汗是什么病| 人为什么会生病| 猫可以看到什么颜色| 薛之谦为什么离婚| 还记得年少时的梦吗是什么歌| 身份证什么时候开始有的| 家里出现蚂蚁预示什么| 藤茶是什么茶| 百日咳是什么| 双十一从什么时候开始| 微不足道的意思是什么| 徒木立信是什么意思| 糖醋排骨是什么菜系| 脸上黑色的小点是什么| 风雨交加是什么生肖| 亚洲没有什么气候| 感染科主要看什么病| 抵抗力差吃什么可以增强抵抗力| 放化疗期间吃什么好| 棕色用什么颜色调出来| 暑假是什么时候| 锌是补什么的| 胃疼应该挂什么科| 家庭养什么狗最干净| 什么叫捞女| 闪卡是什么意思| 什么是月食| 早搏是什么| 1989年出生的是什么命| 口干口苦口臭是什么原因引起的| 检查幽门螺杆菌挂什么科| 胎盘做成胶囊吃有什么好处| 通告是什么意思| 长绒棉是什么面料| 乳房边缘疼是什么原因| 膀胱炎有什么症状| 质量是什么| 热狗为什么叫热狗| 黑彩是什么| pet-ct主要检查什么| 空心人是什么意思| 除了肠镜还有什么方法检查肠道| 三基色是什么颜色| 贵人是什么意思| 做三明治需要什么材料| 光宗耀祖是什么意思| 五月是什么月| 为什么肚子老是胀气| 断章取义什么意思| 保护嗓子长期喝什么茶| 生姜黄叶病用什么药| 托帕石是什么宝石| 吊龙是什么| 甲母痣是什么| 把头是什么意思| 585是什么金| 梨花压海棠是什么意思| 铲垃圾的工具叫什么| 惊弓之鸟什么意思| 莲子吃了有什么好处| 3月是什么季节| 入宅是什么意思| 病理单克隆抗体检测是什么| 头发容易断是什么原因| columbia是什么牌子| 1900年属什么生肖| 人民币用什么材料做的| 水落石出开过什么生肖| 月经期间头疼是什么原因| 为什么很多人不去庐山| miniso是什么意思| 凌晨三点是什么时辰| 什么扑鼻| 乳腺疼挂什么科| 玉皇大帝姓什么| 下巴长痘是为什么| 孙悟空是个什么样的人| 34周为什么不建议保胎| 狗哭了代表什么预兆| 果断是什么意思| 四个龙念什么| 女生右手中指戴戒指什么意思| 心肌炎做什么检查| 月寸读什么| 姝姝是什么意思| 心房纤颤是什么意思| 尿尿疼是什么原因| ph值小于7是什么意思| 院士相当于什么级别| 蜈蚣代表什么生肖| 女人肝胆湿热吃什么药| 手足口病吃什么药好得快| 筵是什么意思| 缅铃是什么| 百度

柔软的什么

百度 拥有中国最大淡水湖鄱阳湖等河湖资源的江西,是长江中下游地区湿地资源较为丰富的省份之一。

Implement overload protection for high traffic scenarios


A GraphQL server can implement overload protection to help it remain available while under high load. With overload protection, a server monitors its resource usage and begins shedding incoming traffic whenever that usage approaches a performance-degrading limit (such as running out of memory).

As you add capabilities and users to your supergraph, you might introduce new usage patterns that add unexpectedly high load. Overload protection helps reduce the impact of these spikes while you optimize your supergraph to eliminate them entirely.

Example scenarios

A common source of overload in a system is the thundering herd problem, where a large number of processes or clients attempt to access limited computer resources. Many scenarios can cause this, for example:

  • Pod failures in Kubernetes cause a smaller amount of pods to handle the same amount of traffic.

  • A marketing campaign or viral social media post drives high traffic to an application in a short period.

  • A newly deployed feature introduces more load on the graph than expected.

A more graph-based problem is adding an entity relationship in the schema that causes a significant increase in traffic. For example in the Star Wars schema, imagine if there was no link from Person to Film(though PersonFilmsConnection) and it was added today. Until the usage of that new connection in the schema flattens out, every deployment or event that causes traffic could cause a large amount of new load directly attributed to the change for the owner of the Film entity.

Implementing in Express

Overload protection packages are available for most popular languages and server frameworks. For example, we'll look at using the overload-protection package with the @apollo/server package. This drop-in package enables your server to return a 503 based any of the following:

  • The current event loop delay

  • The amount of bytes used by the heap

  • The amount of bytes used by Resident Set Size (RSS).

To use overload-protection, you include it in your Express startup like so:

JavaScript
1import express from 'express';
2import protect from 'overload-protection';
3
4const app = express();
5protect('express');
6app.use(protect);
note
If you're currently using the startStandaloneServer function, you'll need to swap to expressMiddleware before adding overload protection.

If you're using @apollo/server's Express integration (that isexpressMiddleware), you can add overload-protection via Express middleware by adding the highlighted lines to your server creation:

JavaScript
index.js
1import {ApolloServer} from '@apollo/server';
2import {expressMiddleware} from '@apollo/server/express4';
3import {ApolloServerPluginDrainHttpServer} from '@apollo/server/plugin/drainHttpServer';
4import express from 'express';
5import http from 'http';
6import cors from 'cors';
7import {typeDefs, resolvers} from './schema';
8import protect from 'overload-protection';
9protect('express');
10
11const app = express();
12app.use(protect);
13const httpServer = http.createServer(app);
14const server = new ApolloServer({
15  typeDefs,
16  resolvers,
17  plugins: [ApolloServerPluginDrainHttpServer({httpServer})]
18});
19
20// Note the top-level `await` calls below!
21await server.start();
22app.use('/graphql', cors(), express.json(), expressMiddleware(server));
23await new Promise(resolve => httpServer.listen({port: 4000}, resolve));
24console.log(`?? Server ready at http://localhost:4000/graphql`);

This approach also works if you're using the @apollo/subgraph library to create your subgraphs in a similar way.

Overload protection is not specific to GraphQL, so it's best to handle it outside of Apollo software.

Protecting a supergraph

When adding overload protection to a supergraph, a reasonable question is, "Do I add protection to my gateway/router or to my individual subgraphs?" The short answer is "both":

  • Protecting the router protects the availability of the supergraph as a whole.

  • Protecting a subgraph reduces the error rate for queries that request data from that subgraph.

Gateway/router

The main concern with the gateway is a buildup of requests that cause partial or cascading failures. If the gateway can't shed excessive load, its performance starts to degrade.

A single request to the gateway usually transforms into multiple requests to subgraphs, which can increase load more than expected for complex queries. In such cases, overload protection in the gateway can save it from falling over entirely. This looks like a temporary dip in availability instead of a total outage.

Subgraphs

A failure in a subgraph can cause a backup in the gateway. If this backup is due to load, overload protection helps short-circuit the return of an error. This relieves the pressure in both the gateway and the subgraph by allowing the gateway to return errors faster.

Additional protections

To further protect against overloading your graph and system, you should enable limiting query depth and rate limiting.

手长水泡是什么原因 脸上肉跳动是什么原因 一竖一点念什么 颈椎增生吃什么药 mv是什么单位
贫血会出现什么症状 卸妆用什么最好 蒜薹和蒜苔有什么区别 路的尽头是什么 云字属于五行属什么
guess是什么牌子 科学家是干什么的 什么品牌的床好 杨利伟什么军衔 脚酸臭是什么原因
甲状腺发炎有什么症状 什么是太岁 两边太阳胀痛什么原因引起的 结石什么原因引起的 喝酒脸红是什么原因造成的
1.27是什么星座hcv8jop3ns0r.cn k9什么意思hanqikai.com 十一月四日是什么星座hcv9jop0ns7r.cn 拔牙之后需要注意什么事项hcv9jop0ns8r.cn 小圆细胞阳性什么意思hcv8jop1ns0r.cn
眉毛中间长痘痘是什么原因hcv8jop3ns5r.cn 变色龙形容什么样的人zhiyanzhang.com 排便困难用什么药hcv8jop5ns1r.cn 什么名字最好听bysq.com 三国时期是什么朝代0735v.com
鄂尔多斯为什么叫鬼城hcv7jop7ns4r.cn 一竖读什么hcv8jop7ns4r.cn 戊肝抗体igg阳性是什么意思hcv7jop6ns8r.cn 什么是善良hcv9jop5ns2r.cn 右肺上叶结节什么意思hcv8jop0ns7r.cn
女人乳房疼是什么原因hanqikai.com 螚什么意思hcv7jop6ns8r.cn 薄荷叶有什么功效hcv8jop4ns4r.cn 什么时候拔罐最好hcv7jop9ns9r.cn 1945年是什么年bjcbxg.com
百度