先说下结论
单 pod ,4 核 8G 的情况下,接口压测可以到 6W TPS. 用 JdbcTemplate 查询的数据库。数据表大小 > 20 亿,这里跟索引的大小有关系,正常情况下可以到 1.1 万样子,数据量小的时候可以到 5w(这里我不敢发),sql 走了联合索引,sql 大概是
select b,status where member_id=1 and b in (11111,22222,3333)
压测图展示
-
应用
-
db
在此过程中我遇到的问题
在开启虚拟线程下,Hikari 表现非常糟糕。 https://github.com/brettwooldridge/HikariCP/issues/2151
为了解决这个问题,我是将 spring.threads.virtual.enabled=false,并且手动开启 tomat 的来解决的。
@Bean
@ConditionalOnProperty(prefix = "server.tomcat.threads.virtual", name = "enabled", havingValue = "true")
public TomcatProtocolHandlerCustomizer<?> protocolHandlerVirtualThreadExecutorCustomizer() throws LifecycleException {
StandardVirtualThreadExecutor standardVirtualThreadExecutor = new StandardVirtualThreadExecutor();
standardVirtualThreadExecutor.start();
return protocolHandler -> protocolHandler.setExecutor(standardVirtualThreadExecutor);
}
大致情况就是这样,大家有兴趣可以一起交流。