Spring Reactive(Spring WebFlux) → 背靠 Pivotal → 归属 VMware → 归属戴尔
Quarkus 和 Vert.x → 背靠 Eclipse 基金会 → 主要由 Red Hat 支持
Helidon → 背靠 Oracle
Micronaut → 背靠 Object Computing(GrAIls、OpenDDS)
Lagom → 背靠 Lightbend(Akka)
启动&构建指标对比
native-sample: 基于spring native构建原生镜像示例
quarkus-sample: 基于quarkus构建原生镜像示例
Quarkus Native Image: guanyangsunlight/spring-project-samples:quarkus-sample-0.0.1-SNAPSHOT
Quarkus JVM Image: guanyangsunlight/spring-project-samples:quarkus-sample-0.0.1-SNAPSHOT-jvm
Spring Boot Native Image: guanyangsunlight/spring-project-samples:native-sample-0.0.1-SNAPSHOT
Spring Boot JVM Image: guanyangsunlight/spring-project-samples:native-sample-0.0.1-SNAPSHOT-jvm
MySQL Image: guanyangsunlight/spring-project-samples:sample-mysql-8.0.32
quarkus-sample: quarkus-sample/src/main/docker/docker-compose.yml
native-sample: native-sample/src/main/docker/docker-compose.yml
压测架构
{
"code": 200,
"message": "OK",
"data": {
"id": 4,
"version": 1,
"deleted": 0,
"createBy": "admin",
"updateBy": "admin",
"createTime": 1695312514000,
"updateTime": 1695312532000,
"username": "test41"
}
}
k6 run -u 50 --duration 300s -e url=http://127.0.0.1:8082/api/test/get/4 simple-test.js
-i:指定请求数量
-u:模拟并发数量
--duration:请求时长定义,例如:60s,1m
-e url:指定环境变量url,用于实际场景替换
scenarIOS: (100.00%) 1 scenario, 50 max VUs, 36s max duration (incl. graceful stop):
* default: 50 looping VUs for 6s (gracefulStop: 30s)
✓ is status 200
checks.........................: 100.00% ✓ 7761 ✗ 0
data_received..................: 1.9 MB 324 kB/s
data_sent......................: 730 kB 121 kB/s
http_req_blocked...............: avg=12.22µs min=1µs med=3µs max=3.26ms p(90)=5µs p(95)=6µs
http_req_connecting............: avg=7.1µs min=0s med=0s max=2.19ms p(90)=0s p(95)=0s
http_req_duration..............: avg=38.56ms min=7.55ms med=34.26ms max=216.77ms p(90)=58.96ms p(95)=68.51ms
{ expected_response:true }...: avg=38.56ms min=7.55ms med=34.26ms max=216.77ms p(90)=58.96ms p(95)=68.51ms
http_req_failed................: 0.00% ✓ 0 ✗ 7761
http_req_receiving.............: avg=52.57µs min=19µs med=46µs max=680µs p(90)=81µs p(95)=97µs
http_req_sending...............: avg=19.87µs min=7µs med=16µs max=1.27ms p(90)=27µs p(95)=38µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=38.49ms min=7.51ms med=34.18ms max=216.58ms p(90)=58.89ms p(95)=68.46ms
http_reqs......................: 7761 1288.780058/s
iteration_duration.............: avg=38.7ms min=7.76ms med=34.4ms max=218.51ms p(90)=59.08ms p(95)=68.64ms
iterations.....................: 7761 1288.780058/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
import http from 'k6/http';
import { check } from 'k6';
export default function () {
const res = http.get(`${__ENV.url}`);
check(res, {
'is status 200': (r) => r.status === 200
});
}
压测结果
在实际决策过程中,最好能够根据具体情况进行技术选型,可能的话,可以在小规模的项目或者原型中尝试并评估这些框架。