by John Munro >> Thu, 25 Oct 2007 20:50:54 GMT
We recently added a feature that exports objects from a database to an XML file which can then be loaded into other databases.
When this process was run as a thin client, it ran for several hours before the user gave up and aborted it.
When the process was run on the same database in single user mode, it took five minutes to run.
What is so different between single user and thin client modes that it makes that big a difference?
To give you an idea of what the process is doing, it goes through two stages - first of all collecting objects to export and then exporting the objects.
In the first stage it starts with the root object of the database and goes through its properties adding any referenced objects to a dictionary. It then goes through the objects in the dictionary and does the same thing - goes through their properties looking for objects and adding them to the dictionary.
A couple implementation points about this stage - it can't actually collect objects because you can't store a reference to an exclusive object. It therefore collects oids. It must ensure that the same object isn't collected more than once to avoid getting stuck in stage 1 infinitely. String arrays have worse and worse performance for the includes method the larger the collection gets, so instead of storing the oids in one of those, they are stored as the key of a DynaDictionary with a dummy member.
In the second stage, the dictionary is iterated through, and for each object it is added to a JadeXMLDocument. Each object's attributes are added as sub-elements, with the attribute value appropriately converted to String (e.g. base64EncodeNoCrLf for Binaries). The object's references are also added as sub-elements, with the value converted to String as an oid. Each object is only present in the XML file once.
My question is whether the huge time difference between single and multi-user is caused by too much transient usage (large DynaDictionary plus large JadeXMLDocument) or locking on the persistent objects or what.
I tried using the profiler but nothing in the results leapt out at me as an obvious problem.
John