Files
wonder df63692a18
Deploy Examination / deploy (push) Successful in 31s
feat: add 180 questions (90 sc + 90 fb) for networking subtopics
Cover 9 subtopics from the computer networking documentation:
- http-handshake: TCP/TLS/HTTP2/HTTP3 handshakes
- http-connection-cost: connection resource overhead & million concurrency
- connection-pooling: pool reuse, HTTP/1.1 vs HTTP/2
- http-keepalive: Keep-Alive principle, head-of-line blocking
- keepalive-scenarios: when to enable/disable Keep-Alive
- domain-sharding: HTTP/1.1 hack, HTTP/2 obsolescence
- cdn: edge nodes, caching, DDoS protection
- cors: same-origin policy, preflight requests
- go-build-strip: -s -w flags, binary size optimization
2026-09-02 21:33:09 +08:00

209 lines
6.6 KiB
JSON

{
"topic": "domain-sharding",
"type": "single_choice",
"schema_version": "1.0.0",
"generated": "2026-09-02T21:20:00+08:00",
"questions": [
{
"id": "sc-001",
"type": "single_choice",
"difficulty": 2,
"tags": [
"域名分片",
"浏览器限制"
],
"question": "浏览器对同一域名最多同时开多少个 TCP 连接?",
"options": {
"A": "2 个",
"B": "4 个",
"C": "6 个",
"D": "10 个"
},
"answer": "C",
"explanation": "浏览器对同一域名最多同时开 6 个 TCP 连接,这是浏览器厂商的经验值,不是协议规定。这个限制在 HTTP/2 时代已经过时。",
"source": null,
"related": []
},
{
"id": "sc-002",
"type": "single_choice",
"difficulty": 3,
"tags": [
"域名分片",
"原理"
],
"question": "域名分片的原理是什么?",
"options": {
"A": "增加服务器数量",
"B": "用多个子域名指向同一服务器,每个域名都能开 6 个连接",
"C": "使用 HTTP/2 协议",
"D": "增大 TCP 窗口"
},
"answer": "B",
"explanation": "域名分片用多个子域名指向同一台服务器,每个域名都能开 6 个连接。例如 3 个子域名 × 6 个连接 = 18 个并行连接。",
"source": null,
"related": []
},
{
"id": "sc-003",
"type": "single_choice",
"difficulty": 3,
"tags": [
"域名分片",
"代价"
],
"question": "域名分片的代价不包括以下哪项?",
"options": {
"A": "DNS 解析开销",
"B": "TLS 握手开销",
"C": "缓存碎片化",
"D": "加密失败"
},
"answer": "D",
"explanation": "域名分片的代价包括:DNS 解析开销(每个子域名都要单独解析,5-50ms)、TLS 握手开销(每个新域名要单独做 TLS 握手)、缓存碎片化(不同域名的缓存独立,不能共享)。",
"source": null,
"related": []
},
{
"id": "sc-004",
"type": "single_choice",
"difficulty": 4,
"tags": [
"域名分片",
"HTTP/2"
],
"question": "为什么 HTTP/2 不需要域名分片?",
"options": {
"A": "HTTP/2 支持更多连接",
"B": "HTTP/2 的多路复用让一个 TCP 连接就能真正并行",
"C": "HTTP/2 自动分片",
"D": "HTTP/2 使用 UDP"
},
"answer": "B",
"explanation": "HTTP/2 的多路复用让一个 TCP 连接就能真正并行处理多个请求/响应,不再需要多个 TCP 连接来并行,域名分片变成了负优化。",
"source": null,
"related": []
},
{
"id": "sc-005",
"type": "single_choice",
"difficulty": 2,
"tags": [
"域名分片",
"实现"
],
"question": "域名分片的实现方式是什么?",
"options": {
"A": "修改服务器配置",
"B": "前端 HTML 里把资源 URL 的域名换掉",
"C": "使用 CDN",
"D": "修改 DNS 解析"
},
"answer": "B",
"explanation": "域名分片只需在前端 HTML 里把资源 URL 的域名换掉(如 img1.example.com、img2.example.com),服务器端不用改动,所有子域名 DNS 解析到同一台机器就行。",
"source": null,
"related": []
},
{
"id": "sc-006",
"type": "single_choice",
"difficulty": 4,
"tags": [
"域名分片",
"缓存"
],
"question": "域名分片导致缓存碎片化的原因是什么?",
"options": {
"A": "缓存服务器过载",
"B": "不同域名的缓存独立,不能共享",
"C": "DNS 缓存过期",
"D": "TLS 握手失败"
},
"answer": "B",
"explanation": "域名分片导致缓存碎片化,因为不同域名的缓存独立,不能共享,可能重复下载相同资源。这是域名分片的主要代价之一。",
"source": null,
"related": []
},
{
"id": "sc-007",
"type": "single_choice",
"difficulty": 3,
"tags": [
"域名分片",
"数量"
],
"question": "域名分片的子域名数量一般是多少?",
"options": {
"A": "1-2 个",
"B": "3-4 个",
"C": "10-20 个",
"D": "越多越好"
},
"answer": "B",
"explanation": "域名分片的子域名数量一般 3-4 个就够了。过多子域名意味着更多 DNS 查询和 TLS 握手,反而拖慢加载速度。",
"source": null,
"related": []
},
{
"id": "sc-008",
"type": "single_choice",
"difficulty": 2,
"tags": [
"域名分片",
"DNS"
],
"question": "域名分片中,所有子域名的 DNS 解析应该指向什么?",
"options": {
"A": "不同的服务器",
"B": "同一台机器",
"C": "CDN 节点",
"D": "负载均衡器"
},
"answer": "B",
"explanation": "域名分片中所有子域名的 DNS 解析应该指向同一台机器,服务器端不用改动。前端只需把资源 URL 的域名换掉。",
"source": null,
"related": []
},
{
"id": "sc-009",
"type": "single_choice",
"difficulty": 4,
"tags": [
"域名分片",
"HTTP/2",
"负优化"
],
"question": "在 HTTP/2 站点上使用域名分片会导致什么?",
"options": {
"A": "性能提升",
"B": "负优化——多了 DNS 和 TLS 开销,还破坏了缓存统一性",
"C": "没有影响",
"D": "自动降级到 HTTP/1.1"
},
"answer": "B",
"explanation": "HTTP/2 的多路复用让域名分片变成了负优化——多了 DNS 和 TLS 开销,还破坏了缓存统一性。如果站点已经上了 HTTP/2,应该去掉域名分片。",
"source": null,
"related": []
},
{
"id": "sc-010",
"type": "single_choice",
"difficulty": 3,
"tags": [
"域名分片",
"演进"
],
"question": "HTTP 连接复用的演进中,域名分片出现在哪个阶段?",
"options": {
"A": "HTTP/1.0 之前",
"B": "HTTP/1.1 + Keep-Alive 之后,HTTP/2 之前",
"C": "HTTP/2 之后",
"D": "HTTP/3 之后"
},
"answer": "B",
"explanation": "域名分片是 HTTP/1.1 时代的 hack,出现在 HTTP/1.1 + Keep-Alive 之后,HTTP/2 之前。HTTP/2 的多路复用从根本上解决了这个问题。",
"source": null,
"related": []
}
]
}