当前位置:网站首页>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 = trueHikariCP Official address : https://github.com/brettwoold...
边栏推荐
猜你喜欢

Camtasia 2022 new ultra clear recording computer video

Here comes the official zero foundation introduction jetpack compose Chinese course!

A high-frequency interview question from a large factory: tell me about the solution of high and low interface idempotence? Solutions are attached.

Audio video and CPU architecture

The difference between like,%, - in database query SQL

df报错Stale file handle

Pie chart metamorphosis record, the liver has 3000 words, collection is to learn!

【机器学习】基于多元时间序列对高考预测分析案例

IPhone 13 screen stuck black, unable to shut down? How to solve

@Query difficult and miscellaneous diseases
随机推荐
官方零基础入门 Jetpack Compose 的中文课程来啦!
[image filtering] image filtering system based on Matlab GUI [including Matlab source code 1913]
Can the main RF circuit be removed for projects that do not need the main RF?
[machinetranslation] - Calculation of Bleu value
Matlab|基于BP神经网络进行电力系统短期负荷预测
Gd32 ADC acquisition voltage
How to adjust face input size
使用 AnnotationDbi 转换 R 中的基因名称
The "more" option of Spreadtrum platform dearmcamera2 is removed
Multi surveyor Gongshu campus Xiao sir_ Page error in Jenkins
在 R 中创建非线性最小二乘检验
数字商品DGE--数字经济的财富黑马
限制输入字符长度length英文1个字符中文2个字符
100002nd prime
ORB-SLAM系列论文翻译笔记
股票开户怎么开户?网上开户是否安全么?
Which securities company should I choose to open an account online? Is it safe to open an account online?
财富自由技能:把自己产品化
df报错Stale file handle
Camtasia 2022 new ultra clear recording computer video




