当前位置:网站首页>Customize MySQL connection pool
Customize MySQL connection pool
2022-06-28 12:51:00 【51CTO】
Recently, I learned the general pooling framework commons-pool2 After practice , Again HTTP The performance test has been carried out , The results were unexpected , It is of no use to improve performance . After my own local test , The performance is good enough .
Then I thought it over , I used the wrong place . Originally I wanted to write one by myself Redis Of the connection pool ,jedis The connection pool itself is commons-pool2 Developed , I was a little surprised , Seems to think the same .commons-pool2 It is very good for connection pooling .
I looked carefully for , It is found that there is still a lack of a local MySQL Connection pool , instead of springboot Then you need to start a service . Of course, there should be , But I really want to write one myself and then do all kinds of tests , So I didn't look for it carefully .
Poolable object
First , We need a poolable object , I chose com.funtester.db.mysql.FunMySql, This is a single link that I wrote myself MySQL object . I plan to use this as a base for poolable objects .
Pool chemical plant
Relative connection , establish com.funtester.db.mysql.FunMySql When , By the way, initialize MySQL Connect . And then again com.funtester.db.mysql.MysqlPool.FunTester#destroyObject The connection is recycled .
Object pool
There is some redundancy here , In the process of later use , I will continue to optimize . By creating a com.funtester.db.mysql.MysqlPool object , Get one com.funtester.db.mysql.FunMySql Object pool .
API encapsulation
Since learning Go Linguistic gorm The framework and Redis frame , I found that there is no need to expose the relevant information about pooling , Directly encapsulate the original API, Exposed to users for use , In this way, users do not have to worry about the recycling of connections .
BUG excavating machinery · Performance conqueror · Head pot cover
边栏推荐
- 为什么CAD导出PDF没有颜色
- Jerry's wif interferes with Bluetooth [chapter]
- 杰理之wif 干扰蓝牙【篇】
- 我的NVIDIA开发者之旅-Jetson Nano 2gb教你怎么训练模型(完整的模型训练套路)
- 结构光之相移法+多频外差的数学原理推导
- ASP.NET CORE Study03
- 小白创业做电商,选对商城系统很重要!
- Mysq 8.0 launched histogram, which greatly improved the performance!
- ASP.NET CORE Study09
- Vs2012 VC creates a new blank window application
猜你喜欢

From simplekv to redis

在线JSON转PlainText工具
![[MySQL from introduction to mastery] [advanced part] (III) creation of MySQL users_ Modification_ Delete and password settings](/img/9c/2a0eb8f5ec03aebbe231dbdb388eca.png)
[MySQL from introduction to mastery] [advanced part] (III) creation of MySQL users_ Modification_ Delete and password settings

From jsonpath and XPath to spl

Continuous integration practice of Baidu app based on pipeline as code

Xiaobai's e-commerce business is very important to choose the right mall system!

【云原生】自助报表和BI能做这么多事?

fastposter v2.8.4 发布 电商海报生成器

分页样式 flex设置成在尾部显示(即使页数加长 也不会因为在末尾而换行)
JS class is not just a simple syntax sugar!
随机推荐
性能测试-01-简介
Go语学习笔记 - gorm使用 - 数据库配置、表新增 | Web框架Gin(七)
ASP.NET CORE Study01
Given two points and a point with a middle scale, find the coordinates of the point
Unity Editor Extension Foundation, guilayout
An idea plug-in that automatically generates unit tests, which improves the development efficiency by more than 70%!
Understand leveldb write operation
为什么CAD导出PDF没有颜色
Jerry's wif interferes with Bluetooth [chapter]
The paging style flex is set to be displayed at the end (even if the number of pages is longer, there will be no line breaks at the end)
.NET混合开发解决方案24 WebView2对比CefSharp的超强优势
ASP.NET CORE Study11
如何在Microsoft Exchange 2010中安装SSL证书
Validateur async. Vérificateur de données JS
杰理之wif 干扰蓝牙【篇】
async-validator.js数据校验器
. Net hybrid development solution 24 webview2's superior advantages over cefsharp
Beginner level of attack and defense World Hello_ pwn
杰理之wif 干扰蓝牙【篇】
一文搞懂leveldb写操作