Hi: It would be fine to test also concurrent clients reading from the database and see the results for both.
Best Regards, Antonio Gallardo Florin Pop dijo: > Hi Thomas, > > indeed if I repetead the lookup(using different ids) 100 times or even > 1000 times the difference is decreasing, proportionally speaking. > > iterations Hibernate OJB > 1 .122s .867s > 100 1.50s 3.09s > 1000 12.90s 25.54s > > > I agree with you this is a basic performance test, but I was surprised > seeing that for a simple load the difference is that big. > > > Regards, > > florin > > -----Original Message----- > From: Mahler Thomas [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2003 4:21 PM > To: 'OJB Users List' > Subject: RE: Loading an object > > > Hi Florin, > > IMO it makes not much sense to compare the performance of two > persistence engines based on such a simplified test. > You must test things like working with real world object models, > with high loads over a longer period of time, > multi user access scenarios, etc. > > I don't know about Hibernate, but OJB at least has a "warming up" phase. > So for this simple test hings will look differenet if you perform it in > a loop with say 10 000 iterations! > > cu, > Thomas > >> -----Original Message----- >> From: Florin Pop [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, November 04, 2003 3:09 PM >> To: '[EMAIL PROTECTED]' >> Subject: RE: Loading an object >> >> >> Hi bellow are the 2 methods >> >> public void testLoadPersonUsingOJB() throws Exception { >> long time = System.currentTimeMillis(); >> final long PERSON_ID = 112327; >> Person person = new Person(); >> Identity id = new Identity(Person.class, >> Person.class, new Long[] >> {new Long(PERSON_ID)}); >> person = (Person) broker.getObjectByIdentity(id); >> assertTrue(person != null); >> assertTrue(null != person.getBirthday()); >> assertTrue(null != person.getCitizenship()); >> assertTrue(null != person.getCity()); >> assertTrue(null != person.getFirstName()); >> assertTrue(null != person.getName()); >> assertTrue(null != person.getStreet()); >> time = System.currentTimeMillis() - time; >> System.out.println(time); >> } >> >> public void testLoadPersonUsingHibernate() throws Exception { >> long time = System.currentTimeMillis(); >> final long PERSON_ID = 112327; >> Person person = (Person) session.load(Person.class, new >> Long(PERSON_ID)); >> assertTrue(person != null); >> assertTrue(null != person.getBirthday()); >> assertTrue(null != person.getCitizenship()); >> assertTrue(null != person.getCity()); >> assertTrue(null != person.getFirstName()); >> assertTrue(null != person.getName()); >> assertTrue(null != person.getStreet()); >> assertTrue(null != person.getFullName()); >> time = System.currentTimeMillis() - time; >> System.out.println(time); >> } >> >> the session(4 hibernate) and the broker (4 OJB) are initialized in the >> constructors. >> >> >> Regards, >> >> florin >> >> -----Original Message----- >> From: Armin Waibel [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, November 04, 2003 3:40 PM >> To: OJB Users List >> Subject: Re: Loading an object >> >> >> Hi, >> >> Florin Pop wrote: >> >> > Hi again, >> > >> > I have tried your suggested approach but curiously the same result. >> > >> > The tests that I run consist just in loading an Person >> object from the >> data >> > source. Both with Hibernate and with OJB I use no cache and >> this load >> > operation is the first and only one opperation that I execute in one >> session. So there is no object cached anywhere. >> > >> > For me is also very surprizing the result. >> > >> For me too! >> >> How does your test looks like? >> >> long time = System.currentTimeMillis(); >> Person person = (Person) broker.getObjectByQuery(query); >> time = System.currentTimeMillis() - time; >> >> Can you post source of both test? >> >> regards, >> Armin >> >> >> > Regards, >> > Florin >> > >> > PS: I have another question: is it possible in OJB to map >> an object field >> to >> > a calculated value. For example I have a birthday column in >> PERSON table >> and >> > I want to have in the Person class a field age containing >> the age of the >> > person( >> > age = currentDate - birthday, or something like this) >> > >> > >> > -----Original Message----- >> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> > Sent: Tuesday, November 04, 2003 2:22 PM >> > To: [EMAIL PROTECTED] >> > Subject: RE: Loading an object >> > >> > >> > Hello, >> > >> > >> >>-----Original Message----- >> >>From: Florin Pop [mailto:[EMAIL PROTECTED] >> > >> > >> >> I tried: >> >> >> >> Criteria crit = new Criteria(); >> >> crit.addEqualTo("id", new Long(PERSON_ID)); >> >> Query query = new QueryByCriteria(Person.class, crit); >> Person person = (Person) broker.getObjectByQuery(query); >> >> >> >>but it works very slow, 6-8 times slower than in Hibernate: >> > >> > >> > I do not believe that. >> > >> > [..] >> > >> > >> >>Is there another way for doing this in OJB? >> > >> > >> > try: >> > >> > Identity id = new Identity(Person.class, Person.class, >> > new Long[] {new Long(PERSON_ID)}); >> > PersistenceBroker.getObjectByIdentity(id); >> > >> > >> > Olli >> > >> > >> --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> --------------------------------------------------------------------- >> > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > For additional commands, e-mail: [EMAIL PROTECTED] >> > >> > >> > >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > > --------------------------------------------------------------------- To > unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To > unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
