dbcp 是什么

Many Apache projects support interaction with a relational database. Creating a new connection for each user can be time consuming (often requiring multiple seconds of clock time), in order to perform a database transaction that might take milliseconds. Opening a connection per user can be unfeasible in a publicly-hosted Internet application where the number of simultaneous users can be very large. Accordingly, developers often wish to share a "pool" of open connections between all of the application's current users. The number of users actually performing a request at any given time is usually a very small percentage of the total number of active users, and during request processing is the only time that a database connection is required. The application itself logs into the DBMS, and handles any user account issues internally.

——摘自 Apache Commons DBCP

1.需要数据库交互
2.建立连接时间(s)远超事务执行时间(ms)。
3.对于大访问量web应用,很难为每个用户都建立连接。

基于以上,开发者想为应用下当前所有用户共享一个数据库连接池。
实际上在任意给定时间,实际执行请求的用户数所占活跃用户数的比例是很小的,只有当执行请求的时候才会用到数据库连接。

转载于:https://www.cnblogs.com/zno2/p/4565894.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值