Hi,
When I iterate over my join table I get decreasing performance till the whole thing just stopps
I have 1 main table with 4.5 million records
2nd join table with 30 Million records
3rd 'category' table with 12 thousand records
So the mapping table joins the main table with the 'category' table
With 5 threads the whol thing starts at about 30M/b sec than lineray decreases till at about 60% it grinds to a halt
Code:
public class Company {
..
@OneToMany(fetch = FetchType.EAGER, mappedBy = "company", cascade = CascadeType.ALL, orphanRemoval = true)
@OrderBy
private Collection<CompanyCategoryMapping> compCat;
..
}
public class CompanyCategoryMapping {
..
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "category_id", nullable = false)
private Category category;
..
}
So when I do full iterate over company and try to map categories to it I get this problem
Code:
Criteria criteria = session.createCriteria(Company.class);
criteria.setFetchMode("compCat", FetchMode.SELECT);
criteria.add(Restrictions.in("id", ids));
criteria.setReadOnly(true);
criteria.setLockMode(LockMode.OPTIMISTIC);
criteria.setFlushMode(FlushMode.AUTO);
CategoryContainer container = null;
ScrollableResults rs = criteria.scroll(ScrollMode.FORWARD_ONLY);
I tried tinkering with all settings and nothing helps or makes a difference, the problem is only the performance degradation and than the total shutdown at about 60%
I dont get any memory problems etc. I run this on a developer machine with 8 cores and 32Gb ram so it's not the hardware for sure
What can be the cause and solution to this ? I can immagine that this sort of operation is very standard