x First time here? Check out the FAQ
  • Avatar144posts154karma

    advice needed with performance problems

    bfi started this topic More than a year ago , this topic was edited at: Wednesday, August 11, 2010 3:08 PM

    Hello,

    as I was saying here, I'm having some performance problems with a website where a lot of nodes are created by visitors. The load is not high on any of the servers, yet creating a new node now takes one minute.  I've also deleted Lucene.Net.dll, it did not help at all and I don't know what else I can do or how to track down the source of this very high amount of time needed to create a simple node. There's a user control that creates the nodes, it has a simple method for that, it calls Document.MakeNew, sets some properties, UpdateDocumentCache, calls a function to send an email, then gets the new number of nodes and the newly created node's id and name with nodeFactory and returns that. The umbraco.config file is not very big, about 26 MB. Please give me some advice on how I can tackle this issue.

    Thanks!


  • Replies

  • Avatar905posts1504karma
    Comment with ID: 41704
    Tim posted this reply More than a year ago

    Hi,

    Which version of Umbraco are you using? Prior to 4.5, the API Document calls could be a bit slow.


  • Avatar1450posts4678karma
    HQ Comment with ID: 41712
    Matt Brailsford posted this reply More than a year ago

    Hi Bfi,

    How are you getting "the new number of nodes"? Are you using the XML ie Nodefactory? Or the database ie Document? Using Document could be quite intensive if you are retreiving all the nodes to count them, but if you used Nodefactory, that should be much faster.

    That is the only thing I could imagine from what you have said would take up the time.

    Many thanks

    Matt


  • Avatar144posts154karma
    Comment with ID: 41717
    bfi posted this reply More than a year ago

    Hi,

    and thank you very much for your answers! Umbraco version is 4.0.4.2. Initially it didn't take much time at all to create nodes, it was instant. When the number of nodes increased, the time needed to create a new one went up on a really steep rate. I'm using nodeFactory; Node nodes = new Node(12345); then nodes.Children.Count right after umbraco.library.UpdateDocumentCache(doc.Id);

     

    Thanks!


  • Avatar1725posts3733karma
    Comment with ID: 41728
    Richard Soeteman posted this reply More than a year ago

    Hi,

    With CMSImport I have the same issue. Up to 1000 records/nodes works fine. One tweak that helps a lot is to set The ContinouslyUpdateXmlDiskCache option in the UmbracoSetting.Config file to false. Whenever you create a new item the internal cache is updated, by setting this option to false it doesn't.

    Also make sure to get nodes via the NodeFactory as Matt suggested.

    Hope this helps you (bit),

    Richard


  • Avatar144posts154karma
    Comment with ID: 41791
    bfi posted this reply More than a year ago

    I only have visual studio express, so doing a proper debugging is a no go. I'm also a beginner... But I tried to debug with SharpDevelop, Attach to process WebDev.WebServer.EXE - that I started with a shortcut with params. Although breakpoints don't work, I do see messages from the webserver, like WebDev.WebServer.EXE Information: 0 : SqlServerHelper created. WebDev.WebServer.EXE Information: 0 : 0. RecordsReader created by Application.Cache. Open Data Readers: 1. So, I only left in the function

    DateTime now = DateTime.Now;
    User author = User.GetUser(0);
    DocumentType dt = DocumentType.GetByAlias("someAlias");
    Document doc = Document.MakeNew(now.ToString(), dt, author, 12345);

    and when the function is called, I see a huge list of

    WebDev.WebServer.EXE Information: 0 : someNumber. RecordsReader created by CMSNode.setupNode. Open Data Readers: 1
    WebDev.WebServer.EXE Information: 0 : someNumber. RecordsReader closed. Open Data Readers: 0

    with someNumber going to really high values, close to 50000. Does this ring a bell to anyone?


  • Avatar1725posts3733karma
    Comment with ID: 41864
    Richard Soeteman posted this reply More than a year ago

    How many properties do you have on the document? Since Umbraco is creating the properties also and every property access is a single database call.


  • Avatar144posts154karma
    Comment with ID: 41868
    bfi posted this reply More than a year ago

    There are 5 properties on the document. But in the above test I'm not even setting any property, Document.MakeNew alone is causing 50k calls to CMSNode.setupNode. Pretty much twice the number of nodes where a new node is created.


  • Avatar1725posts3733karma
    Comment with ID: 41871
    Richard Soeteman posted this reply More than a year ago

    That are a lot of nodes you have in 1 folder. I know what happens (by reading the Umbraco Sourcecode). When you create a new node in Umbraco It opens its parent  to determine the amount of childnodes to set the sort order. That describes the amount of queries.

    So what you need to do to solve this issue (5000 nodes in 1 folder will not perform) is to devide the comments in some folder structure. Maybe have a look at the autofolders project?

    Cheers,

    Richard


  • Avatar144posts154karma
    Comment with ID: 41879
    bfi posted this reply More than a year ago

    I don't really need the sort order, can I just not set that property? Or leave it 0? Is it this line

    sortOrder = parent.Children.Length + 1;

    from CMSNode.cs MakeNew? I can't seem to find the source for 4.0.4.2, on codeplex the releases go from 4.0.3 straight to 4.5.

     

    Thank you!


  • Avatar905posts1504karma
    Comment with ID: 41910
    Tim posted this reply More than a year ago

    Hiya,

    I think it is that line, when you call .Children, it'll go and fetch all the child nodes, 5000 in this case, which will be pretty slow. There is a document sorter plugin (our.umbraco.org/.../document-sorter) that will autosort based on specific fields, maybe you could look at using that instead (although I don't know how well it would do on 5000 nodes)?


Pages:

Please login or Sign up To post replies