Copied to clipboard

Flag this post as spam?

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


  • Mike Ward 7 posts 85 karma points
    Jun 08, 2015 @ 13:58
    Mike Ward
    0

    Hundreds of DB calls

    Hi there,

    Used Vorto on a few sitesw now and its a great package, however my current project is quite big and Vorto has been used comprehensibly throughout for most facets of the project.

    While doing a SQL trace log i noticed that Umbraco does a DB call for what appears to be every field on a page using Vorto.

    exec sp_executesql N'SELECT COUNT(*) FROM [umbracoLanguage] WHERE ([umbracoLanguage].[id] <> @0)',N'@0 int',@0=0

    i have tested this on Umbraco sites that use Vorto (the same happens but to a lesser degree) and also verified on a site that doesn't use vorto and the DB calls arent made at all.

     

    This basically amounts to 300+ DB calls per page load and is flooding the server and creating significant waiting times.

     

    Is anyone else experiencing this?

    Can anyone point me in the direction of making this a cached call or does Umbraco cache this information by default?

     

    thanks in advance,

    Mike.

     

  • Mike Ward 7 posts 85 karma points
    Jun 08, 2015 @ 19:27
    Mike Ward
    100

    figured it out,   for the record this was NOTHING to do with Vorto,  we had some erroneous code that was calling the below in a loop.

    i would have thought Umbraco should cache values like that though.

    ApplicationContext.Current.Services.LocalizationService.GetAllLanguages().ToList()
    ApplicationContext.Current.Services.LocalizationService.GetLanguageByCultureCode(...)
  • Paul Sterling 718 posts 1534 karma points MVP 9x admin c-trib
    Jun 08, 2015 @ 20:04
    Paul Sterling
    1

    @Mike

    But you are using the management API so the assumption is that there will be database interaction - as there is with all of the management API services.  Especially when doing something like .GetAllLanguages(), this makes sense I believe.  The context here is that you are using the API to do what you could also do from the backoffice.

    In general, unless you're creating a management type of site, you'll want to avoid using the management API for any front-end rendering - you probably already know this, but it does seems ot be a common mistake so for anyone else who come across this.

  • Mike Ward 7 posts 85 karma points
    Jun 09, 2015 @ 10:28
    Mike Ward
    0

    Hey Paul,   thanks for replying!

    now you have said it out loud that makes perfect sense,   none of this is my code, i have inherited the project from another developer whom is no longer at my company and to be honest, i am a bit of an Umbraco noob, so you can drop me in the common mistake pile :)

    If i wanted to access those values on the front end, what would be the best way to get them?   Currently i have it cached as the likelyhood a new language will get added is pretty slim and would invoilve work from us anyway.

Please Sign in or register to post replies

Write your reply to:

Draft