Bug 1315660 - Multidomain translations slow hammer down
Multidomain translations slow hammer down
Status: ASSIGNED
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Hammer (Show other bugs)
6.0.4
Unspecified Unspecified
unspecified Severity medium (vote)
: GA
: --
Assigned To: Tomas Strachota
Katello QA List
http://projects.theforeman.org/issues...
: Triaged
Depends On: 1370562
Blocks: 1122810
  Show dependency treegraph
 
Reported: 2016-03-08 06:31 EST by Tomas Strachota
Modified: 2017-08-15 16:02 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 14092 None None None 2016-04-22 12:35 EDT

  None (edit)
Description Tomas Strachota 2016-03-08 06:31:57 EST
When hammer is installed with multiple plugins the startup slows down. Profiling showed we're loosing quite some time in fast-gettext's initialisation and translation methods. It loads all available .mo files for all languages in all plugins regardless what language is used. Another inefficiency lies in multidomain translations we're using (one domain per plugin). For each translation fast-gettext iterates over all domains until it finds the key.

Simple measurement for hammer with plugins:

 * hammer_cli_foreman
 * hammer_cli_foreman_bootdisk
 * hammer_cli_foreman_discovery
 * hammer_cli_foreman_docker
 * hammer_cli_gutterball
 * hammer_cli_import
 * hammer_cli_katello

Standard hammer configuration on ruby 1.9.3:
<pre>
time hammer --version > /dev/null
real	0m1.584s
user	0m1.453s
sys	0m0.130s

</pre>

With only one translation domain:
<pre>
time hammer --help > /dev/null
real	0m1.109s
user	0m1.017s
sys	0m0.092s
</pre>

The solution seems to be to create custom fast-gettext translation repository that would merge the keys at load time to get rid of the search loops in each translation. Loading the .mo files lazily might also improve the performance.
Comment 1 Tomas Strachota 2016-03-08 06:31:59 EST
Created from redmine issue http://projects.theforeman.org/issues/14092
Comment 2 Tomas Strachota 2016-03-08 06:32:03 EST
Upstream bug assigned to tstrachota@redhat.com
Comment 4 Bryan Kearney 2016-08-16 12:13:11 EDT
Moving to POST since upstream bug http://projects.theforeman.org/issues/14092 has been closed

Note You need to log in before you can comment on or make changes to this bug.