jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Design questions regarding reference handling
Date Fri, 20 Jun 2008 13:56:03 GMT
Hi,

Peter Bauer wrote:
> Hi all,
> 
> please consider the following example. There are about 1000 User nodes with
> their properties like password and so on and about the same number of roles
> which can be associated with the users to indicate that the specific user is
> allowed to use the role. Since i found some postings in the mailing list from
> people having performance issues with REFERENCE properties, my question is
> what would be the best method linking the users to the roles?
> 
> 1. REFERENCEs: The worst-case scenario is that every user is linked to every
> role which means 1000 * 1000 = 1M REFERENCE properties.

not necessarily, if you use multi-valued properties, you'd only have 1k 
reference properties.

> If a role shall be
> deleted, the REFERENCE property of all 1000 users has to be found by
> back-referencing (very fast i think)

correct. it's basically a list of 1000 property ids.

> and removed programmatically, since
> there is no cascaded delete available. What are the operations performed on
> the database regarding the REFERENCEs if operations are performed on the user
> or role nodes?

if you delete a role with 1000 users assigned to a bundle persistence manager will:

- delete the role node (1 row deleted)
- update the parent node (1 row updated)
- delete the node references for the role node (1 row deleted)
- update the reference properties of the 1000 users (1000 rows updated)

regards
  marcel

> 2. Bi-directional PATHs, UUIDs as String: Every user stores the PATHs or the
> UUIDs of the associated roles in a String property. To allow efficient
> back-referencing to all users associated with a role (for deleting the
> linking properties from the users), every role would additionally have to
> keep the UUID or PATH of all associated roles. This potentially means that
> every user has 1000 PATHs or UUIDs as well as each role -> 1000 * 1000 + 1000
> * 1000 = 2M PATH or UUID properties.
> 
> /content
> |--users
> |----user1
> |      +allowedroles[MULTIVALUED REFERENCE/PATH/STRING]
> |----user2
> |      +allowedroles[MULTIVALUED REFERENCE/PATH/STRING]
> |....
> |----user1000
> |      +allowedroles[MULTIVALUED REFERENCE/PATH/STRING]
> 
> ------------
> 
> /content
> |--roles
> |----role1
> |      +allowedroles[MULTIVALUED PATH/STRING] only in case of option 2
> |----role2
> |      +allowedroles[MULTIVALUED PATH/STRING] only in case of option 2
> |....
> |----role1000
> |      +allowedroles[MULTIVALUED PATH/STRING] only in case of option 2
> 
> 
> 
> 
> 


Mime
View raw message