Copied to clipboard

Flag this post as spam?

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


  • Mathijs 27 posts 60 karma points
    May 26, 2011 @ 04:03
    Mathijs
    0

    Umbraco very slow on retreiving large data field.

    Dear community,

    My application suffer performance problems on retreiving large datafields through a webservice. The situation is as follow:

    I have created a Datatype using the umbraco user control wrapper. To store the data I chose the database datatype "Ntext".

    In this field I am storing textstrings that go up to 6000 characters. 

    This data I retreive trough a webservice, using following code: (stripped down a bit)

      [WebMethod(EnableSession = true)]
            public DisplayObject getRoute(int routeObjectId,int routeInfoId, int zoomLevel)
            {
            Node n = new Node(routeObjectId);
            string route = n.GetProperty("route").Value;
            InfoTag it = new InfoTag();
                    it.RouteString = route;
                    it.Id = n.Id.ToString();
                    dobj.AddTag(it);
            }

    As you can see. Nothing fancy about that. However.. if I call this method from my javascript there are some weird differences in performance.

    Rendertime according Firebug significant increases with the textstring length:

     

    • Response time for a request length of 1368 bytes is 720ms
    • Respones time for a request length of 5345 bytes is 4.7 seconds!
    Here is where I come to question the Umbraco api. It seems that the code line "string route = n.GetProperty("route").Value;" causes this unwanted increase of response time.
    Anyone experience with this problem and retreiving large datafields?
    Thanks in advance!
    Mathijs

     

  • Simon Justesen 436 posts 203 karma points
    May 26, 2011 @ 19:13
    Simon Justesen
    0

    Hi Mathijs,

    You're not the only one thinking GetProperty is slow, see this:

    http://our.umbraco.org/forum/developers/api-questions/5647-GetProperty-on-a-member-object-slow

    I don't know if it is a common problem though (old post), but if no one has looked into it, the problem persists...

  • Mathijs 27 posts 60 karma points
    May 26, 2011 @ 23:34
    Mathijs
    0

    Thank you for your reply Simon. However that topic doesn't provide a solution. Maybe needless to say but I'm using current latest stable version 4.7.0 of umbraco.

  • Mathijs 27 posts 60 karma points
    May 27, 2011 @ 00:54
    Mathijs
    0

    Ok guys. Solved it as following.

    According my theory the slowness is either to blame on umbraco api, but rather on MsSQL engine not performing well on nText datatype which according some sources is deprecated. Changing the datatype to nVarchar was resulting in some nice errors. So I simply decided to write the value to a file on updating in the backend and reading the contents again from file in the frontend.

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    May 27, 2011 @ 09:41
    Richard Soeteman
    0

    Hi Mathijs,

    You shouldn't use the backend Node for this.. This is calling a database. In Umbraco you also have a node object which lives in the NodeFactory namespace which gets it's data from the published xml file. This one is fast and I recomend that you use this Node object instead of the one you currently use.

    Cheers,

    Richard

  • Mathijs 27 posts 60 karma points
    May 27, 2011 @ 15:40
    Mathijs
    0

    Hi Richard,

    I'm not quite following you. Could you give a code example of what you mean?

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    May 27, 2011 @ 15:55
    Richard Soeteman
    0

    Sure,

    Below you see a snippet. This is how you can access the published content in Umbraco. It's readonly and really fast. Replace id and propertyalias with your own values

            //Create Node 1234 is the id of the node
    umbraco.NodeFactory.Node node = new umbraco.NodeFactory.Node(1234);

    string value = node.GetProperty("yourbigDataField").Value;

    Cheers,

    Richard

  • Mathijs 27 posts 60 karma points
    May 27, 2011 @ 17:46
    Mathijs
    0

    Yeah I've already tried that. Believe it or not, same slowness!

Please Sign in or register to post replies

Write your reply to:

Draft