jPOS-EE icon indicating copy to clipboard operation
jPOS-EE copied to clipboard

Possible performance issue in minigl module getBalance()

Open plarsson opened this issue 7 years ago • 8 comments

For example the balance cache is never used by FinalBalance min/max rules as it sends in a max id of 0 I think the balance cache should be allowed to use when maxId is sent in as 0?

See this line: https://github.com/jpos/jPOS-EE/blob/master/modules/minigl/src/main/java/org/jpos/gl/GLSession.java#L1072

plarsson avatar May 25 '18 16:05 plarsson

If I understand correctly, you're reporting that we are not using a balance cache that we could have used, but balance is still accurate, right?

ar avatar May 25 '18 16:05 ar

Yes thats correct. It's just a performance issue

plarsson avatar May 25 '18 16:05 plarsson

Perfect - will take a deep look and comment.

ar avatar May 25 '18 16:05 ar

FYI, I'm testing the following change, trying to verify side-effects.

                if (bcache != null && (maxId == 0 || bcache.getRef() <= maxId)) {
                    balance[0] = bcache.getBalance();
                    entryCrit.add (Restrictions.gt("id", bcache.getRef()));
                }

ar avatar May 26 '18 19:05 ar

Hi, did you find any issues with this fix?

plarsson avatar Jun 28 '18 08:06 plarsson

Unfortunately we had a situation where balance_cache was not right. We are investigating if this was a DB procedure issue or something else. We are investigating. For the time being, I've temporarily reverted the change.

ar avatar Jun 28 '18 19:06 ar

@ar How did they proceed with this case? We occasionally used to encounter similar situations. In balance-cache, there was a record pointing to an unconfirmed transaction at the SQL level, and when calculating the balance afterwards, it returned an incorrect value.

cdanielpy avatar Jan 17 '24 19:01 cdanielpy

@cdanielpy what you report might be related to an issue with your transaction isolation configuration at the JDBC level. Could that be the case?

ar avatar Jan 22 '24 22:01 ar