oslo i18n using in lazy mode causes more file stats

Bug #1527650 reported by Attila Fazekas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.i18n
Fix Released
Wishlist
Unassigned

Bug Description

I observed many openstack services and openstack component are searing for translation very frequently.

I just modified the basic example application and enabled
the lazy mode.

http://docs.openstack.org/developer/oslo.i18n/usage.html#creating-an-integration-module

Without lazy mode I just see an initial file search via strace,
but when the lazy mode gets enabled every message causes a file search.

These kind of extra searches just waste of time,
If the file was not there at the first execution, we should not expect it will be there at every log line print. Nobody expects a service needs to find and use an on the file changed/installed translation. Would be better
to make the normal execution faster.

Revision history for this message
Attila Fazekas (afazekas) wrote :
Revision history for this message
Attila Fazekas (afazekas) wrote :
description: updated
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

This library is just a wrapper around gettext. In "non-lazy" mode, gettext is invoked when the string is encountered in the code and the results can be cached. This supports translating to one language. In lazy mode, we delay translation until the last possible moment to give the user the language they specify when making their API call. The dynamic nature of that approach means we can't cache the results of the translation, and need to call gettext more often. And gettext is searching for the message catalogs each time because it is being initialized.

We could potentially save some number of gettext translation objects based on the domain and language/locale.

Changed in oslo.i18n:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Ben Nemec (bnemec) wrote :
Changed in oslo.i18n:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.