rat_engine 1.0.5

高性能Rust HTTP服务器引擎,提供Flask风格的API和自动硬件优化功能
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
   Compiling rat_engine v1.0.0 (/Users/0ldm0s/workspaces/rust/rat/rat_engine)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.61s
     Running `target/debug/examples/cache_compression_performance_test`
🚀 启动缓存压缩协调器性能测试
📋 测试目标: 验证不同策略下的性能表现
🌐 服务器启动在: http://127.0.0.1:3001
12:10:35.797 INFO  拥塞控制已禁用
12:10:35.798 INFO  RAT Engine Performance Configuration:
12:10:35.798 INFO     📊 CPU Cores: 8
12:10:35.798 INFO     📊 Workers: 8
12:10:35.798 INFO     🧠 Memory Allocator: mimalloc (Microsoft's high-performance allocator)
12:10:35.798 INFO     🔗 CPU Affinity: Enabled
12:10:35.798 INFO     🔧 Performance optimization: Enabled
12:10:35.798 INFO     💾 Total Memory: 8192 MB
12:10:35.798 INFO     🖥️  OS: Darwin
12:10:35.798 INFO     📝 Logging: Terminal output enabled
12:10:35.798 INFO  Performance optimization initialized successfully
12:10:35.798 DEBUG 🔐 已安装 rustls aws_lc_rs CryptoProvider
12:10:35.798 INFO  🌐 RAT Engine server running on 127.0.0.1:3001 (支持: HTTP/1.1)
12:10:35.798 INFO  📋 已注册的 HTTP 路由:
12:10:35.798 INFO     GET /dynamic-data
12:10:35.798 INFO     GET /raw-data
12:10:35.798 INFO     GET /small-data
12:10:35.798 INFO     GET /large-data
12:10:35.798 INFO  🌐 服务器支持 HTTP 请求
12:10:35.798 INFO  ✅ Started 8 worker threads
12:10:35.798 DEBUG Worker 1 started
12:10:35.798 DEBUG Worker 7 started
12:10:35.798 DEBUG Worker 4 started
12:10:35.798 DEBUG Worker 0 started
12:10:35.798 DEBUG Worker 5 started
12:10:35.798 DEBUG Worker 2 started
12:10:35.798 DEBUG Worker 6 started
12:10:35.798 DEBUG Worker 3 started

🧪 开始性能测试...

📊 测试场景: 小数据 (仅缓存)
   路径: /small-data
   开始测试...
   🔄 执行第1次请求...
🔍 [服务端] 开始 psi_detector 协议检测: 127.0.0.1:59878 (数据长度: 99)
🔍 [服务端] 接收到的数据预览: GET /small-data HTTP/1.1
accept-encoding: gzip, d
🔍 [服务端] psi_detector 检测结果: 127.0.0.1:59878 (置信度: 95.0%, 协议: HTTP1_1)
🌐 [服务端] 路由到 HTTP/1.1 处理器: 127.0.0.1:59878
12:10:36.845 DEBUG 🔍 [HyperAdapter] 收到请求: GET /small-data
12:10:36.845 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:36.845 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:36.845 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /small-data
12:10:36.845 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:36.845 DEBUG 🔍 [Router] 匹配到标准路由: GET /small-data
12:10:36.845 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:36.947 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/small-data
12:10:36.947 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/small-data
12:10:36.947 DEBUG [CACHE] L1 缓存未命中: GET/small-data
12:10:36.948 DEBUG [CACHE] L2 缓存未命中: GET/small-data
12:10:36.948 DEBUG [CACHE] 缓存未命中: GET/small-data
12:10:36.948 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/small-data, found=true
12:10:36.948 DEBUG 缓存未命中! 键: GET/small-data
12:10:36.948 DEBUG 缓存未命中! 键: GET/small-data
12:10:36.948 INFO  🎯 [CacheMiddleware] 检查Cache-Control头: public, max-age=300
12:10:36.948 DEBUG 🎯 [CacheMiddleware] 响应可以缓存
12:10:36.948 INFO  🎯 [CacheMiddleware] 响应可以缓存,开始存储...
12:10:36.948 DEBUG [TTL] 添加键 GET/small-data 的过期时间: 1758946296
12:10:36.948 DEBUG [CACHE] L1 缓存设置: GET/small-data (未压缩)
12:10:36.948 DEBUG [CACHE] 缓存设置完成: GET/small-data (大值: false, L1: true, L2: false)
12:10:36.948 DEBUG 响应已缓存! 键: GET/small-data
12:10:36.948 INFO  📊 127.0.0.1 GET /small-data 200 103ms
12:10:36.948 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 103ms
12:10:36.948 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:36.948 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/json", "cache-control": "public, max-age=300", "x-cache": "MISS"}
12:10:36.948 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:36.948 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:36.948 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第1次请求结果:
     - 状态码: 200 OK
     - 响应时间: 106ms
     - 响应大小: 38字节
     - 缓存状态: MISS
     - 压缩编码: none
   ⏳ 等待500ms后继续下一次请求...
   🔄 执行第2次请求...
12:10:37.451 DEBUG 🔍 [HyperAdapter] 收到请求: GET /small-data
12:10:37.451 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:37.451 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:37.451 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /small-data
12:10:37.451 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:37.451 DEBUG 🔍 [Router] 匹配到标准路由: GET /small-data
12:10:37.451 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:37.553 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/small-data
12:10:37.553 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/small-data
12:10:37.554 DEBUG [CACHE] L1 缓存命中: GET/small-data
12:10:37.554 DEBUG [TRANSFER] L1 缓存命中: GET/small-data
12:10:37.554 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/small-data, found=true
12:10:37.554 DEBUG 缓存命中! 键: GET/small-data, 耗时: 224.334µs
12:10:37.554 INFO  📊 127.0.0.1 GET /small-data 200 102ms
12:10:37.554 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 102ms
12:10:37.554 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:37.554 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/octet-stream", "x-cache": "HIT", "x-cache-time": "224.334\xc2\xb5s"}
12:10:37.554 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:37.554 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:37.554 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第2次请求结果:
     - 状态码: 200 OK
     - 响应时间: 104ms
     - 响应大小: 38字节
     - 缓存状态: HIT
     - 压缩编码: none
   ⏳ 等待500ms后继续下一次请求...
   🔄 执行第3次请求...
12:10:38.057 DEBUG 🔍 [HyperAdapter] 收到请求: GET /small-data
12:10:38.058 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:38.058 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:38.058 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /small-data
12:10:38.058 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:38.058 DEBUG 🔍 [Router] 匹配到标准路由: GET /small-data
12:10:38.058 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:38.160 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/small-data
12:10:38.160 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/small-data
12:10:38.160 DEBUG [CACHE] L1 缓存命中: GET/small-data
12:10:38.160 DEBUG [TRANSFER] L1 缓存命中: GET/small-data
12:10:38.160 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/small-data, found=true
12:10:38.160 DEBUG 缓存命中! 键: GET/small-data, 耗时: 197.459µs
12:10:38.160 INFO  📊 127.0.0.1 GET /small-data 200 102ms
12:10:38.160 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 102ms
12:10:38.160 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:38.161 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/octet-stream", "x-cache": "HIT", "x-cache-time": "197.459\xc2\xb5s"}
12:10:38.161 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:38.161 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:38.161 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第3次请求结果:
     - 状态码: 200 OK
     - 响应时间: 105ms
     - 响应大小: 38字节
     - 缓存状态: HIT
     - 压缩编码: none

   📈 统计结果:
     - 平均响应时间: 105.00ms
     - 平均响应大小: 38字节
     - 缓存命中率: 2/3 (66.7%)
     - 压缩应用率: 0/3 (0.0%)

📊 测试场景: 大数据 (缓存+压缩)
   路径: /large-data
   开始测试...
   🔄 执行第1次请求...
12:10:38.162 DEBUG 🔍 [HyperAdapter] 收到请求: GET /large-data
12:10:38.162 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:38.162 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:38.162 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /large-data
12:10:38.162 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:38.162 DEBUG 🔍 [Router] 匹配到标准路由: GET /large-data
12:10:38.162 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:38.685 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/large-data
12:10:38.685 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/large-data
12:10:38.685 DEBUG [CACHE] L1 缓存未命中: GET/large-data
12:10:38.686 DEBUG [CACHE] L2 缓存未命中: GET/large-data
12:10:38.686 DEBUG [CACHE] 缓存未命中: GET/large-data
12:10:38.686 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/large-data, found=true
12:10:38.686 DEBUG 缓存未命中! 键: GET/large-data
12:10:38.686 DEBUG 缓存未命中! 键: GET/large-data
12:10:38.686 INFO  🎯 [CacheMiddleware] 检查Cache-Control头: public, max-age=600
12:10:38.686 DEBUG 🎯 [CacheMiddleware] 响应可以缓存
12:10:38.686 INFO  🎯 [CacheMiddleware] 响应可以缓存,开始存储...
12:10:38.686 DEBUG [TTL] 添加键 GET/large-data 的过期时间: 1758946298
12:10:38.686 DEBUG [CACHE] L1 缓存设置: GET/large-data (未压缩)
12:10:38.686 DEBUG [TTL] 添加键 GET/large-data 的过期时间: 1758946298
12:10:38.686 DEBUG [CACHE] L2 缓存设置: GET/large-data (未压缩)
12:10:38.686 DEBUG [CACHE] 缓存设置完成: GET/large-data (大值: false, L1: true, L2: false)
12:10:38.686 DEBUG 响应已缓存! 键: GET/large-data
12:10:38.693 INFO  🗜️ [Compression] 使用 gzip 压缩,原始大小: 87823 bytes,压缩后: 2429 bytes,压缩比: 2.77%
12:10:38.693 INFO  📊 127.0.0.1 GET /large-data 200 530ms
12:10:38.693 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 530ms
12:10:38.693 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:38.693 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/json", "cache-control": "public, max-age=600", "x-cache": "MISS", "content-encoding": "gzip", "content-length": "2429", "x-compressed-size": "2429"}
12:10:38.693 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:38.693 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:38.693 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第1次请求结果:
     - 状态码: 200 OK
     - 响应时间: 532ms
     - 响应大小: 2429字节
     - 缓存状态: MISS
     - 压缩编码: gzip
   ⏳ 等待500ms后继续下一次请求...
   🔄 执行第2次请求...
12:10:39.197 DEBUG 🔍 [HyperAdapter] 收到请求: GET /large-data
12:10:39.197 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:39.197 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:39.197 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /large-data
12:10:39.197 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:39.197 DEBUG 🔍 [Router] 匹配到标准路由: GET /large-data
12:10:39.198 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:39.705 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/large-data
12:10:39.705 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/large-data
12:10:39.705 DEBUG [CACHE] L1 缓存命中: GET/large-data
12:10:39.705 DEBUG [TRANSFER] L1 缓存命中: GET/large-data
12:10:39.705 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/large-data, found=true
12:10:39.705 DEBUG 缓存命中! 键: GET/large-data, 耗时: 71.084µs
12:10:39.708 INFO  🗜️ [Compression] 使用 gzip 压缩,原始大小: 87823 bytes,压缩后: 2429 bytes,压缩比: 2.77%
12:10:39.708 INFO  📊 127.0.0.1 GET /large-data 200 511ms
12:10:39.708 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 511ms
12:10:39.708 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:39.708 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/octet-stream", "x-cache": "HIT", "x-cache-time": "71.084\xc2\xb5s", "content-encoding": "gzip", "content-length": "2429", "x-compressed-size": "2429"}
12:10:39.708 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:39.708 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:39.708 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第2次请求结果:
     - 状态码: 200 OK
     - 响应时间: 512ms
     - 响应大小: 2429字节
     - 缓存状态: HIT
     - 压缩编码: gzip
   ⏳ 等待500ms后继续下一次请求...
   🔄 执行第3次请求...
12:10:40.211 DEBUG 🔍 [HyperAdapter] 收到请求: GET /large-data
12:10:40.211 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:40.211 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:40.211 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /large-data
12:10:40.211 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:40.211 DEBUG 🔍 [Router] 匹配到标准路由: GET /large-data
12:10:40.211 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:40.730 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/large-data
12:10:40.730 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/large-data
12:10:40.730 DEBUG [CACHE] L1 缓存命中: GET/large-data
12:10:40.730 DEBUG [TRANSFER] L1 缓存命中: GET/large-data
12:10:40.730 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/large-data, found=true
12:10:40.730 DEBUG 缓存命中! 键: GET/large-data, 耗时: 102.667µs
12:10:40.736 INFO  🗜️ [Compression] 使用 gzip 压缩,原始大小: 87823 bytes,压缩后: 2429 bytes,压缩比: 2.77%
12:10:40.737 INFO  📊 127.0.0.1 GET /large-data 200 525ms
12:10:40.737 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 525ms
12:10:40.737 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:40.737 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/octet-stream", "x-cache": "HIT", "x-cache-time": "102.667\xc2\xb5s", "content-encoding": "gzip", "content-length": "2429", "x-compressed-size": "2429"}
12:10:40.737 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:40.737 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:40.737 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第3次请求结果:
     - 状态码: 200 OK
     - 响应时间: 526ms
     - 响应大小: 2429字节
     - 缓存状态: HIT
     - 压缩编码: gzip

   📈 统计结果:
     - 平均响应时间: 523.33ms
     - 平均响应大小: 2429字节
     - 缓存命中率: 2/3 (66.7%)
     - 压缩应用率: 3/3 (100.0%)

📊 测试场景: 动态数据 (仅压缩)
   路径: /dynamic-data
   开始测试...
   🔄 执行第1次请求...
12:10:40.738 DEBUG 🔍 [HyperAdapter] 收到请求: GET /dynamic-data
12:10:40.738 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:40.738 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:40.738 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /dynamic-data
12:10:40.738 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:40.738 DEBUG 🔍 [Router] 匹配到标准路由: GET /dynamic-data
12:10:40.738 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:40.941 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/dynamic-data
12:10:40.941 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/dynamic-data
12:10:40.941 DEBUG [CACHE] L1 缓存未命中: GET/dynamic-data
12:10:40.941 DEBUG [CACHE] L2 缓存未命中: GET/dynamic-data
12:10:40.941 DEBUG [CACHE] 缓存未命中: GET/dynamic-data
12:10:40.941 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/dynamic-data, found=true
12:10:40.941 DEBUG 缓存未命中! 键: GET/dynamic-data
12:10:40.941 DEBUG 缓存未命中! 键: GET/dynamic-data
12:10:40.941 INFO  🎯 [CacheMiddleware] 检查Cache-Control头: no-cache, must-revalidate
12:10:40.941 INFO  🎯 [CacheMiddleware] 检测到no-cache/no-store,响应不可缓存
12:10:40.941 DEBUG 响应不可缓存,跳过缓存! 键: GET/dynamic-data
12:10:40.943 INFO  🗜️ [Compression] 使用 gzip 压缩,原始大小: 2482 bytes,压缩后: 306 bytes,压缩比: 12.33%
12:10:40.943 INFO  📊 127.0.0.1 GET /dynamic-data 200 205ms
12:10:40.943 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 205ms
12:10:40.943 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:40.943 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/json", "cache-control": "no-cache, must-revalidate", "x-cache": "MISS", "content-encoding": "gzip", "content-length": "306", "x-compressed-size": "306"}
12:10:40.943 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:40.943 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:40.943 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第1次请求结果:
     - 状态码: 200 OK
     - 响应时间: 206ms
     - 响应大小: 306字节
     - 缓存状态: MISS
     - 压缩编码: gzip
   ⏳ 等待500ms后继续下一次请求...
   🔄 执行第2次请求...
12:10:41.445 DEBUG 🔍 [HyperAdapter] 收到请求: GET /dynamic-data
12:10:41.445 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:41.445 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:41.445 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /dynamic-data
12:10:41.445 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:41.445 DEBUG 🔍 [Router] 匹配到标准路由: GET /dynamic-data
12:10:41.445 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:41.647 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/dynamic-data
12:10:41.647 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/dynamic-data
12:10:41.647 DEBUG [CACHE] L1 缓存未命中: GET/dynamic-data
12:10:41.647 DEBUG [CACHE] L2 缓存未命中: GET/dynamic-data
12:10:41.647 DEBUG [CACHE] 缓存未命中: GET/dynamic-data
12:10:41.647 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/dynamic-data, found=true
12:10:41.647 DEBUG 缓存未命中! 键: GET/dynamic-data
12:10:41.647 DEBUG 缓存未命中! 键: GET/dynamic-data
12:10:41.647 INFO  🎯 [CacheMiddleware] 检查Cache-Control头: no-cache, must-revalidate
12:10:41.647 INFO  🎯 [CacheMiddleware] 检测到no-cache/no-store,响应不可缓存
12:10:41.647 DEBUG 响应不可缓存,跳过缓存! 键: GET/dynamic-data
12:10:41.649 INFO  🗜️ [Compression] 使用 gzip 压缩,原始大小: 2481 bytes,压缩后: 305 bytes,压缩比: 12.29%
12:10:41.649 INFO  📊 127.0.0.1 GET /dynamic-data 200 203ms
12:10:41.649 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 203ms
12:10:41.649 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:41.649 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/json", "cache-control": "no-cache, must-revalidate", "x-cache": "MISS", "content-encoding": "gzip", "content-length": "305", "x-compressed-size": "305"}
12:10:41.649 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:41.649 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:41.649 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第2次请求结果:
     - 状态码: 200 OK
     - 响应时间: 204ms
     - 响应大小: 305字节
     - 缓存状态: MISS
     - 压缩编码: gzip
   ⏳ 等待500ms后继续下一次请求...
   🔄 执行第3次请求...
12:10:42.152 DEBUG 🔍 [HyperAdapter] 收到请求: GET /dynamic-data
12:10:42.152 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:42.152 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:42.152 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /dynamic-data
12:10:42.152 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:42.152 DEBUG 🔍 [Router] 匹配到标准路由: GET /dynamic-data
12:10:42.152 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:42.354 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/dynamic-data
12:10:42.354 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/dynamic-data
12:10:42.354 DEBUG [CACHE] L1 缓存未命中: GET/dynamic-data
12:10:42.354 DEBUG [CACHE] L2 缓存未命中: GET/dynamic-data
12:10:42.354 DEBUG [CACHE] 缓存未命中: GET/dynamic-data
12:10:42.354 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/dynamic-data, found=true
12:10:42.354 DEBUG 缓存未命中! 键: GET/dynamic-data
12:10:42.354 DEBUG 缓存未命中! 键: GET/dynamic-data
12:10:42.354 INFO  🎯 [CacheMiddleware] 检查Cache-Control头: no-cache, must-revalidate
12:10:42.355 INFO  🎯 [CacheMiddleware] 检测到no-cache/no-store,响应不可缓存
12:10:42.355 DEBUG 响应不可缓存,跳过缓存! 键: GET/dynamic-data
12:10:42.356 INFO  🗜️ [Compression] 使用 gzip 压缩,原始大小: 2483 bytes,压缩后: 306 bytes,压缩比: 12.32%
12:10:42.356 INFO  📊 127.0.0.1 GET /dynamic-data 200 204ms
12:10:42.356 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 204ms
12:10:42.356 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:42.356 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "application/json", "cache-control": "no-cache, must-revalidate", "x-cache": "MISS", "content-encoding": "gzip", "content-length": "306", "x-compressed-size": "306"}
12:10:42.356 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:42.356 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:42.356 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第3次请求结果:
     - 状态码: 200 OK
     - 响应时间: 205ms
     - 响应大小: 306字节
     - 缓存状态: MISS
     - 压缩编码: gzip

   📈 统计结果:
     - 平均响应时间: 205.00ms
     - 平均响应大小: 306字节
     - 缓存命中率: 0/3 (0.0%)
     - 压缩应用率: 3/3 (100.0%)

