You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UI extremely slow when db.ha.enabled=true after MySQL source failure (4.22.1.0) #14172
With Database High Availability enabled (db.ha.enabled=true), after the MySQL source becomes unreachable the Management Server UI becomes extremely slow / barely usable.
Failover to the configured replica seems to happen via the MySQL connector, but each (or almost each) request appears to retry the dead source first, causing severe UI latency.
Workaround that restores normal performance:
disable db.ha.enabled
manually promote the replica (STOP REPLICA / RESET REPLICA ALL / read_only=OFF)
point db.cloud.host / db.usage.host to the promoted DB in db.properties
restart cloudstack-management
This matches the install guide "Failover" procedure better than the client-side db.ha mechanism.
CloudStack: 4.22.1.0 (Ubuntu packages, download.cloudstack.org noble)
OS: Ubuntu 24.04
MySQL: 8.0.46 (async replication source→replica, GTID)
Hypervisor: VMware
Topology: 2 Management Servers (multi-site), reverse proxy in front of UI
The steps to reproduce the bug
Deploy 2 MS pointing to MySQL source; configure two-way replica (GTID)
Set in db.properties:
db.ha.enabled=true
db.cloud.replicas=replica-ip
db.usage.replicas=replica-ip
Restart cloudstack-management on both nodes
Stop / isolate the MySQL source (simulate site/DB failure)
Use UI/API through the remaining Management Server
What to do about it?
Expected: MS fail over to replica promptly; UI remains usable.
Actual: UI becomes very slow after source outage (connector retries against unreachable source; defaults secondsBeforeRetrySource/queriesBeforeRetrySource/initialTimeout = 3600/5000/3600).
Suggestions:
fix connector failover so replica is used without per-request source retries hanging the UI
and/or document clearly that db.ha.enabled is not recommended for production on MySQL 8.x and that manual promotion (install guide Failover) is the supported path
Reporter observes that with db.ha.enabled=true on MySQL 8.x, after the configured source becomes unreachable, the management server UI becomes extremely slow because the connector keeps retrying the dead source on (nearly) every request. Manually promoting the replica and pointing db.cloud.host/db.usage.host at it (per the install guide's Failover procedure) restores normal performance. A maintainer has already commented that this DB HA mechanism was likely never fully implemented/tested, and a candidate PR (#14279) has been opened to address it.
📊 Assessment
Dimension
Value
Reasoning
Type
type:new-feature
Maintainer comment indicates the existing db.ha.enabled client-side failover was never seriously implemented and should be treated as a new feature rather than a regression/bug fix.
Issue concerns MySQL connector failover behavior within the management server's DB HA configuration.
Severity
n/a
Not labeled as a bug; classified as new-feature work per maintainer.
Labels
type:new-feature, component:database, component:management-server, component:mysql, status:Has a PR
See reasoning above; status:Has a PR added since #14279 is linked.
Coding agent
Suitable
Well-documented repro steps, config, versions, and a maintainer-linked candidate PR (#14279) already exist; mainly needs validation/testing by the reporter against that PR.
🔗 Similar issues
No clearly duplicate or related open issues were found via search for "db.ha.enabled MySQL failover replica".
💡 Notes and suggestions
PR allow loadbalanced DB #14279 was opened in response to this issue — worth asking @nabassa1323 to validate it against their reproduction steps (2 MS nodes, GTID replication, source outage simulation).
Consider updating the admin guide (currently references MySQL 5.1/5.5 testing) once the fix/feature lands, to reflect supported MySQL 8.x behavior and clarify whether manual promotion remains the documented production path.
Relevant connector settings called out by reporter: secondsBeforeRetrySource, queriesBeforeRetrySource, initialTimeout — may need tuned defaults or documentation if the new implementation still relies on MySQL Connector/J failover semantics.
Thanks for pointing to #14279 — we tested a backport of the change on CloudStack 4.22.1.0 (injected TransactionLegacy into the management fat JAR on both MS).
Setup
2 management servers
MariaDB GTID, primary + replica
db.ha.enabled=true with StaticStrategy
replica listed in db.cloud.replicas / db.usage.replicas
PR timeouts: connectTimeout=3000, socketTimeout=30000, loadBalanceBlocklistTimeout=30000
Test Stopped the primary MySQL and the management server on the primary site, leaving the other MS (and the replica DB) up.
Result
The new path is active (com.mysql.cj.jdbc.ha.MultiHostConnectionProxy in the stack).
No more UI / API slowness compared to before — the previous hang is gone.
We also did not see HikariPool / createTimeoutException in this run.
The remaining MS talked to the replica, but write paths failed with: The MySQL server is running with the --read-only option so it cannot execute this statement e.g. SELECT … FROM op_ha_work … FOR UPDATE from HighAvailabilityDaoImpl.take.
So the latency/hang issue looks fixed by the PR. After losing the primary MS + primary DB, without promoting the replica to read/write, the surviving MS stays responsive but write operations fail on read-only.
Is the expected model for db.ha + loadbalance that the replica must be promoted (or already writable) for CloudStack to remain fully usable after primary loss?
Happy to retest with any config tweak you recommend.
I think it is expected, yes. In a primary / replica scenario failover will have to be manual. I think we can further improve in the future. I also know there are people using galdera in the wild. For that you need at least three instances of the DB. If you have a scenario for failover that works with this change I think we should merge.
@DaanHoogland,
Yes, we have a failover scenario that works with this change:
Primary MySQL (and primary-site MS) down → with #14279, the remaining MS stays responsive (no UI hang / no Hikari timeout). It uses the replica.
Manual promote of the replica (read_only=OFF, stop replication as needed) → writes succeed again and CloudStack is fully usable.
So: automatic writable failover is still not there (expected for primary/replica), but manual failover works and the hang is fixed. On that basis we think #14279 should be merged.
11. @DaanHoogland,
Yes, we have a failover scenario that works with this change:
Primary MySQL (and primary-site MS) down → with #14279, the remaining MS stays responsive (no UI hang / no Hikari timeout). It uses the replica.
Manual promote of the replica (read_only=OFF, stop replication as needed) → writes succeed again and CloudStack is fully usable.
So: automatic writable failover is still not there (expected for primary/replica), but manual failover works and the hang is fixed. On that basis we think #14279 should be merged.
Activity
DaanHoogland commentedon Oct 1, 2026
@nabassa1323 I had claudecode create a PR; #14279. Can you see if this meets your requirements and test it?
I think this was never implemented seriously and I think we would need to classifyt it as a new feature, though some claims had been made.
github-actions commentedon Oct 1, 2026
🎯 Triage report
Reporter observes that with
db.ha.enabled=trueon MySQL 8.x, after the configured source becomes unreachable, the management server UI becomes extremely slow because the connector keeps retrying the dead source on (nearly) every request. Manually promoting the replica and pointingdb.cloud.host/db.usage.hostat it (per the install guide's Failover procedure) restores normal performance. A maintainer has already commented that this DB HA mechanism was likely never fully implemented/tested, and a candidate PR (#14279) has been opened to address it.📊 Assessment
type:new-featuredb.ha.enabledclient-side failover was never seriously implemented and should be treated as a new feature rather than a regression/bug fix.component:database,component:management-server,component:mysqlstatus:Has a PRadded since #14279 is linked.🔗 Similar issues
No clearly duplicate or related open issues were found via search for "db.ha.enabled MySQL failover replica".
💡 Notes and suggestions
@nabassa1323to validate it against their reproduction steps (2 MS nodes, GTID replication, source outage simulation).secondsBeforeRetrySource,queriesBeforeRetrySource,initialTimeout— may need tuned defaults or documentation if the new implementation still relies on MySQL Connector/J failover semantics.Add this agentic workflows to your repo
To install this agentic workflow, run
nabassa1323 commentedon Oct 6, 2026
Hi @DaanHoogland,
Thanks for pointing to #14279 — we tested a backport of the change on CloudStack 4.22.1.0 (injected TransactionLegacy into the management fat JAR on both MS).
Setup
2 management servers
MariaDB GTID, primary + replica
db.ha.enabled=true with StaticStrategy
replica listed in db.cloud.replicas / db.usage.replicas
PR timeouts: connectTimeout=3000, socketTimeout=30000, loadBalanceBlocklistTimeout=30000
Test Stopped the primary MySQL and the management server on the primary site, leaving the other MS (and the replica DB) up.
Result
The new path is active (com.mysql.cj.jdbc.ha.MultiHostConnectionProxy in the stack).
No more UI / API slowness compared to before — the previous hang is gone.
We also did not see HikariPool / createTimeoutException in this run.
The remaining MS talked to the replica, but write paths failed with: The MySQL server is running with the --read-only option so it cannot execute this statement e.g. SELECT … FROM op_ha_work … FOR UPDATE from HighAvailabilityDaoImpl.take.
So the latency/hang issue looks fixed by the PR. After losing the primary MS + primary DB, without promoting the replica to read/write, the surviving MS stays responsive but write operations fail on read-only.
Is the expected model for db.ha + loadbalance that the replica must be promoted (or already writable) for CloudStack to remain fully usable after primary loss?
Happy to retest with any config tweak you recommend.
DaanHoogland commentedon Oct 6, 2026
I think it is expected, yes. In a primary / replica scenario failover will have to be manual. I think we can further improve in the future. I also know there are people using galdera in the wild. For that you need at least three instances of the DB. If you have a scenario for failover that works with this change I think we should merge.
cc @sureshanaparti @weizhouapache can you add your thoughts?
nabassa1323 commentedon Oct 14, 2026
@DaanHoogland,
Yes, we have a failover scenario that works with this change:
Primary MySQL (and primary-site MS) down → with #14279, the remaining MS stays responsive (no UI hang / no Hikari timeout). It uses the replica.
Manual promote of the replica (read_only=OFF, stop replication as needed) → writes succeed again and CloudStack is fully usable.
So: automatic writable failover is still not there (expected for primary/replica), but manual failover works and the hang is fixed. On that basis we think #14279 should be merged.
weizhouapache commentedon Oct 14, 2026
thanks @nabassa1323
looks nice