Scheduler to integrate Readyset and ProxySQL.
This scheduler executes the following steps:
- Locks an in disk file (configured by
lock_file
) to avoid multiple instances of the scheduler to overlap their execution. - Check if it can connect to Readyset and validate if
Snapshot Status
isCompleted
. In case it cannot connect or Readyset is still performing snapshot it adjust the server status toSHUNNED
in ProxySQL. - Queries the table
stats_mysql_query_digest
from ProxySQL and validates if each query is supported by Readyset - If the query is supported it adds a cache in Readyset by executing
CREATE CACHE FROM __query__
. - If
warmup_time
is NOT configure, a new query rule will be added redirecting this query to Readyset - If
warmup_time
is configured, a new query rule will be added to mirror this query to Readyset. The query will still be redirected to the original hostgroup - Once
warmup_time
seconds has elapsed since the query was mirrored, the query rule will be updated to redirect the qury to Readyset instead of mirroring.
Assuming you have your ProxySQL already Configured you will need to create a new hostgroup and add Readyset to this hostgroup:
INSERT INTO mysql_servers (hostgroup_id, hostname, port) VALUES (99, '127.0.0.1', 3307);
LOAD MYSQL SERVERS TO RUNTIME;
SAVE MYSQL SERVERS TO DISK;
To configure the scheduler to run execute:
INSERT INTO scheduler (active, interval_ms, filename, arg1) VALUES (1, 10000, '/usr/bin/readyset_proxysql_scheduler', '--config=/etc/readyset_proxysql_scheduler.cnf');
LOAD SCHEDULER TO RUNTIME;
SAVE SCHEDULER TO DISK;
Configure /etc/readyset_proxysql_scheduler.cnf
as follow:
proxysql_user
- (Required) - Proxysql admin userproxysql_password
- (Required) - Proxysql admin passwordproxysql_host
- (Required) - Proxysql admin hostproxysql_port
- (Required) - Proxysql admin portreadyset_user
- (Required) - Readyset application userreadyset_password
- (Required) - Readyset application passwordreadyset_host
- (Required) - Readyset hostreadyset_port
- (Required) - Readyset portsource_hostgroup
- (Required) - Hostgroup running your Read workloadreadyset_hostgroup
- (Required) - Hostgroup where Readyset is configurewarmup_time
- (Optional) - Time in seconds to mirror a query supported before redirecting the query to Readyset (Default 0 - no mirror)lock_file
- (Optional) - Lock file to prevent two instances of the scheduler to run at the same time (Default '/etc/readyset_scheduler.lock')
Readyset support of MySQL and this scheduler are alpha quality, meaning they are not currently part of our test cycle. Run your own testing before plugging this to your production system.