📊 测试场景: 原始数据 (无处理)
   路径: /raw-data
   开始测试...
   🔄 执行第1次请求...
12:10:42.357 DEBUG 🔍 [HyperAdapter] 收到请求: GET /raw-data
12:10:42.357 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:42.357 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:42.357 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /raw-data
12:10:42.357 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:42.357 DEBUG 🔍 [Router] 匹配到标准路由: GET /raw-data
12:10:42.357 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:42.409 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/raw-data
12:10:42.409 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/raw-data
12:10:42.409 DEBUG [CACHE] L1 缓存未命中: GET/raw-data
12:10:42.409 DEBUG [CACHE] L2 缓存未命中: GET/raw-data
12:10:42.409 DEBUG [CACHE] 缓存未命中: GET/raw-data
12:10:42.409 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/raw-data, found=true
12:10:42.409 DEBUG 缓存未命中! 键: GET/raw-data
12:10:42.409 DEBUG 缓存未命中! 键: GET/raw-data
12:10:42.409 INFO  🎯 [CacheMiddleware] 检查Cache-Control头: no-store
12:10:42.409 INFO  🎯 [CacheMiddleware] 检测到no-cache/no-store,响应不可缓存
12:10:42.409 DEBUG 响应不可缓存,跳过缓存! 键: GET/raw-data
12:10:42.409 INFO  📊 127.0.0.1 GET /raw-data 200 52ms
12:10:42.409 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 52ms
12:10:42.409 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:42.410 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "text/plain", "cache-control": "no-store", "x-cache": "MISS"}
12:10:42.410 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:42.410 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:42.410 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第1次请求结果:
     - 状态码: 200 OK
     - 响应时间: 52ms
     - 响应大小: 2字节
     - 缓存状态: MISS
     - 压缩编码: none
   ⏳ 等待500ms后继续下一次请求...
   🔄 执行第2次请求...
