Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Peck 690 posts 1896 karma points c-trib
    Jul 11, 2016 @ 21:23
    David Peck
    0

    Dictionary performance issues?

    Our site has a few performance issue which I've compensated for with some view/ donut caching. However I'd like to get to the root of the problem and I wondered about the dictionary. The dictionary is used extensively so that ALL ancillary text is contained in here. These items don't appear to be in the content cache so I'm curious, is the CMS making an new SQL query for each dictionary item and on every request?

  • David Peck 690 posts 1896 karma points c-trib
    Aug 01, 2016 @ 09:45
    David Peck
    101

    To answer my own question, it does appear a new SQL query is made for each Dictionary item when it is first used and it is then cached. This is a bit shonky, but the workaround is to cache all dictionary items when the app starts and then call on my own cache - unless someone has a better way?

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Aug 01, 2016 @ 10:30
    Alex Skrypnyk
    0

    Hi David,

    Nice solution!

    Why is it a bit shonky?

    Why caching all items on app start is better?

    Thanks,

    Alex

  • David Peck 690 posts 1896 karma points c-trib
    Aug 01, 2016 @ 12:14
    David Peck
    0

    I mean that the dictionary items each generate a DB query is shonky, as the overhead is much larger than a single query, rather than my workaround is shonky.

  • Alex Skrypnyk 6150 posts 24110 karma points MVP 8x admin c-trib
    Aug 01, 2016 @ 12:17
    Alex Skrypnyk
    0

    Yes, David, you are right. I think Umbraco has to improve this functionality.

  • Rahul Patel 8 posts 80 karma points
    Dec 21, 2017 @ 17:36
    Rahul Patel
    1

    I'm not sure there is even caching on first lookup. I am seeing a SQL hit every time my page is loaded for each lookup. Poking around in the DefaultCultureDictionary implementation, I don't see what caching is going on other than the Language:

    https://github.com/umbraco/Umbraco-CMS/blob/18deb8ad99bce0b19372d90f8c0fabad36beeb50/src/Umbraco.Web/Dictionary/UmbracoCultureDictionary.cs

  • Garðar Þorsteinsson 118 posts 564 karma points
    Dec 21, 2017 @ 19:40
    Garðar Þorsteinsson
    2

    Hi,

    Not sure if this is something that can help you but I had some issues with the Dictionary as it will sometimes always make SQL hit. For example when the key is not available anymore. I did not like it making the first request slow for the user, would rather want it to be ready on first request.

    So I made a small project that fetches all keys on startup and fills cache. Then there are helpers you can use.

    Umbraco.GetDictionaryValue("key") would be Umbraco.DictionaryValue("key")

    https://github.com/Vettvangur/Vettvangur.DictionaryHelper

  • John Bergman 483 posts 1132 karma points
    Dec 21, 2017 @ 20:52
    John Bergman
    0

    @Garðar Þorsteinsson Nice :-)

Please Sign in or register to post replies

Write your reply to:

Draft