You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "jayblanc (via GitHub)" <gi...@apache.org> on 2025/12/29 09:38:59 UTC

[PR] [UNOMI-924] Make healthcheck concurrent [unomi]

jayblanc opened a new pull request, #746:
URL: https://github.com/apache/unomi/pull/746

   This pull request refactors the `HealthCheckService` to improve thread safety, caching, and concurrency, as well as to simplify the health check execution logic. The main changes include introducing a cache for health check results, switching to a cached thread pool, and removing unnecessary stream usage.
   
   **Thread safety and caching improvements:**
   * Added a cache (`healthCache`) for health check results, a timestamp (`cacheTimestamp`), and synchronization logic to prevent concurrent refreshes. This ensures results are not recomputed too frequently and improves performance under load. [[1]](diffhunk://#diff-fcfb0be4f3106eb845adf037a89f74198eb6dd88e88e4f51500858b15e22b095R44-L46) [[2]](diffhunk://#diff-fcfb0be4f3106eb845adf037a89f74198eb6dd88e88e4f51500858b15e22b095L117-L149)
   * Introduced a `cacheLock` object and `busy` flag to coordinate cache refreshes and avoid race conditions. [[1]](diffhunk://#diff-fcfb0be4f3106eb845adf037a89f74198eb6dd88e88e4f51500858b15e22b095R44-L46) [[2]](diffhunk://#diff-fcfb0be4f3106eb845adf037a89f74198eb6dd88e88e4f51500858b15e22b095L117-L149)
   
   **Concurrency and execution changes:**
   * Changed the executor from a single-threaded executor to a cached thread pool to better handle concurrent health check provider executions.
   * Removed the use of `Future` and timeouts when executing health check providers; now calls `provider.execute()` directly and handles exceptions by marking the provider as timed out.
   
   **Code simplification and cleanup:**
   * Removed unnecessary use of streams and collectors when filtering providers, simplifying the code with a direct `toList()` call. [[1]](diffhunk://#diff-fcfb0be4f3106eb845adf037a89f74198eb6dd88e88e4f51500858b15e22b095L31) [[2]](diffhunk://#diff-fcfb0be4f3106eb845adf037a89f74198eb6dd88e88e4f51500858b15e22b095L117-L149)
   * Improved logging and early returns when the health check service is disabled.
   
    - [X] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [UNOMI-924] Make healthcheck concurrent [unomi]

Posted by "jayblanc (via GitHub)" <gi...@apache.org>.
jayblanc merged PR #746:
URL: https://github.com/apache/unomi/pull/746


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@unomi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org