Was this page helpful?
A typical database has more than one workload running simultaneously with a different acceptable level of latency and throughput. By defining the attributes of each workload, you can specify how ScyllaDB will handle requests depending on the workload to which they are assigned.
You can define a workload’s attribute using the service level concept. The service level CQL commands allow you to attach attributes to users and roles. When a user logs into the system, all of the attributes attached to that user and to the roles granted to that user are combined and become a set of workload attributes.
See Service Level Management for more information about service levels.
Create a service level with the desired attribute.
CREATE SERVICE LEVEL <service_level_name> WITH <attribute> [ AND <attribute>];
For example:CREATE SERVICE LEVEL sl2 WITH timeout = 500ms AND workload_type=interactive;
See Available Attributes.
Assign a service level to a role or user:
ATTACH SERVICE_LEVEL <service_level_name> TO <role_name|user_name>;
For example:ATTACH SERVICE LEVEL sl2 TO scylla;
You can modify the service level attributes with the
ALTER SERVICE LEVEL command:
ALTER SERVICE LEVEL <service_level_name> WITH <attribute> [ AND <attribute>];
ALTER SERVICE LEVEL sl2 WITH timeout = null;
You can specify the timeout for a service level (in milliseconds or seconds) with the
CREATE SERVICE LEVEL primary WITH timeout = 30ms;
Specifying the timeout value is useful when your workloads have different acceptable latency levels.
You can specify the workload type for a service level with the
CREATE SERVICE LEVEL secondary WITH workload_type = 'batch';
Specifying the workload type allows ScyllaDB to handle sessions more efficiently (for example, depending on whether the workload is sensitive to latency).
A generic workload without any specific characteristics (default).
A workload sensitive to latency, expected to have high/unbounded concurrency, with dynamic characteristics. For example, a workload assigned to users clicking on a website and generating events with their clicks.
A workload for processing large amounts of data, not sensitive to latency, expected to have fixed concurrency. For example, a workload assigned to processing billions of historical sales records to generate statistics.