Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and optimize read-only actions + Simulator (combined) #4127

Merged
merged 14 commits into from
Apr 21, 2023

Conversation

rahim-kanji
Copy link
Collaborator

@rahim-kanji rahim-kanji commented Feb 17, 2023

Refactor and optimize read-only actions PR

Optimize read-only actions by removing the dependency on proxysql admin tables. Instead, a separate mapping container is maintained, which records the state of the HGM servers. This avoids the need to call the commit method on every change, which improves performance. The changes in this commit also ensure that the mapping container is properly updated when servers are added, removed or modified.

Read only simulator PR

This commit introduces a first simulator for read_only monitoring

ProxySQL itself will simulate hundreds of backends across hundreds of
hostgroups, all configured in hundreds of clusters, and return read_only
values for each of the simulated backend.
The read_only value can be configured in table READONLY_STATUS available in
the SQLite3Server module.

If a backend isn't configured in table READONLY_STATUS , its default read_only
value is 1.

It is possible to simulate a lot of simultaneous failover running queries like
the following:

UPDATE READONLY_STATUS SET read_only=1;
CREATE TABLE t1 AS SELECT hostname FROM READONLY_STATUS ORDER BY RANDOM() LIMIT 50;
UPDATE READONLY_STATUS SET read_only=0 WHERE hostname IN (SELECT hostname FROM t1);
DROP TABLE t1;

@rahim-kanji rahim-kanji marked this pull request as ready for review February 17, 2023 11:07
@rahim-kanji rahim-kanji changed the title Refactor and optimize read-only actions method + Simulator (combined) Refactor and optimize read-only actions + Simulator (combined) Feb 17, 2023
@rahim-kanji rahim-kanji force-pushed the v2.x_refactor_read_only_action_with_simulator branch from b803c8d to 3aa4055 Compare February 17, 2023 14:43
@JavierJF
Copy link
Collaborator

JavierJF commented Mar 2, 2023

Hi @rahim-kanji, maybe I'm out of the loop here, any reason for commit 3aa4055 ? Otherwise it should be reverted before merging this PR. It's a fix for fixing incompatibilities between another monitoring threads that call commit and replication_hostgroups.

@rahim-kanji
Copy link
Collaborator Author

Hi @rahim-kanji, maybe I'm out of the loop here, any reason for commit 3aa4055 ? Otherwise it should be reverted before merging this PR. It's a fix for fixing incompatibilities between another monitoring threads that call commit and replication_hostgroups.

Had a discussion and commit reverted.

@rahim-kanji
Copy link
Collaborator Author

retest this please

@rahim-kanji
Copy link
Collaborator Author

retest this please

Copy link
Collaborator

@JavierJF JavierJF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor shared enhancements observed during the review of #4144

lib/MySQL_HostGroups_Manager.cpp Outdated Show resolved Hide resolved
lib/MySQL_HostGroups_Manager.cpp Outdated Show resolved Hide resolved
@JavierJF
Copy link
Collaborator

Looking great! 🎉

…milliseconds, which is then converted into microseconds.

Fixed in read_only_actions_v2.
@renecannao
Copy link
Contributor

retest this please

@renecannao renecannao merged commit ff778c1 into v2.x Apr 21, 2023
@renecannao renecannao deleted the v2.x_refactor_read_only_action_with_simulator branch August 29, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants