-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: consolidate event processing and optimize application performance #23
Conversation
Coverage Report
|
9994777
to
f190a11
Compare
I'd recommend using Guava's Cache instead of Ehcache if you require LRU. I may be biased, but my opinion is that library is not safe for production users due to a trivially exploitable denial of service attack. Both have bugs and are inactive. fwiw - Caffeine's eviction policy is adaptive, so it starts biased towards frequency and adjusts towards recency based on the observed workload. It does not provide any guarantees if you rely on LRU semantics for correct application behavior, as a more important constraint than the hit rate. If that is the case, then I think making the logic more explicit about the LRU requirement (e.g. via a LinkedHashMap or similar) is better for maintainability. |
src/main/kotlin/ch/srgssr/pillarbox/monitoring/DataTransferApplicationRunner.kt
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/event/EventDispatcherClient.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/event/EventDispatcherClient.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/event/EventDispatcherClient.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/event/EventDispatcherClient.kt
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/event/EventDispatcherClient.kt
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/event/EventDispatcherClient.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/event/EventDispatcherClient.kt
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/event/EventDispatcherClientConfiguration.kt
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/opensearch/ElasticsearchRepositoryExtensions.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/ch/srgssr/pillarbox/monitoring/DataTransferApplicationRunner.kt
Show resolved
Hide resolved
f190a11
to
fdb4eaf
Compare
@ben-manes Thank you for the feedback! I've used Caffeine before and really appreciate its simplicity. However, for our particular use case, we require a strict LRU eviction policy. After evaluating your comment, I reconsidered our previous implementation and decided to drop EhCache and add a simple LRU cache using |
src/main/kotlin/ch/srgssr/pillarbox/monitoring/cache/LRUCache.kt
Outdated
Show resolved
Hide resolved
The event processing system has been updated to improve readability and efficiency: - Switched from Reactor to Kotlin Flow for event handling to improve readability. - Events are now saved in batch, reducing concurrency and improving performance. - Removed reconciliation logic with a more aggressive in memory cache approach. - Replaced Caffeine with a simple LinkedHashMap cache to support LRU eviction policy. - Added configuration parameters to adjust the size of the cache, buffer and batch chunk size. These properties can also be modified with environment variables. - Removed actuator: benchmarks are now log, reducing memory consumption and eliminating the need for starting a server. - Updated dependencies to the latest compatible versions. - Replaced dynamic mapping in OpenSearch with a handmade mapping for document fields. This change reduces storage requirements, and eliminates unnecessary fields, making queries more logical and efficient. Co-authored-by: Gaëtan Muller <[email protected]>
fdb4eaf
to
4b202ca
Compare
🎉 This PR is included in version 3.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Resolves #22 by updating the event processing system to improve efficiency.
Changes Made
properties can also be modified with environment variables.
for starting a server.
reduces storage requirements, and eliminates unnecessary fields, making queries more logical and
efficient.
Checklist