Repository navigation
Conversation
VirtualMachinePowerStateSyncImpl maintained a lazy cache of host id->host and vm id->vm mappings in order to provide host and vm objects in method debug/trace logs. On a cache miss, debug logs would use HostDao and VMInstanceDao to query the respective objects from the primary database. If all HikariCP DB connections were exhausted, this call would spin for 30 seconds before timing out and throwing a CloudRuntimeException. This meant that simple logging blocked agent-handler threads, creating performance degradation for the entire management server. Fix by logging just host ID and VM ID instead of objects, removing the need to call the primary DB and maintain a cache. Remove corresponding imports, constructors, helper methods, and test scaffold.
|
@blueorangutan package |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change removing logging-only database lookups.
No open issues 🎉
What changed in this PR
Removes database lookups used only for VM power-state logging, preventing those logs from blocking agent-handler threads when database connections are exhausted.
Changes:
- Logs host and VM IDs instead of loading objects through caches.
- Removes logging-only caches, lookup helpers, and the HostDao dependency.
- Removes obsolete test mocks and setup.
| File | Description |
|---|---|
| engine/orchestration/src/test/java/com/cloud/vm/VirtualMachinePowerStateSyncImplTest.java | Removes setup and mocks for deleted logging lookups. |
| engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java | Replaces cached object logging with IDs and removes lookup infrastructure. |
Review effort: Balanced
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14940 +/- ##
============================================
+ Coverage 3.86% 21.08% +17.22%
- Complexity 0 21284 +21284
============================================
Files 494 6058 +5564
Lines 42890 549881 +506991
Branches 8142 73538 +65396
============================================
+ Hits 1657 115934 +114277
- Misses 41001 420320 +379319
- Partials 232 13627 +13395
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
not sure about testing, I think we cannot do more than smoke tests on this. |
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
Description
This PR addresses the following problem:
VirtualMachinePowerStateSyncImpl maintained a lazy cache of host id->host and vm id->vm mappings in order to provide host and vm objects in method debug/trace logs. On a cache miss, debug logs would use HostDao and VMInstanceDao to query the respective objects from the primary database. If all HikariCP DB connections were exhausted, this call would spin for 30 seconds before timing out and throwing a CloudRuntimeException. This meant that simple logging blocked agent-handler threads, creating performance degradation for the entire management server.
This PR fixes by logging just host ID and VM ID instead of objects, removing the need to call the primary DB and maintain a cache
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?