In order to make ABAC have high performance, we need to be able to translate scripted group jexl's into SQL.

And in order for a SQL to be able to check privileges/memberships/pointInTime efficiently, we need a SQL cache of flattened data.

Certain groups will be "SQL cachable", which means they are needed for high performance queries.  Note, the group (or stem or attribute def) is cachable for one or many fields.  Fields are either "members" or a privilege.

Examples:

  1. Groups that are used as factors in JEXL scripts
  2. Overall groups in JEXL scripts
  3. Groups used heavily by the API (not necessarily WS)
  4. Groups marked as cachable by deployer
  5. Grouper internal groups that are known to be queried a lot

Notes:

  1. Make sure all the internal id fields are added to main tables (e.g. fields)
  2. Full sync will process one at a time

grouper_sql_cache_group table

ColumnDescriptionNotes
internal_idbigint internal id for this rowprimary key
group_internal_idbigint internal id for group, stem, or attribute defnon null
field_internal_idbigint internal id for field
membership_sizebigint number of membersrequired.  Included groups as members
membership_pit_sizebigint number of pit records for this groupnot used
enabled_timestamptimestamp when this can be usedrequired.  Code that uses group cache should not rely on SQL cache if it is "too new" unless it inserted it.
disabled_timestamptimestamp when this should stop being usedOnce there is a timestamp here, code should stop using the SQL cache and use normal membership queries
created_timestamptimestamp when this row was insertedrequired
last_membership_synctimestamp of last full sync

grouper_sql_cache_mship table

ColumnDescriptionNotes
sql_cache_group_internal_idbigint internal id for grouper_sql_cache_groupforeign key to sql cache group.
member_internal_idbigint internal id for member
flattened_add_timestampbigint of the most previous flattened add of user to group with this fieldrequired

grouper_sql_cache_mship_hst table

ColumnDescriptionNotes
sql_cache_group_internal_idbigint internal id for grouper_sql_cache_group

foreign key to sql cache group.

member_internal_idbigint internal id for member
start_timetimestamp this flattened add to grouprequired
end_timetimestamp this flattened remove group

required (note current members not needed, right?)


Attribute for history cacheable

Note that the non-history cacheable table is populated for every membership and privilege.  However, the history table is only populated where it's needed (e.g. based on ABAC) or if manually set by attribute.  See grouper_sql_cache_dependency based on dependency category mshipHistory.  History is kept for 2 years.

The following attributes can be assigned to a group to enable history caching (e.g. assign sqlCacheableHistoryGroupMembers to enable history caching for the members of the group, assign sqlCacheableHistoryGroupAdmins to enable history caching for the admins of the group):

sqlCacheableHistoryGroupMembers
sqlCacheableHistoryGroupAttrReaders
sqlCacheableHistoryGroupAttrUpdaters
sqlCacheableHistoryGroupAdmins
sqlCacheableHistoryGroupOptins
sqlCacheableHistoryGroupOptouts
sqlCacheableHistoryGroupReaders
sqlCacheableHistoryGroupUpdaters
sqlCacheableHistoryGroupViewers

The following attributes can be assigned to an attribute definition to enable history caching:

sqlCacheableHistoryAttributeDefAdmins
sqlCacheableHistoryAttributeDefAttrReaders
sqlCacheableHistoryAttributeDefAttrUpdaters
sqlCacheableHistoryAttributeDefOptins
sqlCacheableHistoryAttributeDefOptouts
sqlCacheableHistoryAttributeDefReaders
sqlCacheableHistoryAttributeDefUpdaters
sqlCacheableHistoryAttributeDefViewers

The following attributes can be assigned to a stem to enable history caching:

sqlCacheableHistoryStemAdmins
sqlCacheableHistoryStemAttrReaders
sqlCacheableHistoryStemAttrUpdaters
sqlCacheableHistoryStemCreators
sqlCacheableHistoryStemViewers

API changes (NOT IMPLEMENTED)

  1. In membership finder, if the query parameter does not specify NO_CACHE, and the group/field is cachable, use the cache tables instead of the normal Grouper tables
  2. Make sure WS uses the Grouper API that takes advantage of the SQL cache (e.g. get members, get groups, find memberships, privileges, etc)
  3. Make sure important operations in most circumstance like loader/provisioner use NO_CACHE when querying memberships
  • No labels