Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve monerod switchover (#6794)
Description --- Improved monerod switchover logic when another process is busy acquiring a new monerod server. Preference will be given to the currently ongoing monerod server qualifying round. Motivation and Context --- A new monerod timeout or error response interfered with a current monerod server qualifying round. How Has This Been Tested? --- System-level testing. Typical change-over from one server to the next for **get_heightt** - note the response times. In this case the change over was from `xmr-01.tari.com` to `83.217.209.212:18089`, with the former having a lot faster response with `get_height`. ```rust 2025-02-13 02:36:47.911666300 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 9449507401888018260, response time: 37ms 2025-02-13 02:36:48.939471000 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 13575053716280068238, response time: 63ms 2025-02-13 02:36:49.952704000 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 5611195404276155000, response time: 67ms 2025-02-13 02:36:50.932377400 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 10283440367075556454, response time: 42ms 2025-02-13 02:36:52.016915900 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 12963264473660460967, response time: 61ms 2025-02-13 02:36:53.017457500 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 7705492877366699726, response time: 47ms 2025-02-13 02:36:54.020946200 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 3351472723537365142, response time: 41ms 2025-02-13 02:36:55.054276400 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 14654389803029846950, response time: 67ms 2025-02-13 02:36:57.084860800 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 16581611060531486049, response time: 1078ms 2025-02-13 02:36:58.069733300 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 11200975234993943966, response time: 1049ms 2025-02-13 02:37:00.037884400 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 16367810207953566192, response time: 2008ms 2025-02-13 02:37:00.857839600 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 14763931288495226594, response time: 787ms 2025-02-13 02:37:01.080669500 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 13876100441960084867, response time: 2014ms 2025-02-13 02:37:01.444369800 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 889014338068691509, response time: 362ms 2025-02-13 02:37:02.463123200 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 11511042497828797364, response time: 370ms 2025-02-13 02:37:03.471015500 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 12745839339869933821, response time: 369ms 2025-02-13 02:37:04.550573600 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 5407531915096230694, response time: 384ms 2025-02-13 02:37:05.565108800 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 15144540318823463949, response time: 386ms 2025-02-13 02:37:06.575400700 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_height' response status = 200 OK, trace_id: 5465604504835685969, response time: 384ms ``` Typical change-over from one server to the next for **get_block_template** during the same time frame. Because this request happens less frequently, we do not notice any time-outs, just an increase in average response times. ```rust 2025-02-13 02:35:40.635512300 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 7102650860353685516, response time: 209ms 2025-02-13 02:35:56.862736500 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 5002503581636467590, response time: 309ms 2025-02-13 02:36:12.882713600 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 6305477133685166358, response time: 217ms 2025-02-13 02:36:29.013004600 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 3734157611122817821, response time: 224ms 2025-02-13 02:36:45.113786200 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 17453492759535002385, response time: 233ms 2025-02-13 02:37:01.236324200 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 379651289171152797, response time: 376ms 2025-02-13 02:37:17.127726700 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 13522787336401775792, response time: 378ms 2025-02-13 02:37:33.211018900 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 1796862900003369865, response time: 384ms 2025-02-13 02:37:49.320177300 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 3402644666467065627, response time: 365ms 2025-02-13 02:38:05.478493600 [minotari_mm_proxy::proxy::inner] DEBUG [monerod] 'get_block_template' response status = 200 OK, trace_id: 7165471818726006683, response time: 393ms ``` What process can a PR reviewer use to test or verify this change? --- Code review <!-- Checklist --> <!-- 1. Is the title of your PR in the form that would make nice release notes? The title, excluding the conventional commit tag, will be included exactly as is in the CHANGELOG, so please think about it carefully. --> Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- Does this include a breaking change? If so, include this line as a footer --> <!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Integrated a new dependency for advanced random number generation to enhance backend performance. - **New Features** - Enhanced error handling with robust detection for invalid requests, offering more informative feedback. - Improved reliability in server communications with refined fallback mechanisms and better request tracking. - **Refactor** - Streamlined logging by updating verbosity levels for clearer and more concise debug outputs. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information