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

Feature Request: Support for Discrepant MySQL Configurations Between Primary and Replica vttablets #17223

Open
yydoow opened this issue Nov 13, 2024 · 6 comments
Assignees
Labels
Component: Cluster management Component: General Changes throughout the code base Type: Enhancement Logical improvement (somewhere between a bug and feature)

Comments

@yydoow
Copy link

yydoow commented Nov 13, 2024

Feature Description

Description

Currently, Vitess requires the MySQL configurations on both primary and replica vttablets to be identical. However, given the different roles and performance characteristics of primary and replica databases, it would be beneficial to allow for different MySQL configurations on each. This feature request proposes the ability to configure MySQL settings independently for primary and replica vttablets.

Benefits

Performance Optimization: Tailoring configurations to the specific roles of primary and replica can lead to significant performance improvements.
Resource Utilization: Different configurations can help in better resource utilization based on the workload characteristics of primary and replica databases.
Flexibility: Provides more flexibility in managing database configurations and optimizing for different use cases.

Request: Evaluate the possibility of allowing different MySQL configurations for primary and replica vttablets in Vitess.

Use Case(s)

Use Case

In many scenarios, the primary database is optimized for write performance and durability, while replicas are optimized for read performance and may have different durability requirements. For example:

Primary vttablet Configuration:

innodb_flush_log_at_trx_commit=1
sync_binlog=0
binlog_group_commit_sync_delay=100000

Replica vttablet Configuration:

innodb_flush_log_at_trx_commit=0
sync_binlog=0
binlog_group_commit_sync_delay=0

These configurations reflect the different roles of the primary and replica databases. The primary is configured for maximum durability with innodb_flush_log_at_trx_commit=1, while the replica is configured for performance with innodb_flush_log_at_trx_commit=0.

@yydoow yydoow added the Needs Triage This issue needs to be correctly labelled and triaged label Nov 13, 2024
@shlomi-noach shlomi-noach added Component: Cluster management Component: General Changes throughout the code base Type: Enhancement Logical improvement (somewhere between a bug and feature) and removed Needs Triage This issue needs to be correctly labelled and triaged labels Nov 13, 2024
@arthurschreiber
Copy link
Contributor

Mh. Are you running with semi sync or without? With semi sync, you could just use the config options you have on replicas on the primary as well, because each transaction is guaranteed to have been replicated to at least one replica.

@mattlord
Copy link
Contributor

mattlord commented Nov 13, 2024

Which tablet is a replica and which is a primary is not static. You can already dynamically configure a MySQL instance whenever/however you like (e.g. disabling syncing for binlogs and Innodb Redo logs). Vitess does not constantly check all MySQL config options in running instances and enforce they be the same across the fleet. I must be missing something as I'm not sure exactly what is being requested here?

Maybe you're saying that you want to be able to define a static MySQL config for different tablet types and have Vitess enforce that when a tablet's type changes?

@GuptaManan100
Copy link
Member

I agree with Matt, I don't think we should be adding this to Vitess.

@yydoow
Copy link
Author

yydoow commented Nov 14, 2024

Maybe you're saying that you want to be able to define a static MySQL config for different tablet types and have Vitess enforce that when a tablet's type changes?

Yes, exactly. Our MySQL database implementation requires something like this:

{
 "master": {
   "innodb_flush_log_at_trx_commit": "1",
   "max_connect_errors": 4294967295,
   "read_only": 0,
   "sync_binlog": 1
 },
 "slave": {
   "innodb_flush_log_at_trx_commit": "2",
   "max_connect_errors": 4294967295,
   "read_only": 0,
   "sync_binlog": 0
 }
}

We have a mechanism that detects the role of MySQL and applies the appropriate configuration. This helps reduce slave lag and other issues.

Another example, consider binlog_group_commit_sync_delay=100000. We only want this setting on the primary for parallel replication. The replica doesn't need to delay for 100 ms for each group.

This approach can save time when rebuilding replicas from backups, especially for busy MySQL instances with a high volume of transactions.

@arthurschreiber
Copy link
Contributor

Another example, consider binlog_group_commit_sync_delay=100000. We only want this setting on the primary for parallel replication. The replica doesn't need to delay for 100 ms for each group.

I know this is off-topic, but have you looked into WRITESET? If your goal with that commit sync delay is to have better parallelism on your multi threaded replicas, you probably should use WRITESET instead.

@yydoow
Copy link
Author

yydoow commented Nov 15, 2024

binlog_group_commit_sync_delay is just a case what about innodb_flush_log_at_trx_commit ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Cluster management Component: General Changes throughout the code base Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

No branches or pull requests

6 participants