当前位置:网站首页>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
边栏推荐
- ASP.NET CORE Study11
- Ugui uses tips (VI) unity to realize vertical line display of string
- VS2012 VC新建一个空白窗口应用
- Here comes Wi Fi 7. How strong is it?
- 从 jsonpath 和 xpath 到 SPL
- 在线JSON转PlainText工具
- Jerry's wif interferes with Bluetooth [chapter]
- 百度APP 基于Pipeline as Code的持续集成实践
- What are the common modes of financial products in 2022?
- Unity Editor Extension Foundation, guilayout
猜你喜欢

如何在Microsoft Exchange 2010中安装SSL证书

Go语学习笔记 - gorm使用 - 数据库配置、表新增 | Web框架Gin(七)

Copying open source for basic software is not advisable. Self reliance is the right way

Evaluation of IP location query interface I

Unity Editor Extension Foundation, editorguilayout (II)

IPETRONIK数据采集设备携手Softing Q-Vision软件致力于ADAS测试方案

为什么CAD导出PDF没有颜色

manjaro easyconnecy报错:libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

ASP. NET CORE Study01

ASP.NET CORE Study02
随机推荐
杰理之SPI1外挂FLASH录音修改【篇】
[cloud native] can self-service reports and Bi do so many things?
【MySQL从入门到精通】【高级篇】(三)MySQL用户的创建_修改_删除以及密码的设置
2022招商FinTech比赛总结
go template with... End traversal usage
【云原生】自助报表和BI能做这么多事?
命名空间和作用域
Jerry's wif interferes with Bluetooth [chapter]
Vs2012 VC creates a new blank window application
Unity Editor Extension Foundation, guilayout
k3s一键安装脚本
性能测试-01-简介
fastposter v2.8.4 发布 电商海报生成器
[unity Editor Extension Foundation], editorguilayout (I)
UDP传输rtp数据包丢帧
Finereport installation tutorial
async-validator. JS data verifier
腾讯确认QQ大规模盗号,iPhone14无缘Type-C,第四大运营商5G正式放号,今日更多大新闻在此...
Hundreds of lines of code to implement a JSON parser
微服务稳定性保障