Hi Dimuthu, Thanks for investigating this. I have a few questions/observations: - when you fetch an experiment output, it would be understandable if the experiment was then fetched if experimentOutput.getExperiment() was accessed. This would in turn lead to the experiment's experiment outputs being fetch since we have the fetch type set to EAGER [4]. So the sequence you describe doesn't necessarily sound like unexpected behavior. - how many times does the recursive fetching go through fetching the same objects? I'm assuming at some point it stops otherwise we'd see timeouts or stack overflow. Any idea what causes it to eventually stop? - do you have a test case that reproduces this behavior? - seems that this performance drop is new. The registry code itself hasn't changed recently on master, but we did recently merge in the upgrade of OpenJPA from 2.4.3 to 3.1.0. Could this be related to the newer version? - in general this sort of behavior makes me think that equals/hashCode isn't implemented properly somewhere, since that would make it hard for OpenJPA to figure out if it has already loaded an entity into the session. Looking at ExperimentEntity and ExperimentOutputEntity, I don't see any issues there.
Thanks, Marcus [4] https://github.com/apache/airavata/blob/master/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentEntity.java#L89 > On Sep 22, 2020, at 11:01 AM, DImuthu Upeksha <[email protected]> > wrote: > > Hi Folks, > > I just noticed that the entity relations that have bidirectional definitions > (OneToMany and ManyToOne) between 2 tables cause recursive object fetching > and it is causing a significant performance drop in database querying. For > example [1] and [2]. When we fetch an experiment output, I can see a stack of > experiment -> experiment outputs -> experiment .... > > Same issue was mentioned in [3] but the solution is for spring boot json > parsing. As we don't use spring boot, we might have to figure out some other > way to stop this recursive stack creation. > > [1] > https://github.com/apache/airavata/blob/master/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentEntity.java#L88 > > <https://github.com/apache/airavata/blob/master/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentEntity.java#L88> > [2] > https://github.com/apache/airavata/blob/master/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentOutputEntity.java#L80 > > <https://github.com/apache/airavata/blob/master/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentOutputEntity.java#L80> > [3] > https://medium.com/@udith.indrakantha/issue-related-with-infinite-recursive-fetching-of-data-from-relationships-between-entity-classes-ffc5fac6c816 > > <https://medium.com/@udith.indrakantha/issue-related-with-infinite-recursive-fetching-of-data-from-relationships-between-entity-classes-ffc5fac6c816> > > Thanks > Dimuthu
smime.p7s
Description: S/MIME cryptographic signature
