registry-persistence-service: Agent.toAgentRelations slows down registry response time
Summary: registry-persistence-service: Agent.toAgentRelations slows down registry response time
Created: 2012-02-14 15:28:15.883
Updated: 2013-12-16 17:50:54.698
Resolved: 2012-05-18 12:11:04.132
Description: Agent.toAgentRelations is a list of agent relations, and each agent relation has a toAgent and fromAgent which have their toAgentRelations populated, and so on. This recursive call can be quite expensive and I anticipate it is causing a serious slow down.
To explain how the toAgentRelations list is used, for example when we want to find out the owning organization of an Agent(Dataset), we iterate through its toAgentRelations, look for the HAS_RESOURCE relation type, and grab the toAgentRelation.fromAgent
Alternatively, we could:
1. Just use a separate request each time to get for example the owning organization: listRelatedAgents(Agent agent, RelationType relationType, boolean reverse, @Nullable Pageable page);
2. Improve the AgentMapper.xml so that when it populates the toAgentRelations, it only populates the relations we would ever actually be interested in:
-Agent(Organization) HAS_RESOURCE toAgentRelation for Agents of type Dataset
-Agent(IPT) PUBLISHES toAgentRelation for Agents of type Organization
Created: 2012-05-18 12:11:04.157
Updated: 2012-05-18 12:11:04.157
The now so-called incomingAgentRelations are never that numerous for any given Agent. They are populated recursively, but this really isn't that expensive.
The now so-called outgoingAgentRelations could be numerous (for example for an organization like Pangea with thousands of OWNS relations), but these are not automatically populated for an Agent like the incomingAgentRelations.
Therefore, I will close this issue since I no longer believe it to be a major contributor to the response slow-down.