12:10:42.912 DEBUG 🔍 [HyperAdapter] 收到请求: GET /raw-data
12:10:42.913 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:42.913 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:42.913 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /raw-data
12:10:42.913 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:42.913 DEBUG 🔍 [Router] 匹配到标准路由: GET /raw-data
12:10:42.913 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:42.964 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/raw-data
12:10:42.964 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/raw-data
12:10:42.964 DEBUG [CACHE] L1 缓存未命中: GET/raw-data
12:10:42.964 DEBUG [CACHE] L2 缓存未命中: GET/raw-data
12:10:42.964 DEBUG [CACHE] 缓存未命中: GET/raw-data
12:10:42.964 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/raw-data, found=true
12:10:42.964 DEBUG 缓存未命中! 键: GET/raw-data
12:10:42.964 DEBUG 缓存未命中! 键: GET/raw-data
12:10:42.964 INFO  🎯 [CacheMiddleware] 检查Cache-Control头: no-store
12:10:42.964 INFO  🎯 [CacheMiddleware] 检测到no-cache/no-store,响应不可缓存
12:10:42.964 DEBUG 响应不可缓存,跳过缓存! 键: GET/raw-data
12:10:42.964 INFO  📊 127.0.0.1 GET /raw-data 200 51ms
12:10:42.964 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 51ms
12:10:42.964 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:42.964 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "text/plain", "cache-control": "no-store", "x-cache": "MISS"}
12:10:42.964 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:42.964 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:42.964 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第2次请求结果:
     - 状态码: 200 OK
     - 响应时间: 52ms
     - 响应大小: 2字节
     - 缓存状态: MISS
     - 压缩编码: none
   ⏳ 等待500ms后继续下一次请求...
   🔄 执行第3次请求...
