Bug #6851 Limit resources by user
Submitted: 26 Nov 2004 16:57 Modified: 12 Jan 2005 11:35
Reporter: ruben cao Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.xx OS:Indiferent
Assigned to: Dmitry Lenev CPU Architecture:Any

[26 Nov 2004 16:57] ruben cao
Description:

Mysql options to limit and monitor user resources are really very poor at this moment.

I also think that it is not very useful to limit users by hour (max_questions_per_hour, max_updates_per_hour and max_connections_per_hour). 

How to repeat:
At the moment i have no way of avoid situations as follows where one user reaches max_connections defined in my /etc/my.cnf file:

| 119990 | database_name| server.com:55161 | database_name| Sleep
| 120004 | database_name| server.com:55173 | database_name| Sleep
| 120066 | database_name| server.com:55217 | database_name| Sleep
| 120068 | database_name| server.com:55219 | database_name| Sleep
| 120075 | database_name| server.com:55224 | database_name| Sleep
| 120085 | database_name| server.com:55231 | database_name| Sleep
| 120098 | database_name| server.com:55238 | database_name| Sleep
| 120118 | database_name| server.com:55257 | database_name| Sleep
| 120130 | database_name| server.com:55260 | database_name| Sleep
| 120164 | database_name| server.com:55277 | database_name| Sleep
| 120175 | database_name| server.com:55281 | database_name| Sleep
| 120198 | database_name| server.com:55301 | database_name| Sleep
| 120220 | database_name| server.com:55319 | database_name| Sleep
| 120232 | database_name| server.com:55335 | database_name| Sleep
| 120279 | database_name| server.com:55345 | database_name| Sleep
| 120408 | database_name| server.com:55375 | database_name| Sleep
| 120415 | database_name| server.com:55378 | database_name| Sleep
| 120417 | database_name| server.com:55381 | database_name| Sleep
| 120431 | database_name| server.com:55392 | database_name| Sleep
| 120452 | database_name| server.com:55401 | database_name| Sleep
| 120458 | database_name| server.com:55403 | database_name| Sleep
| 120459 | database_name| server.com:55404 | database_name| Sleep
| 120488 | database_name| server.com:55434 | database_name| Sleep
| 120496 | database_name| server.com:55440 | database_name| Sleep
| 120587 | database_name| server.com:55491 | database_name| Sleep
| 120588 | database_name| server.com:55492 | database_name| Sleep
| 120597 | database_name| server.com:55500 | database_name| Sleep
| 120599 | database_name| server.com:55504 | database_name| Sleep
| 120613 | database_name| server.com:55524 | database_name| Sleep
| 120621 | database_name| server.com:55536 | database_name| Sleep
| 120630 | database_name| server.com:55543 | database_name| Sleep
| 120652 | database_name| server.com:55549 | database_name| Sleep
| 120654 | database_name| server.com:55551 | database_name| Sleep
| 120673 | database_name| server.com:55556 | database_name| Sleep
| 120685 | database_name| server.com:55559 | database_name| Sleep
| 120697 | database_name| server.com:55562 | database_name| Sleep
| 120798 | database_name| server.com:55597 | database_name| Sleep

Suggested fix:

I think it is absolutaly necessary:
A simultaneus connections limit by user would be perfect to avoid situations where one user can affect to the rest of users  reaching max_connections server limit, and force users to program their scripts correctly.
[27 Nov 2004 8:35] Dmitry Lenev
Hi, Ruben!

We are working on adding exactly this feature in 5.0.

Thank you for your interest in MySQL!
[12 Jan 2005 11:35] Dmitry Lenev
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

We have implemented account-specific MAX_USER_CONNECTIONS resource limit. 
This limit sets maximum number of concurrent connections for the account.

Patch implementing this feature was pushed into 5.0 tree and thus it will be included
in next release.