Resource Management of Oushu DB Management Guide (Part 1)

 

At any time, there may be many concurrent queries running in OushuDB. These queries belong to different users. Users may have high or low priority. We need a way to reasonably allocate system resources that can be used by each user, including CPU and memory.

OushuDB uses Resource Queues to manage the resources of the entire system. Each OushuDB user is associated with a resource queue, and all queries issued by the user will use the resources in the associated resource queue. We can create multiple resource queues, and a tree-like structure is formed between the resource queues. For example the following picture:

Figure OushuDB resource queue

 

Among them, pg_root and pg_default are the resource management queues that have been created by default. pg_root is the root of the resource queue tree. pg_default is its subqueue.

 

When a user is created, it is assigned to the pg_default queue by default.

 

The following statement creates a resource queue ceo_report. Its maximum number of concurrent queries is specified as 20. Additionally, this queue uses 30% of the memory and CPU resources of its parent queue pg_root.

 

CREATERESOURCEQUEUEceo_reportWITH (PARENT='pg_root', ACTIVE_STATEMENTS=20,MEMORY_LIMIT_CLUSTER=30%, CORE_LIMIT_CLUSTER=30%);

 

The meanings of the three configuration parameters are as follows:

  • ACTIVE_STATEMENTS: The maximum number of concurrent queries allowed by the resource queue. Connections that exceed this number will be queued. The resource manager will evenly allocate resources to queue concurrent queries.

  • MEMORY_LIMIT_CLUSTER: The proportion of parent queue memory that can be used by resource queues

  • CORE_LIMIT_CLUSTER: The proportion of the parent queue CPU that the resource queue can use

Now we can create a user to manage the queue with this resource:

CREATEROLEkurtWITHLOGINRESOURCEQUEUEceo_report;

This way, all queries issued by the kurt user will use the resources in the ceo_report.

The other resource queues in the above figure can be created by the following commands:

CREATERESOURCEQUEUEdepartment1WITH (PARENT='pg_root', ACTIVE_STATEMENTS=10,MEMORY_LIMIT_CLUSTER=5%, CORE_LIMIT_CLUSTER=5%);CREATERESOURCEQUEUEadhoc1WITH (PARENT='department1', ACTIVE_STATEMENTS=5,MEMORY_LIMIT_CLUSTER=50%, CORE_LIMIT_CLUSTER=50% );CREATERESOURCEQUEUEdaily_batchWITH (PARENT='department1', ACTIVE_STATEMENTS=5,MEMORY_LIMIT_CLUSTER=50%, CORE_LIMIT_CLUSTER=50%);CREATERESOURCEQUEUEdepartment2WITH (PARENT='pg_root', ACTIVE_STATEMENTS=5,MEMORY_LIMIT_CLUSTER=5%, CORE_LIMIT_CLUSTER=5 %);CREATERESOURCEQUEUEmonthly_reportWITH (PARENT='department2', ACTIVE_STATEMENTS=2,MEMORY_LIMIT_CLUSTER=100%, CORE_LIMIT_CLUSTER=100%);CREATERESOURCEQUEUEdepartment3WITH (PARENT='pg_root', ACTIVE_STATEMENTS=5,MEMORY_LIMIT_CLUSTER=5%, CORE_LIMIT_CLUSTER =5%);CREATERESOURCEQUEUEadhoc2WITH (PARENT='department3', ACTIVE_STATEMENTS=3,MEMORY_LIMIT_CLUSTER=50%, CORE_LIMIT_CLUSTER=50%);CREATERESOURCEQUEUEdaily_reportWITH (PARENT='department3', ACTIVE_STATEMENTS=2,MEMORY_LIMIT_CLUSTER=50%, CORE_LIMIT_CLUSTER=50%);

 

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324108833&siteId=291194637