Using ZonedDateTimeAttributeConverter may cause performance issue for transactions

30 views
Skip to first unread message

pf...@thoughtworks.com

unread,
Mar 20, 2017, 6:16:06 AM3/20/17
to OpenLMIS Dev
ZonedDateTimeAttributeConverter makes hibernate generate update statements on whole table during a transaction.



While working on physical inventory feature of stock management, we found a problem.

A physical inventory is a batch operation, there will be lots of inserts in a transaction.

We found that if the insert statement involves a zoned date time being converted to a time stamp, then hibernate will generate update statements for the whole table.
And that'll make the whole transaction very very slow.

We found a work around for this, which is to use the hibernate-java8 lib instead of using a custom made converter. That solves the problem.
But I have not found out why ZonedDateTimeAttributeConverter makes hibernate generate update statements on whole table yet.

If you are still using ZonedDateTimeAttributeConverter, and if you have potentially large transactions, you may have the same problem.

pf...@thoughtworks.com

unread,
Mar 20, 2017, 6:32:19 AM3/20/17
to OpenLMIS Dev
I just looked through the code, looks like the converter is still used from openlmis-service-util.
You may want to test your large transactions and see if you have the same problem.

Paweł Gesek

unread,
Mar 20, 2017, 8:12:10 AM3/20/17
to openlm...@googlegroups.com

I've created a ticket to track this:

https://openlmis.atlassian.net/browse/OLMIS-2155

I would vote for just switching to the one from Hibernate - don't think we need a custom one.

Regards,
Paweł
--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openlmis-dev/cd489614-07b5-4dd5-9407-8efcd588fded%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

Paweł Gesek
Technical Project Manager
pge...@soldevelo.com / +48 690 020 875

SolDevelo Sp. z o. o. [LLC]
Office: +48 58 782 45 40 / Fax: +48 58 782 45 41 Al. Zwycięstwa 96/98 81-451, Gdynia
http://www.soldevelo.com

Place of registration: Regional Court for the City of Gdansk KRS: 0000332728, TAX ID: PL5862240331, REGON: 220828585, Share capital: 60,000.00 PLN

Jake Watson

unread,
Mar 21, 2017, 2:55:37 AM3/21/17
to Paweł Gesek, openlm...@googlegroups.com
I agree, Pawel.
And as a rule of thumb, we should always prefer standard libraries vs custom unless there is a super-compelling case for custom …

Office: +48 58 782 45 40/ Fax: +48 58 782 45 41Al. Zwycięstwa 96/9881-451, Gdynia
http://www.soldevelo.com

Place of registration: Regional Court for the City of GdanskKRS: 0000332728, TAX ID: PL5862240331, REGON: 220828585,Share capital: 60,000.00 PLN

--
You received this message because you are subscribed to the Google Groups "OpenLMIS Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openlmis-dev...@googlegroups.com.
To post to this group, send email to openlm...@googlegroups.com.
Soldevelo_logo_EPS_CMYK.png
Reply all
Reply to author
Forward
0 new messages