Jira (PUP-8024) Only load module translations when necessary

0 views
Skip to first unread message

Maggie Dreyer (JIRA)

unread,
Oct 20, 2017, 6:54:03 PM10/20/17
to puppe...@googlegroups.com
Maggie Dreyer updated an issue
 
Puppet / Improvement PUP-8024
Only load module translations when necessary
Change By: Maggie Dreyer
Summary: Delay loading Only load  module translations  until 'translate' is used for that module  when necessary
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Maggie Dreyer (JIRA)

unread,
Oct 20, 2017, 6:57:02 PM10/20/17
to puppe...@googlegroups.com
Maggie Dreyer updated an issue
Currently, we attempt to initialize translations machinery for all modules as soon as they are loaded, despite the fact in many contexts we do not need to display any translations (e.g. {{module list}}). We do this even for modules that do not have any translation files or marked strings.

We also attempt to cache translations after they're loaded, but not associated with any existing cache lifetimes. So the only way to cause a translation to be reloaded is to restart the process.

We should add a function to {{module.rb}} that loads a module's translations, then call it before we think we need module translations to be displayed (e.g. before compilation, or when running a puppet application).
 We should not load translations for things like file serving, in order to avoid doing unnecessary work. We should see if these optimizations are sufficient to reduce the performance impact before doing anything more drastic.



*Notes on decoupling module naming from locales/config.yaml project name*
From comment below:
{quote}
As part of this, we should remove the requirement that the module have metadata (relies on forge_name) and remove the coupling of metadata naming and locales/config.yaml's project_name.
{quote}

Benchmarks in puppet have shown a non-trivial performance degradation if there is a mismatch between the module's metadata name, and the locales/config.yaml's project_name:
With matching names:
{code}
mkdir -p /var/folders/0_/6qt793gx6w706cq1q9kc0w780000gq/T/many_modules20171009-2426-1l58rtz
                 user     system      total        real
Run 1        3.700000   0.460000   4.170000 (  4.171436)
Run 2        2.840000   0.130000   2.970000 (  2.974983)
Run 3        2.890000   0.120000   3.010000 (  3.016188)
Run 4        2.910000   0.130000   3.040000 (  3.036231)
Run 5        2.770000   0.150000   2.920000 (  2.932649)
Run 6        2.800000   0.120000   2.920000 (  2.910116)
Run 7        3.240000   0.110000   3.350000 (  3.359197)
Run 8        2.760000   0.150000   2.910000 (  2.909707)
Run 9        3.260000   0.150000   3.410000 (  3.414169)
Run 10       3.690000   0.140000   3.830000 (  3.835340)
> total:    30.860000   1.660000  32.530000 ( 32.560017)
> avg:       3.086000   0.166000   3.253000 (  3.256002)
{code}

with mismatched names:
{code}
mkdir -p /var/folders/0_/6qt793gx6w706cq1q9kc0w780000gq/T/many_modules20171009-2350-11p565v
                 user     system      total        real
Run 1        3.680000   0.460000   4.150000 (  4.157170)
Run 2        3.300000   0.250000   3.550000 (  3.552481)
Run 3        3.180000   0.250000   3.430000 (  3.430290)
Run 4        3.400000   0.260000   3.660000 (  3.662123)
Run 5        3.690000   0.310000   4.000000 (  4.010465)
Run 6        3.600000   0.260000   3.860000 (  3.866366)
Run 7        3.320000   0.250000   3.570000 (  3.571592)
Run 8        3.610000   0.320000   3.930000 (  3.943484)
Run 9        3.560000   0.310000   3.870000 (  3.866563)
Run 10       3.990000   0.260000   4.250000 (  4.247610)
> total:    35.330000   2.930000  38.270000 ( 38.308143)
> avg:       3.533000   0.293000   3.827000 (  3.830814)
{code}

Note ~ 6 second cumulative runtime increase 

----

Note that a further implication of how we're loading modules is that if modules don't have metadata, they [will not have a forge_name|https://github.com/puppetlabs/puppet/blob/5.3.1/lib/puppet/module.rb#L226-L229] and thus [initializing i18n will be skipped|https://github.com/puppetlabs/puppet/blob/5.3.1/lib/puppet/module.rb#L426].

Maggie Dreyer (JIRA)

unread,
Oct 20, 2017, 6:58:03 PM10/20/17
to puppe...@googlegroups.com

Kenn Hussey (JIRA)

unread,
Oct 31, 2017, 9:51:04 AM10/31/17
to puppe...@googlegroups.com
Kenn Hussey updated an issue
Change By: Kenn Hussey
Fix Version/s: PUP 5.3.4
This message was sent by Atlassian JIRA (v7.0.2#70111-sha1:88534db)
Atlassian logo

Maggie Dreyer (JIRA)

unread,
Nov 27, 2017, 6:04:03 PM11/27/17
to puppe...@googlegroups.com
Maggie Dreyer commented on Improvement PUP-8024
 
Re: Only load module translations when necessary

This might be sufficiently covered by the work for PUP-8026 and PUP-8013.

Josh Cooper (JIRA)

unread,
Dec 18, 2017, 6:06:03 PM12/18/17
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-8024

Now that

PUP-8026 and PUP-8013 are fixed, let's re-run the benchmark and see if the issues are resolved.

Josh Cooper (JIRA)

unread,
Dec 18, 2017, 6:11:03 PM12/18/17
to puppe...@googlegroups.com
Josh Cooper assigned an issue to Eric Delaney
 
Change By: Josh Cooper
Assignee: Eric Delaney

Eric Delaney (JIRA)

unread,
Dec 19, 2017, 11:51:05 AM12/19/17
to puppe...@googlegroups.com
Eric Delaney updated an issue
Change By: Eric Delaney
Sprint: Platform Core  Grooming  KANBAN

Eric Delaney (JIRA)

unread,
Dec 19, 2017, 11:51:05 AM12/19/17
to puppe...@googlegroups.com
Eric Delaney updated an issue
Change By: Eric Delaney
Sub-team: Coremunity

Eric Delaney (JIRA)

unread,
Dec 19, 2017, 1:46:05 PM12/19/17
to puppe...@googlegroups.com
Eric Delaney commented on Improvement PUP-8024
 
Re: Only load module translations when necessary

After trying to verify that I could produce the problem, I talked with Maggie. The original problem here was that the modules where configuring the config.yaml file incorrectly which caused a slow down. We've ask the modules team to correct the config.yaml file and we've changed the puppet server to not use the config.yaml file at all. So this issue should be addressed.

Kenn Hussey (JIRA)

unread,
Jan 2, 2018, 9:44:03 AM1/2/18
to puppe...@googlegroups.com
Kenn Hussey commented on Improvement PUP-8024

Michael Smith please provide release notes for this issue, if needed. Thanks!

Maggie Dreyer (JIRA)

unread,
Jan 2, 2018, 12:01:53 PM1/2/18
to puppe...@googlegroups.com
Maggie Dreyer updated an issue
 
Change By: Maggie Dreyer
Release Notes: Not Needed

John Duarte (JIRA)

unread,
Oct 21, 2019, 10:50:05 AM10/21/19
to puppe...@googlegroups.com
John Duarte updated an issue
Change By: John Duarte
QA Risk Assessment: Needs Assessment No Action
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages