Computing pools
In Tengri, computation is performed in virtual computing pools.
A compute pool is a lightweight container that is part of a compute pool, contains software code and has dedicated computational resources for computational tasks:
-
Execution of SQL-queries
-
Executing code on Python
-
Running models AI
Operations with computational pools:
-
CREATE WORKER POOL
— Create a worker pool -
ALTER WORKER POOL
— Changing the attributes of a worker pool -
DROP WORKER POOL
— Reset a worker pool -
ALTER WORKER POOL SET DEFAULT
— Set default attributes of the worker pool -
SHOW WORKER POOLS
— Display a list of all worker pools -
SHOW WORKER POOL
— Display the current worker pool -
USE WORKER POOL
— Set the current compute pool
Create a worker pool
CREATE [OR REPLACE] WORKER POOL [IF NOT EXISTS] <pool_name>
[<worker_pool_attribute> [ ... ]];
Creates a new compute pool with the specified name and attributes.
If the OR REPLACE
modifier is specified, the final action is equivalent to deleting an existing compute pool and creating a new one with the same name.
The optional IF NOT EXISTS
modifier restricts the query to only those cases in which the specified object does not already exist.
The modifiers are mutually exclusive. Specifying them both will result in an error. |
The following compute pool attributes can be specified:
-
WORKER SIZE <size>
— sets the compute size for this compute pool:XS
,S
,M
,L
,XL
. -
MAX WORKER COUNT <count>
— sets the maximum number of calculators. -
WORKER IDLE TTL <seconds> SECONDS
— sets the maximum idle time of calculators. -
SCALING STRATEGY <strategy>
— sets the scaling strategy:-
STD
— if there are no available calculators, immediately report their absence. -
ECO
— if there are no free computers, wait 10 minutes for them to appear.
-
See examples
Create a computing pool with the name my_worker_pool
and the size of calculators S
:
CREATE WORKER POOL my_worker_pool
WORKER SIZE S;
Create a compute pool with name my_worker_pool
, compute size L
, maximum number of compute 40
, maximum compute idle time 300
seconds and with scaling strategy ECO
:
CREATE WORKER POOL my_worker_pool
WORKER SIZE L
MAX WORKER COUNT 40
WORKER IDLE TTL 300 SECONDS
SCALING STRATEGY ECO;
Changing the attributes of a worker pool
ALTER WORKER POOL [IF EXISTS] <pool_name> RENAME TO <new_pool_name>;
ALTER WORKER POOL [IF EXISTS] <pool_name> SET <worker_pool_attribute>;
Modifies the compute pool with the specified name.
It is not recommended to change the attributes of compute pools running within your workgroup, as this may cause unexpected degradation of computational performance when compute pools are used by multiple users. Therefore, If you as a user need to change the size of the compute pool you are using (e.g., increase its size), it is recommended to select another larger compute pool to work in. |
Supported actions:
-
RENAME TO
— renames the compute pool to the specified name<new_pool_name>
. All attributes and configurations of the compute pool are retained. -
SET
— updates an attribute of the compute pool. The following attributes can be changed:-
WORKER SIZE <size>
— specifies the calculator size (XS
,S
,M
,L
,XL
) for this compute pool. -
MAX WORKER COUNT <count>
— sets the maximum number of evaluators for this compute pool. -
WORKER IDLE TTL <seconds> SECONDS
— sets the compute idle time for this compute pool. -
SCALING STRATEGY <strategy>
— sets the scaling strategy:-
STD
— if there are no available computors, immediately report their absence. -
ECO
— if there are no available computers, wait 10 minutes for them to appear.
-
-
The optional IF EXISTS
modifier restricts the query to only those cases in which the specified object exists.
Reset a worker pool
DROP WORKER POOL [IF EXISTS] <pool_name>;
Deletes the compute pool with the specified name.
The optional IF EXISTS
modifier restricts the query to only those cases in which the specified object exists.
Set default attributes of the worker pool
ALTER WORKER POOL SET DEFAULT <worker_pool_attributes>;
Sets the default attributes for all new compute pools on the system.
This statement allows you to set system-wide default attributes that will be applied to compute pools when they are created without explicitly specifying these attributes.
The following computing pool attributes can be specified:
-
WORKER SIZE <size>
— specifies the default calculator size (XS
,S
,M
,L
,XL
) for this compute pool. -
MAX WORKER COUNT <count>
— sets the maximum default number of calculators for this compute pool. -
WORKER IDLE TTL <seconds> SECONDS
— sets the default idle time of calculators for this compute pool. -
SCALING STRATEGY <strategy>
— sets the default scaling strategy:-
STD
— if there are no available computors, immediately report their absence. -
ECO
— if there are no free computers, wait 10 minutes for them to appear.
-
Display a list of all worker pools
SHOW WORKER POOLS;
Outputs a list of all compute pools in the system.
This statement displays information about all available compute pools, including their names and configurations.
The MONITOR privilege is required to see a compute pool in the response.
|
Display the current worker pool
SHOW WORKER POOL;
Outputs the compute pool that is currently being used to execute the query.
This statement displays information about the currently active compute pool, including its name and configuration.
Set the current compute pool
USE WORKER POOL <pool_name>;
Sets the specified compute pool as the current pool for query execution.
This statement changes the compute pool that will be used to execute subsequent requests. subsequent queries. The specified pool must exist, and the user must have the necessary privileges to use it.
The USAGE privilege is required to use this operator.
|
Increasing the size of the computing pool
If you as a user need to change the size of the computing pool you are using (e.g., increase it), it is recommended to select another computing pool from the list of available ones without changing the attributes of the current computing pool.
To do this, do the following.
Output the size of the used computational pool:
SHOW WORKER POOL;
+----------------+------+
| worker_pool | size |
+----------------+------+
| compute_s | S |
+----------------+------+
We output the sizes of the compute pools available for use:
SHOW WORKER POOLS;
+----------------+-------+
| name | value |
+----------------+-------+
| client_compute | S |
+----------------+-------+
| compute_m | M |
+----------------+-------+
| compute_s | S |
+----------------+-------+
| compute_l | L |
+----------------+-------+
Switching to a larger compute pool:
USE WORKER POOL compute_m;
+--------+
| status |
+--------+
| USE |
+--------+