From: Matthew B. <mat...@ou...> - 2006-03-03 10:09:31
|
I'm looking at building a container (eg floor, building) that can easily contain 1000s of children. In the current implementation when a resource is visited (eg /admin/ground/sys) the code does this: First the root resource gets loaded. Then all the primary keys (PK) of the children are loaded. Then each child PK is used to load the full resource. If the name of the child resource matches the first part of the path (admin) then switch to using this resource and load all the children PKs. Continue doing this until the patch stops matching resources or we run out of path. The problem is that you may well have to load all the child resources just to find the one you are looking for. This probably isn't as bad as it sounds at first as it is likely that the user will have navigated through the resource tree loading them all anyway. I decided to try to switch to using SoftCache and an additional IndexKey on Resource (parent_resource_id, name) so that I could do direct lookups and avoid having to enumerate through all the children. The problem is that the performance from IndexKey lookups from softcache seems to be very poor, of several orders of magnitude worse that PrimaryKey lookups. I realise that IndexKey has more complex hashCode() and equals() implementations that PrimaryKey() and SoftCache has to lookup stuff in several more hashes but I didn't expect things to be this bad. Is this a known problem? I'm probably going to take a profiler to it so I can get some proper numbers and ideas about where exactly the problem lies but was wondering if anyone else has any ideas. -- -- Matthew Buckett, VLE Developer -- Learning Technologies Group, Oxford University Computing Services -- Tel: +44 (0)1865 283660 http://www.oucs.ox.ac.uk/ltg/ |