Add a GLOBAL UPPER bound to cap SORT BUFFER memory use

Registered by Nadeem

I would like to put in a request to have a cap on the upper bound for the per connection Drizzle memory parameters such as sort buffer size.

Similar to the IBM DB2 on LUW implementation, I'd like us to add an upper bound threshold that cannot ever be crossed for memory use on sort heap size globally across all databases.

So allow the per connection sort_buffer_size as it currently exists.

But add another variable called say "sort_heap_threshold" that all concurrent db connections together can not cross.
If the same can be done for join buffers, read buffers, read random buffers, etc. then that would be even nicer and allow DBAs to control memory and prevent issues such as OOM killers and swapping.

UPDATE:
======
Please also apply the same logic that you apply for sort buffer global upper cap, to include GLOBAL upper caps for the following buffers:
1) join_buffer_size global upper cap
2) read_buffer_size global upper cap
3) read_rnd_buffer_size global upper cap

Blueprint information

Status:
Complete
Approver:
Lee Bieber
Priority:
High
Drafter:
None
Direction:
Needs approval
Assignee:
Andrew Hutchings
Definition:
Approved
Series goal:
Accepted for 7.0
Implementation:
Implemented
Milestone target:
milestone icon 2010-11-08
Started by
Andrew Hutchings
Completed by
Lee Bieber

Sprints

Whiteboard

The thing to note here is that the request is for a GLOBAL upper cap for the sum of all sort buffers across all running threads.

So if 100k users are connected and each issues a sort, that will not allocate 100k*sort_buffer_size, but rather will max out and start throwing errors if this new threshold is hit.

Rackspace request

Implementation:
To be implemented using atomic counters

Work items:
Create template for atomic global threshold: DONE
Unittests for new template: DONE
Implement for sort_buffer_size: DONE
Implement for join_buffer_size: DONE
Implement for read_buffer_size: DONE
Implement for read_rnd_buffer_size: DONE
DTR test cases: DONE
Sphinx documentation: DONE

Notes:
Can only test join buffer and read buffer constraints in DTR due to recent changes in drizzleslap. See the test case files for ways of manually testing it.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.