In my OPC UA Server, I have dynamically created folders that contains dynamically created objects with multiple nodes. The folders are set as ParentAsOwner (http://forum.unified-automation.com/topic1746.html) so that deleting a folder, deletes all objects/nodes within it.
This works very well for folders with few objects/nodes (2200 nodes total) and takes a few seconds; however, for larger node sets (88000 nodes), just deleting the parent folder takes 12 minutes. During this time, no other node on the system is updated or can be accessed. I believe this has something to do with locks that prevent multiple threads from accessing the same node.
I delete the parent folder with this, where nodeToDelete is the NodeId of the parent folder.
Code: Select all
private void DeleteOpcNode(NodeId nodeToDelete)
{
lock (InMemoryNodeLock)
{
DeleteNode(Server.DefaultRequestContext, nodeToDelete, true);
}
}
Code: Select all
Task.Factory.StartNew(() =>
{
DeleteOpcNode(nodeToDelete);
});
Is there a way to delete so many nodes faster?
Is there a way to not lock other nodes while some nodes are being deleted?
Are using locks as above necessary?
Sincerely,
Jonathan