test: validate native TLS on Linux

This commit is contained in:
2026-09-22 01:14:21 +08:00
parent e6c82a01fe
commit 9c9c8ab59a
9 changed files with 1385 additions and 32 deletions

View File

@@ -0,0 +1,592 @@
{
"createdAt": "2026-09-21T17:11:34Z",
"goVersion": "go1.25.14",
"platform": "linux/arm64",
"gomaxprocs": 4,
"duration": "3s",
"tls": true,
"notes": [
"Loopback HTTP/1.1 health response, fixed requestId, optional TLS, no access logs or database.",
"Each case starts a fresh server process; load client runs in the parent process on the same machine.",
"Closed-loop concurrency; throughput is successful responses / actual elapsed time, including drain.",
"Latency percentiles include failures and are histogram upper bounds with \u003c=6.25% rounding.",
"Memory is server-only runtime.MemStats (not RSS or kernel socket memory); sampling interval 200ms.",
"Idle memory measured after a forced GC; delta includes heap growth amortized across connections, excluding stacks.",
"After is after closing clients and one forced GC; afterReclaim is a second GC to observe pooled-cache release.",
"Native limits: 8192 connections / 4096 active requests. These cases do not benchmark overload rejection."
],
"results": [
{
"adapter": "nethttp",
"scenario": "traffic",
"concurrency": 1,
"run": 1,
"requests": 36326,
"errors": 0,
"elapsedSeconds": 3.000028418,
"requestsPerSecond": 12108.551966390074,
"p50Millis": 0.08192,
"p95Millis": 0.1024,
"p99Millis": 0.139264,
"serverBytesPerRequest": 4475.917854979904,
"serverAllocsPerRequest": 49.04346748885096,
"sampledPeakHeapAlloc": 3669264,
"before": {
"heapAlloc": 1555696,
"heapInuse": 3522560,
"stackInuse": 491520,
"totalAlloc": 3107240,
"mallocs": 24268,
"numGc": 2,
"goroutines": 3,
"connections": 1,
"accepted": 1
},
"during": {
"heapAlloc": 1789280,
"heapInuse": 3874816,
"stackInuse": 819200,
"totalAlloc": 165699432,
"mallocs": 1805821,
"numGc": 82,
"goroutines": 3,
"connections": 1,
"accepted": 1
},
"after": {
"heapAlloc": 1645816,
"heapInuse": 3629056,
"stackInuse": 753664,
"totalAlloc": 165700968,
"mallocs": 1805830,
"numGc": 83,
"goroutines": 2,
"connections": 0,
"accepted": 1
},
"afterReclaim": {
"heapAlloc": 1625904,
"heapInuse": 3522560,
"stackInuse": 720896,
"totalAlloc": 165701872,
"mallocs": 1805836,
"numGc": 84,
"goroutines": 2,
"connections": 0,
"accepted": 1
}
},
{
"adapter": "native",
"scenario": "traffic",
"concurrency": 1,
"run": 1,
"requests": 36410,
"errors": 0,
"elapsedSeconds": 3.000096335,
"requestsPerSecond": 12136.276950586656,
"p50Millis": 0.08192,
"p95Millis": 0.1024,
"p99Millis": 0.131072,
"serverBytesPerRequest": 4807.387201318319,
"serverAllocsPerRequest": 61.041444658060975,
"sampledPeakHeapAlloc": 3473824,
"before": {
"heapAlloc": 1546544,
"heapInuse": 3563520,
"stackInuse": 524288,
"totalAlloc": 3099040,
"mallocs": 24253,
"numGc": 2,
"goroutines": 4,
"connections": 1,
"accepted": 1
},
"during": {
"heapAlloc": 1987016,
"heapInuse": 4014080,
"stackInuse": 524288,
"totalAlloc": 178136008,
"mallocs": 2246772,
"numGc": 96,
"goroutines": 4,
"connections": 1,
"accepted": 1
},
"after": {
"heapAlloc": 1557080,
"heapInuse": 3637248,
"stackInuse": 425984,
"totalAlloc": 178137480,
"mallocs": 2246784,
"numGc": 97,
"goroutines": 3,
"connections": 0,
"accepted": 1
},
"afterReclaim": {
"heapAlloc": 1543112,
"heapInuse": 3473408,
"stackInuse": 425984,
"totalAlloc": 178138128,
"mallocs": 2246789,
"numGc": 98,
"goroutines": 3,
"connections": 0,
"accepted": 1
}
},
{
"adapter": "nethttp",
"scenario": "traffic",
"concurrency": 32,
"run": 1,
"requests": 297651,
"errors": 0,
"elapsedSeconds": 3.000748959,
"requestsPerSecond": 99192.23636061586,
"p50Millis": 0.172032,
"p95Millis": 1.179648,
"p99Millis": 2.097152,
"serverBytesPerRequest": 4478.059122932562,
"serverAllocsPerRequest": 49.0660605877353,
"sampledPeakHeapAlloc": 4147936,
"before": {
"heapAlloc": 2046152,
"heapInuse": 4554752,
"stackInuse": 884736,
"totalAlloc": 4736656,
"mallocs": 39461,
"numGc": 3,
"goroutines": 34,
"connections": 32,
"accepted": 32
},
"during": {
"heapAlloc": 3132976,
"heapInuse": 5529600,
"stackInuse": 1212416,
"totalAlloc": 1337635432,
"mallocs": 14644023,
"numGc": 642,
"goroutines": 34,
"connections": 32,
"accepted": 32
},
"after": {
"heapAlloc": 1946392,
"heapInuse": 4136960,
"stackInuse": 884736,
"totalAlloc": 1337638376,
"mallocs": 14644047,
"numGc": 643,
"goroutines": 2,
"connections": 0,
"accepted": 32
},
"afterReclaim": {
"heapAlloc": 1657656,
"heapInuse": 3596288,
"stackInuse": 884736,
"totalAlloc": 1337639280,
"mallocs": 14644053,
"numGc": 644,
"goroutines": 2,
"connections": 0,
"accepted": 32
}
},
{
"adapter": "native",
"scenario": "traffic",
"concurrency": 32,
"run": 1,
"requests": 271586,
"errors": 0,
"elapsedSeconds": 3.008536543,
"requestsPerSecond": 90271.79697448004,
"p50Millis": 0.172032,
"p95Millis": 1.114112,
"p99Millis": 2.097152,
"serverBytesPerRequest": 4810.125264188876,
"serverAllocsPerRequest": 61.068320900193676,
"sampledPeakHeapAlloc": 3706424,
"before": {
"heapAlloc": 1833336,
"heapInuse": 4136960,
"stackInuse": 1048576,
"totalAlloc": 4566744,
"mallocs": 39398,
"numGc": 3,
"goroutines": 35,
"connections": 32,
"accepted": 32
},
"during": {
"heapAlloc": 2032480,
"heapInuse": 4661248,
"stackInuse": 851968,
"totalAlloc": 1310929424,
"mallocs": 16624699,
"numGc": 742,
"goroutines": 35,
"connections": 32,
"accepted": 32
},
"after": {
"heapAlloc": 1875360,
"heapInuse": 4186112,
"stackInuse": 524288,
"totalAlloc": 1310933392,
"mallocs": 16624734,
"numGc": 743,
"goroutines": 3,
"connections": 0,
"accepted": 32
},
"afterReclaim": {
"heapAlloc": 1593792,
"heapInuse": 3465216,
"stackInuse": 524288,
"totalAlloc": 1310934296,
"mallocs": 16624740,
"numGc": 744,
"goroutines": 3,
"connections": 0,
"accepted": 32
}
},
{
"adapter": "nethttp",
"scenario": "traffic",
"concurrency": 128,
"run": 1,
"requests": 322494,
"errors": 0,
"elapsedSeconds": 3.001132293,
"requestsPerSecond": 107457.44223012164,
"p50Millis": 0.589824,
"p95Millis": 2.752512,
"p99Millis": 25.165824,
"serverBytesPerRequest": 4475.7173528809835,
"serverAllocsPerRequest": 49.07075790557344,
"sampledPeakHeapAlloc": 7137248,
"before": {
"heapAlloc": 3503480,
"heapInuse": 6340608,
"stackInuse": 2228224,
"totalAlloc": 9426048,
"mallocs": 83598,
"numGc": 5,
"goroutines": 124,
"connections": 122,
"accepted": 122
},
"during": {
"heapAlloc": 6849936,
"heapInuse": 9125888,
"stackInuse": 2162688,
"totalAlloc": 1452818040,
"mallocs": 15908623,
"numGc": 415,
"goroutines": 130,
"connections": 128,
"accepted": 128
},
"after": {
"heapAlloc": 2816896,
"heapInuse": 5300224,
"stackInuse": 1048576,
"totalAlloc": 1452825560,
"mallocs": 15908667,
"numGc": 416,
"goroutines": 2,
"connections": 0,
"accepted": 128
},
"afterReclaim": {
"heapAlloc": 1717496,
"heapInuse": 3710976,
"stackInuse": 1015808,
"totalAlloc": 1452826464,
"mallocs": 15908673,
"numGc": 417,
"goroutines": 2,
"connections": 0,
"accepted": 128
}
},
{
"adapter": "native",
"scenario": "traffic",
"concurrency": 128,
"run": 1,
"requests": 299953,
"errors": 0,
"elapsedSeconds": 3.003243168,
"requestsPerSecond": 99876.36139359062,
"p50Millis": 0.622592,
"p95Millis": 2.752512,
"p99Millis": 32.505856,
"serverBytesPerRequest": 4817.3341823552355,
"serverAllocsPerRequest": 61.15272726060416,
"sampledPeakHeapAlloc": 5668056,
"before": {
"heapAlloc": 2118392,
"heapInuse": 4661248,
"stackInuse": 1605632,
"totalAlloc": 6143952,
"mallocs": 56351,
"numGc": 4,
"goroutines": 61,
"connections": 58,
"accepted": 58
},
"during": {
"heapAlloc": 3375320,
"heapInuse": 5996544,
"stackInuse": 1802240,
"totalAlloc": 1451117792,
"mallocs": 18399295,
"numGc": 528,
"goroutines": 131,
"connections": 128,
"accepted": 128
},
"after": {
"heapAlloc": 2766336,
"heapInuse": 5382144,
"stackInuse": 1769472,
"totalAlloc": 1451125632,
"mallocs": 18399341,
"numGc": 529,
"goroutines": 3,
"connections": 0,
"accepted": 128
},
"afterReclaim": {
"heapAlloc": 1658104,
"heapInuse": 3588096,
"stackInuse": 1769472,
"totalAlloc": 1451126280,
"mallocs": 18399346,
"numGc": 530,
"goroutines": 3,
"connections": 0,
"accepted": 128
}
},
{
"adapter": "nethttp",
"scenario": "idle",
"concurrency": 128,
"run": 1,
"errors": 0,
"idleHeapDelta": 1838600,
"idleHeapPerConnection": 14364.0625,
"before": {
"heapAlloc": 1521656,
"heapInuse": 3260416,
"stackInuse": 458752,
"totalAlloc": 3029904,
"mallocs": 23674,
"numGc": 1,
"goroutines": 2,
"connections": 0,
"accepted": 0
},
"during": {
"heapAlloc": 3360256,
"heapInuse": 5718016,
"stackInuse": 1540096,
"totalAlloc": 9686296,
"mallocs": 86122,
"numGc": 5,
"goroutines": 130,
"connections": 128,
"accepted": 128
},
"after": {
"heapAlloc": 2682728,
"heapInuse": 4792320,
"stackInuse": 425984,
"totalAlloc": 9695376,
"mallocs": 86176,
"numGc": 6,
"goroutines": 2,
"connections": 0,
"accepted": 128
},
"afterReclaim": {
"heapAlloc": 1604552,
"heapInuse": 3440640,
"stackInuse": 425984,
"totalAlloc": 9696584,
"mallocs": 86186,
"numGc": 7,
"goroutines": 2,
"connections": 0,
"accepted": 128
}
},
{
"adapter": "native",
"scenario": "idle",
"concurrency": 128,
"run": 1,
"errors": 0,
"idleHeapDelta": 1191856,
"idleHeapPerConnection": 9311.375,
"before": {
"heapAlloc": 1521040,
"heapInuse": 3325952,
"stackInuse": 458752,
"totalAlloc": 3029464,
"mallocs": 23663,
"numGc": 1,
"goroutines": 3,
"connections": 0,
"accepted": 0
},
"during": {
"heapAlloc": 2712896,
"heapInuse": 4939776,
"stackInuse": 2555904,
"totalAlloc": 9083760,
"mallocs": 85842,
"numGc": 5,
"goroutines": 131,
"connections": 128,
"accepted": 128
},
"after": {
"heapAlloc": 2711312,
"heapInuse": 4907008,
"stackInuse": 425984,
"totalAlloc": 9091576,
"mallocs": 85898,
"numGc": 6,
"goroutines": 3,
"connections": 0,
"accepted": 128
},
"afterReclaim": {
"heapAlloc": 1608416,
"heapInuse": 3416064,
"stackInuse": 425984,
"totalAlloc": 9092784,
"mallocs": 85908,
"numGc": 7,
"goroutines": 3,
"connections": 0,
"accepted": 128
}
},
{
"adapter": "nethttp",
"scenario": "idle",
"concurrency": 512,
"run": 1,
"errors": 0,
"idleHeapDelta": 7269176,
"idleHeapPerConnection": 14197.609375,
"before": {
"heapAlloc": 1521080,
"heapInuse": 3383296,
"stackInuse": 458752,
"totalAlloc": 3029480,
"mallocs": 23669,
"numGc": 1,
"goroutines": 2,
"connections": 0,
"accepted": 0
},
"during": {
"heapAlloc": 8790256,
"heapInuse": 11960320,
"stackInuse": 4718592,
"totalAlloc": 29547624,
"mallocs": 272853,
"numGc": 9,
"goroutines": 514,
"connections": 512,
"accepted": 512
},
"after": {
"heapAlloc": 6121872,
"heapInuse": 8749056,
"stackInuse": 458752,
"totalAlloc": 29580224,
"mallocs": 272941,
"numGc": 10,
"goroutines": 2,
"connections": 0,
"accepted": 512
},
"afterReclaim": {
"heapAlloc": 1812232,
"heapInuse": 3817472,
"stackInuse": 458752,
"totalAlloc": 29581432,
"mallocs": 272951,
"numGc": 11,
"goroutines": 2,
"connections": 0,
"accepted": 512
}
},
{
"adapter": "native",
"scenario": "idle",
"concurrency": 512,
"run": 1,
"errors": 0,
"idleHeapDelta": 4687096,
"idleHeapPerConnection": 9154.484375,
"before": {
"heapAlloc": 1520480,
"heapInuse": 3293184,
"stackInuse": 458752,
"totalAlloc": 3028752,
"mallocs": 23658,
"numGc": 1,
"goroutines": 3,
"connections": 0,
"accepted": 0
},
"during": {
"heapAlloc": 6207576,
"heapInuse": 9035776,
"stackInuse": 8880128,
"totalAlloc": 27129544,
"mallocs": 271820,
"numGc": 9,
"goroutines": 515,
"connections": 512,
"accepted": 512
},
"after": {
"heapAlloc": 6228280,
"heapInuse": 9027584,
"stackInuse": 491520,
"totalAlloc": 27168240,
"mallocs": 271921,
"numGc": 10,
"goroutines": 3,
"connections": 0,
"accepted": 512
},
"afterReclaim": {
"heapAlloc": 1812240,
"heapInuse": 3645440,
"stackInuse": 491520,
"totalAlloc": 27169448,
"mallocs": 271931,
"numGc": 11,
"goroutines": 3,
"connections": 0,
"accepted": 512
}
}
]
}