12:10:43.466 DEBUG 🔍 [HyperAdapter] 收到请求: GET /raw-data
12:10:43.467 DEBUG 🔍 [HyperAdapter] 请求头: {"accept-encoding": "gzip, deflate, br", "accept": "*/*", "host": "127.0.0.1:3001"}
12:10:43.467 DEBUG 🔍 [HyperAdapter] 开始路由处理...
12:10:43.467 DEBUG 🔍 [Router] 处理 HTTP 请求: GET /raw-data
12:10:43.467 DEBUG ℹ️ [Router] 协议检测已在 TCP 层完成
12:10:43.467 DEBUG 🔍 [Router] 匹配到标准路由: GET /raw-data
12:10:43.467 DEBUG 🔍 [Router] apply_cache 方法被调用
12:10:43.517 INFO  🎯 [CacheMiddleware] 生成的缓存键: GET/raw-data
12:10:43.517 DEBUG [CACHE] 🎯 [RatMemCache] GET 操作: key=GET/raw-data
12:10:43.517 DEBUG [CACHE] L1 缓存未命中: GET/raw-data
12:10:43.517 DEBUG [CACHE] L2 缓存未命中: GET/raw-data
12:10:43.517 DEBUG [CACHE] 缓存未命中: GET/raw-data
12:10:43.517 DEBUG [CACHE] 🎯 [RatMemCache] GET 结果: key=GET/raw-data, found=true
12:10:43.517 DEBUG 缓存未命中! 键: GET/raw-data
12:10:43.517 DEBUG 缓存未命中! 键: GET/raw-data
12:10:43.517 INFO  🎯 [CacheMiddleware] 检查Cache-Control头: no-store
12:10:43.517 INFO  🎯 [CacheMiddleware] 检测到no-cache/no-store,响应不可缓存
12:10:43.517 DEBUG 响应不可缓存,跳过缓存! 键: GET/raw-data
12:10:43.517 INFO  📊 127.0.0.1 GET /raw-data 200 50ms
12:10:43.517 DEBUG 🔍 [HyperAdapter] 路由处理成功,总耗时: 50ms
12:10:43.517 DEBUG 🔍 [HyperAdapter] 响应状态码: 200 OK
12:10:43.517 DEBUG 🔍 [HyperAdapter] 响应头: {"content-type": "text/plain", "cache-control": "no-store", "x-cache": "MISS"}
12:10:43.517 DEBUG 🔍 [HyperAdapter] 响应体类型: Full<Bytes>
12:10:43.517 DEBUG 🔍 [HyperAdapter] 准备返回响应给 Hyper...
12:10:43.517 DEBUG 🔍 [HyperAdapter] handle_request 方法即将返回
   第3次请求结果:
     - 状态码: 200 OK
     - 响应时间: 51ms
     - 响应大小: 2字节
     - 缓存状态: MISS
     - 压缩编码: none

   📈 统计结果:
     - 平均响应时间: 51.67ms
     - 平均响应大小: 2字节
     - 缓存命中率: 0/3 (0.0%)
     - 压缩应用率: 0/3 (0.0%)

✅ 性能测试完成!

📋 测试总结:
   🎯 小数据: 应该主要使用缓存策略,减少计算开销
   🎯 大数据: 应该使用缓存+压缩策略,优化存储和传输
   🎯 动态数据: 应该使用压缩策略,减少传输开销
   🎯 原始数据: 应该跳过缓存和压缩,最小化处理开销