简体   繁体   中英

How DB Connections Numbers Are Calculated?

I have database connection number increased this morning, which never happen before. as shown below :

在此处输入图片说明

and I don't know why. because there's no user accessing this database. just cronjob which runs since last month and no changes.

so I was wondering, how this database connection number is calculated?

does each SELECT , UPDATE and INSERT count as 1.

or each $conn = new mysqli($servername, $username, $password); count as 1?

Amazon RDS Db connections count is persistent connection made by connecting library. so

$conn = new mysqli($servername, $username, $password); will be counted as 1 single connections.

Reason behind increased connections may be bug in your script or library file. After every successfully select/insert/update/delete actions or performing entire function (at end of cron in your case) you have to close the mysqli connection . RDS will not automatically close your connection and hence when your cron runs next time a new connection will be established and counts goes on increasing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM