[MAGNOLIA-7995] Optimise TranslationServiceImpl for better throughput Created: 11/Feb/21  Updated: 29/Jan/24  Resolved: 15/Dec/21

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.15

Type: Improvement Priority: Neutral
Reporter: Aleksandr Pchelintcev Assignee: Federico Grilli
Resolution: Done Votes: 0
Labels: performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Testcase included:
Yes
Documentation update required:
Yes
Epic Link: Throughput improvements

 Description   
  • Avoid transitive references to Hashtable via Properties class. Hash table is a legacy map implementation with synchronised API and causes thread blocks under stress. It should be avoided, but Properties class unfortunately extends Hashtable and -> should be avoided as well. We can still consume the keys and values from the files via Properties, but store and expose them via more suitable hash map implementations.
  • Avoid excessive Guice injector invocations by defaultMessageBundlesLoaderProvider: the provider is not defined by us, it is generated by Guice (and is used iiuc only to defer the injection of DefaultMessageBundlesLoader after constructor is done). This results into an injector.getInstance call upon every interaction (pretty much every property resolution call) and is a blocker in a concurrent environment. Simple solution would be to define an explicit provider or optimise the injection somehow else, so that the callers interact with real object and not a provider at all.

Generated at Mon Feb 12 04:28:41 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.