在进行性能测试时,发现一个复杂的接口中删除数据超时失败!
2021-10-28 20:16:07.228 [http-nio-10001-exec-167] ERROR com.iot.handler.IotGlobalExceptionHandler - =====>系统运行出现异常! msg: Could not open JDBC Connection for transaction; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException: wait millis 60007, active 10, maxActive 10, creating 0, runningSqlCount 18 : delete from t_product_properties where product_id = ? and custom = 0
压力测试200并发,已经hold不住了,报了很多超时错误,应当调大一些数值,配置信息里调数据库连接池的最大线程数!
表中数据有四十多万的基础数据,这数据量很一般,根本不会是瓶颈。根本原因是,数据库在高并发时因连接池中的线程打满,任务队列也满了,造成其他任务阻塞,报超时异常!
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource #驱动配置信息 spring.datasource.driver-class-name=com.mysql.jdbc.Driver #基本连接信息 spring.datasource.username = root spring.datasource.password = root spring.datasource.url=jdbc:mysql://192.168.153.23:3306/mytest?useUnicode=true&characterEncoding=utf-8 #连接池属性 spring.datasource.druid.initial-size=15 spring.datasource.druid.max-active=100 spring.datasource.druid.min-idle=15 spring.datasource.druid.max-wait=60000 spring.datasource.druid.time-between-eviction-runs-millis=60000 spring.datasource.druid.min-evictable-idle-time-millis=300000 spring.datasource.druid.test-on-borrow=false spring.datasource.druid.test-on-return=false spring.datasource.druid.test-while-idle=true spring.datasource.druid.validation-query=SELECT 1 spring.datasource.druid.validation-query-timeout=1000 spring.datasource.druid.keep-alive=true spring.datasource.druid.remove-abandoned=true spring.datasource.druid.remove-abandoned-timeout=180 spring.datasource.druid.log-abandoned=true spring.datasource.druid.pool-prepared-statements=true spring.datasource.druid.max-pool-prepared-statement-per-connection-size=20 spring.datasource.druid.filters=stat,wall,slf4j spring.datasource.druid.use-global-data-source-stat=true spring.datasource.druid.preparedStatement=true spring.datasource.druid.maxOpenPreparedStatements=100 spring.datasource.druid.connect-properties.mergeSql=true spring.datasource.druid.connect-properties.slowSqlMillis=5000
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)