[MDEV-10297] Threadpool : add priorization features Created: 2016-06-28  Updated: 2016-09-23  Resolved: 2016-09-23

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.2.2

Type: Task Priority: Major
Reporter: Vladislav Vaintroub Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.2.2-1, 10.2.2-2, 10.2.2-3

 Description   

There is feature that is there in Percona tree 5.5+ and also in MySQL/Enterprise
but not in MariaDB is priorization

  • By default, connection that is in transaction gets a priority boost (which translated to
    in transaction= low prio, outside of transaction => high prio). The first statement after "begin" does not need to be high prio (this transaction does not actually use any resources)
  • We need to have a variable that will allow to specify per-connection or global scheduling behavior (auto = based on transaction status, high - always high prio, low- always low prio)
    This way, it would be easy to return back to FIFO scheduling if someone prefers that (i.e set global threadpool_priority=high). Or for a connection to be "nice" (setting priority = low regardless of transaction status), if it does not unimportant work . This variable is akin to Percona's threadpool_high_prio_mode=[transactions|statements|none] , but with an understandable name.
  • On Unix ,we'll use separate queues for high priority and low priority items. high priority queue is checked before low prio when an event is dequeued.
  • On Windows threadpool, it is possible to 'yield' low prio work items.
  • On Unix, to avoid starvation of the low prio items, periodically the old items in low prio queue need to be merged at the end of high prio queue. We can use 'thread_pool_kickup_timer' logic, like MySQL Enterprise is doing it.
  • We won't be using 'throttling of low prio queue' like Percona, as restricting the number of active+waiting threads can easily lead to a deadlock (single global lock or table lock would suffice to check that)


 Comments   
Comment by Vladislav Vaintroub [ 2016-08-02 ]

the repository that contains the patch is here https://github.com/MariaDB/server/commits/bb-10.2-wlad-threadpool

Generated at Thu Feb 08 07:41:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.