I've just finished debugging a poor performing webservice. What the service does is requesting a set of nodes and returning them. So far nothing special.
Problem however is that when firing just a single request the RAM usage of the server rises excessively. > 2 GB. Where the umbraco application pool normaly runs below 600 mb for the entire application with multiple active users.
I found out that just one tiny rule in the webservice is the cause for the problem:
foreach(Node item in itemList) {
Int32 parentId = node.Parent.Id;
}
Any one experienced this behaviour before? Uncommenting this line in the code speeds up my application like 700 %.
Wish I could say something more helpful but, I have also seen excessive ram usage and poor performance when looping through nodes and going up/down in the tree structure.
I am yet to find a good solution to this, other than cache the requests.
I solved it by looping down the tree so I'm able to see in the loop it's self in which parent node I'm working. This solved my problem, but of course it's still odd that requesting a Parent.Id is so slow as it is een part of a nodes xml structure within umbraco.config (In other words, requesting a parent id shouldn't do any searching up and down)
I think the Parent property itself it populated when you create a node, but it's left "un-initialised", until you access one of it's properties like for example the Id. At that point it then does a full init, loading in all child nodes etc.
If you only need the ID, I once did an extention method that fetched the parentId using the Path property on the node. I can't find the code but should be quick to create: The path is comma delimited up to the root, e.g.: path="-1,1054,1384" So implement as a Nullable int, return null if String.IsNullOrEmpty or -1, otherwise do a Split(',') and return[length-1].
Excessive ram usage on request node parent Id
Hi guys,
I've just finished debugging a poor performing webservice. What the service does is requesting a set of nodes and returning them. So far nothing special.
Problem however is that when firing just a single request the RAM usage of the server rises excessively. > 2 GB. Where the umbraco application pool normaly runs below 600 mb for the entire application with multiple active users.
I found out that just one tiny rule in the webservice is the cause for the problem:
foreach(Node item in itemList) {
Int32 parentId = node.Parent.Id;
}
Any one experienced this behaviour before? Uncommenting this line in the code speeds up my application like 700 %.
Hi. Are there many sibling nodes to the node in question?
Sorry, I meant 'child nodes' not siblings.
Well. What's many :-) Generally spoken they have between 50 and 250 siblings.
Edit: I think you frased your first question right. As parents child nodes are the same as the child node's sibling.
Wish I could say something more helpful but, I have also seen excessive ram usage and poor performance when looping through nodes and going up/down in the tree structure.
I am yet to find a good solution to this, other than cache the requests.
I solved it by looping down the tree so I'm able to see in the loop it's self in which parent node I'm working. This solved my problem, but of course it's still odd that requesting a Parent.Id is so slow as it is een part of a nodes xml structure within umbraco.config (In other words, requesting a parent id shouldn't do any searching up and down)
I think the Parent property itself it populated when you create a node, but it's left "un-initialised", until you access one of it's properties like for example the Id.
At that point it then does a full init, loading in all child nodes etc.
If you only need the ID, I once did an extention method that fetched the parentId using the Path property on the node. I can't find the code but should be quick to create:
The path is comma delimited up to the root, e.g.: path="-1,1054,1384"
So implement as a Nullable int, return null if String.IsNullOrEmpty or -1, otherwise do a Split(',') and return[length-1].
is working on a reply...