Hi again,
Thanks for your patience and I am sorry for the late reply, but we are only
stationed at the offices three days a week.
I must admit i don't understand what you mean by test harness. If you could
explain i will gladly post it.
In the meantime I have created a new project and added OpenJPA capabilities
to this one in hopes of discovering what the problem is, but alas I did not.
My new project is of a much simpler setup, it consists of the following
files.
Main class for running simple test:
public static void main(String[] args) throws Exception {
EntityManagerFactory factory =
Persistence.createEntityManagerFactory("OpenJPAPU", System.getProperties());
EntityManager em = factory.createEntityManager();
OpenJPAEntityManager o = OpenJPAPersistence.cast(em);
WearhouseDAO wd = new WearhouseDAO();
long starttid = System.currentTimeMillis();
for(int i = 1; i <= 500; i++){
Wearhouse w = wd.findById(o, i);
// System.out.println(w.getWearhouseName());
}
System.out.println(System.currentTimeMillis() - starttid);
}
Wearhouse Entity class (same as before)
WearhouseDAO class using the following method:
public Wearhouse findById(OpenJPAEntityManager o, Integer id) {
try {
Wearhouse instance = o.find(Wearhouse.class, id);
return instance;
} catch (RuntimeException re) {
throw re;
}
}
Storagecategory Entity class (same as before)
StoragecategoryDAO class using the following method:
public Storagecategory findById(OpenJPAEntityManager o, Integer id) {
try {
Storagecategory instance =
o.find(Storagecategory.class, id);
return instance;
} catch (RuntimeException re) {
throw re;
}
}
The database is still MySQL and this time I've let OpenJPA build the schema.
No difference in the resulting time..
Thanks for reading,
Shub
Pinaki Poddar wrote:
>
> Hi,
> I ran the Wearhouse-StorageCategory model you have posted (thank you for
> a clean test). Against 500 categories and 200 wearhouses and a cardinality
> of 10 categories per wearhouse. The domain classes were enhanced at
> build-time. The database is MySQL and the tests ran in my pedestrian
> laptop. Here are the results for finding Wearhouses 500 times in a loop.
>
> Without connection pool : 2360 ms.
> With connection pool : 734ms
>
> Given these numbers are quite in contrast with your observations, I will
> request you to post the test harness you used to measure the number, so
> that we can investigate further.
>
> Few comments:
> 1. If performance is higher priority than ordering, consider using Set<>
> instead of List<>
> 2. Consider using a connection pool, if possible [1]
>
> [1]
> http://openjpa.apache.org/faq.html#FAQ-HowdoIenableconnectionpoolinginOpenJPA%253F
>
> Regards --
>
>
> PS: "Aristotle maintained that women have fewer teeth than men; although
> he was twice married, it never occurred to him to verify this statement by
> examining his wives' mouths." --
> The Impact of Science on Society, 1952 - Bertrand Russell
>
>
--
View this message in context:
http://n2.nabble.com/Slow-performance-with-OpenJPA-when-selecting-from-a-ManyToMany-relation.-tp2466994p2490419.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.