当前位置:网站首页>Additional: brief description of hikaricp connection pool; (I didn't go deep into it, but I had a basic understanding of hikaricp connection pool)
Additional: brief description of hikaricp connection pool; (I didn't go deep into it, but I had a basic understanding of hikaricp connection pool)
2022-06-26 02:46:00 【Small withered forest】
explain :
(1) Why did you write this blog ?: stay 【16: Chapter two : Architecture back end project :12: To configure mybatis;( stay 【imooc-news-dev-service-user】 This micro service sub project , To configure )】 in , Our database connection pool uses HikariCP Connection pool ;;; therefore , Wrote this blog , Give a brief introduction ;
(2) The articles referenced in this blog are :
●【Hikari Connection pool 】, The author of this article is 【 Wang Liuliu's IT daily 】;
●【Spring Series of HikariCP Connection pool 】, The author of this article is 【 A Niu, programmer 】;
Catalog
One : Reference article 1:Hikari Connection pool ;
Two : Reference article 2:Spring Series of HikariCP Connection pool ;
One : Reference article 1:Hikari Connection pool ;
Reference from 【Hikari Connection pool 】, The author of this article is 【 Wang Liuliu's IT daily 】;
hikari: # Connection pool name pool-name: DateHikariCP # Minimum number of idle connections minimum-idle: 5 # Maximum free connection lifetime , Default 600000(10 minute ) idle-timeout: 180000 # The maximum number of connections in the connection pool , Default 10 maximum-pool-size: 10 # This property controls the default auto commit behavior for connections returned from the pool , The default value is :true auto-commit: true # This property controls the maximum lifetime of connections in the pool , value 0 It means infinite life cycle , Default 1800000 namely 30 minute max-lifetime: 1800000 # Database connection timeout , Default 30000(30 second ) onnection-timeout: 30000 # Query statement to test whether the connection is available connection-test-query: SELECT 1
Two : Reference article 2:Spring Series of HikariCP Connection pool ;
Reference from 【Spring Series of HikariCP Connection pool 】, The author of this article is 【 A Niu, programmer 】;
/** * The following three notes mean when classpath There is HikariDataSource.class, also Spring There is no configuration in the context DataSource Of bean * also spring.datasource.type The value of is com.zaxxer.hikari.HikariDataSource When ,SpringBoot Automatically help us choose the default connection pool is HikariDataSource */ @ConditionalOnClass({HikariDataSource.class}) @ConditionalOnMissingBean({DataSource.class}) @ConditionalOnProperty(name = {"spring.datasource.type"},havingValue = "com.zaxxer.hikari.HikariDataSource",matchIfMissing = true) static class Hikari { Hikari() { } @Bean @ConfigurationProperties(prefix = "spring.datasource.hikari") HikariDataSource dataSource(DataSourceProperties properties) { HikariDataSource dataSource = (HikariDataSource)DataSourceConfiguration.createDataSource(properties, HikariDataSource.class); if (StringUtils.hasText(properties.getName())) { dataSource.setPoolName(properties.getName()); } return dataSource; } }
# These four configurations are used for different data sources spring.datasource.url=jdbc:mysql://localhost:3306/test spring.datasource.username=root spring.datasource.password=123456 spring.datasource.driver-class-name=com.mysql.jdbc.Driver # The following configuration items are hikari Unique configuration # The maximum length of time to wait for the connection pool to allocate the connection ( millisecond ), Connections that have not been available for more than this period of time occur SQLException, Default :30 second spring.datasource.hikari.connection-timeout=30000 # Minimum connections spring.datasource.hikari.minimum-idle=5 # maximum connection spring.datasource.hikari.maximum-pool-size=15 # Automatic submission spring.datasource.hikari.auto-commit=true # A connection idle The maximum duration of a state ( millisecond ), Timeout is released (retired), Default :10 minute spring.datasource.hikari.idle-timeout=600000 # Connection pool name spring.datasource.hikari.pool-name=DatebookHikariCP # A connected life span ( millisecond ), Time out and not used is released (retired), Default :30 minute 1800000ms, It is recommended to set the timeout less than the database 60 second spring.datasource.hikari.max-lifetime=28740000 spring.datasource.hikari.connection-test-query=SELECT 1 # The following is for MYSQL Configuration parameters of the driver # The number of statements cached in each connection . The default value is conservative 25. It is recommended that it be set to 250-500 Between spring.datasource.hikari.prepStmtCacheSize = 300 # Cached prepared SQL The maximum length of a statement , The default value is 256, But often this length is not enough spring.datasource.hikari.prepStmtCacheSqlLimit = 2048 # Cache switch , If this is set to false, Neither of the above two parameters takes effect spring.datasource.hikari.cachePrepStmts = true # Newer versions of MySQL Support prepared statements on the server side , This can provide substantial performance improvements spring.datasource.hikari.useServerPrepStmts = true
HikariCP Official address : https://github.com/brettwoold...
边栏推荐
- Redis configuration and optimization of NoSQL
- 如何提词条
- Mongoose - Why we make “mongoose.Promise = global.Promise” when setting a mongoose module?
- ORB-SLAM3论文概述
- leetcode 300. Longest increasing subsequence (medium)
- What is flush software? Is online account opening safe?
- Prometeus 2.33.0 new features
- In depth good article: what is supernetting?
- Pie chart metamorphosis record, the liver has 3000 words, collection is to learn!
- Fresh graduates talk about their graduation stories
猜你喜欢
Depth first traversal of Graphs
How do I fix the iPhone green screen problem? Try these solutions
ORB-SLAM3论文概述
OpenAPI 3.0 specification - Food Guide
[flask introduction series] flask processing request and response
【缺陷检测】基于matlab GUI印刷电路板自动缺陷检测【含Matlab源码 1912期】
【flask入门系列】flask处理请求和处理响应
Gold three silver four~
应届毕业生谈毕业的故事
Redis6.0新特性——ACL(权限控制列表)实现限制用户可执行命令和KEY
随机推荐
How to adjust face input size
@Query difficult and miscellaneous diseases
Magnifier case
Install development cross process communication
Camtasia 2022全新版超清錄制電腦視頻
Blazor University (33) form - editcontext, fieldidentifiers
Mongoose - Why we make “mongoose.Promise = global.Promise” when setting a mongoose module?
记一个RestControll和Controller 引起的折磨BUG
Digital commodity DGE -- the dark horse of wealth in digital economy
Introduction to bloc: detailed explanation of cube
Cox regression model
Wechat applet
数字商品DGE--数字经济的财富黑马
Remember a simple JVM tuning experience
2022年挖财商学院证券开户安全嘛?
College Students' big factory road
golang--channal与select
财富自由技能:把自己产品化
【图像过滤】基于matlab GUI图像过滤系统【含Matlab源码 1913期】
How to check and cancel subscription auto renewal on iPhone or iPad