1

We are working on a multilingual sitecore solution and have been seeing some performance issues related to Sitecore Dictionary calls. Especially what I am seeing is increased direct SQL queries every time a call to Translate.TextByDomain method to get a dictionary value. I am not exactly sure how the caching with dictionary by domain works and wondering if there are any settings that I should be looking into? Any help would be great.

Thanks, Hetal

  • Any reason you're specifally using Translate.TextByDomain() and not Translate.Text() with domain specified per site in config as dictionaryDomain attribute? Same issue would exist that Vincent highlights, but you can set the ID in the config. Worth mentioning since the code is cleaner and more re-usable. – jammykam Aug 14 '17 at 18:25
  • We have multiple dynamic domains in our solutions. – hdvti Aug 14 '17 at 19:22
6

I was pretty sure, the use of dictionary items for translation was pretty quick, due to the fact that Sitecore caches the dictionary into a binary file but...

It turns out that when you use the domain, the first thing that Sitecore (always) does is look for the domain item with this query:

fast://*[@@templateid='{0A2847E6-9885-450B-B61E-F9E6528480EF}' and @@key!='__standard values']

This can explain why you see the direct SQL queries. It does a query across the whole content looking for items with template "Dictionary Domain"

You can avoid this query by passing the item ID (as string) of the domain, instead of the domain name, as if the text is an ID (ID.IsID(str)) Sitecore does a GetItem. Please note I never tried this approach, it is only based on the piece of code I just read.

Once it has the domain, then it calls TryTranslateTextByLanguage, which is the one that actually uses the binary file (dictionary.dat).

  • Nice find on that. – Chris Auer Aug 14 '17 at 17:13
  • I would even consider asking Support, they may have a better implementation for domains... Who knows... – Vicent Galiana Aug 14 '17 at 17:15
  • 1
    We tried that and it has improved the performance by more than 60%. So that is good! :) However, it would be nice if we could actually get the cached domains. – hdvti Aug 14 '17 at 17:17
  • Great to see that it worked. We could try to find a way to improve caching, but in my own opinion, here we are not trying to extend or change Sitecore's behaviour, we are talking about fixing/improving it, so I would request Sitecore (via support) to do it. – Vicent Galiana Aug 15 '17 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.