当前位置:网站首页>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...
边栏推荐
- Fresh graduates talk about their graduation stories
- What is the sudden power failure of iPhone and how to solve it?
- 【系统架构】-如何评估软件架构
- High performance and high availability computing architecture based on microblog comments
- 数据库查询语句SQL中like、%、-的区别
- 财富自由技能:把自己产品化
- Eureka registration information configuration memo
- Technology is to be studied
- Google 推荐在 MVVM 架构中使用 Kotlin Flow
- 100002nd prime
猜你喜欢

How to add a regression equation to a plot in R

OpenAPI 3.0 specification - Food Guide

【解决】CMake was unable to find a build program corresponding to “Unix Makefiles“.

Redis Lua sandbox bypass command execution (cve-2022-0543)

Cow sequencing problem

Bloc入门之Cubit详解

【flask入门系列】flask处理请求和处理响应

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

【解决】联想拯救者vmware启动虚拟机蓝屏重启问题

分享一些在内网操作的远程办公经验| 社区征文
随机推荐
【flask入门系列】flask处理请求和处理响应
小 P 周刊 Vol.10
Scala Basics (II): variables and data types
我在中山,到哪里开户比较好?网上开户是否安全么?
NoSQL之Redis配置与优化
Technology is to be studied
UTONMOS:以数字藏品助力华夏文化传承和数字科技发展
MySQL must master 4 languages!
PyQt theme
Binary search
基于 ovarian 数据集 进行生存分析
MySQL必須掌握4種語言!
【图像过滤】基于matlab GUI图像过滤系统【含Matlab源码 1913期】
限制输入字符长度length英文1个字符中文2个字符
Little p weekly Vol.10
Mongoose - Why we make “mongoose.Promise = global.Promise” when setting a mongoose module?
Is it safe to open a securities account at the school of Finance and business in 2022?
Redis Lua sandbox bypass command execution (cve-2022-0543)
OpenAPI 3.0 规范-食用指南
数字商品DGE--数字经济的财富黑马




