Replies: 3 comments 13 replies
-
It overrides because you are modifying the same instance. Infinispan does not do any cloning when storing or loading the instance. My advice is to make your To be on the safer side, both keys and values should be immutable. |
Beta Was this translation helpful? Give feedback.
-
Here's a brief demonstration of the issue: And here's the code: Thanks! |
Beta Was this translation helpful? Give feedback.
-
Here's how to run the project, how I expected transactions to work and how it's failing. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm trying to build a simple transaction processing demo (credit / debit / balance) using infinispan (embedded) in two API nodes.
I've setup pessimistic locking and timeout, like this:
https://github.com/CaravanaCloud/rinha-de-backend-2024-q1-impl/blob/main/rinhadebackend/src/main/archived/ispn/CacheProducer.java
And trying to process transactions like this...
write transaction (credit/debit):
https://github.com/CaravanaCloud/rinha-de-backend-2024-q1-impl/blob/69753ac034402d7463b55aa5e18c77af7ca65c76/rinhadebackend/src/main/archived/ispn/CachedServlet.java#L115
read transaction (balance, 10 latest)
https://github.com/CaravanaCloud/rinha-de-backend-2024-q1-impl/blob/69753ac034402d7463b55aa5e18c77af7ca65c76/rinhadebackend/src/main/archived/ispn/CachedServlet.java#L227
However, the application fails to properly synchronize access to the data, resulting in overrides and failures to keep balance consistent.
There are no errors or exceptions on the consoles, all seems to be working as expected.
I'm quite new to infinispan and not sure how to proceed, any clues would be greatly appreciated, because i have none :)
Thanks in advance,
Julio
Beta Was this translation helpful? Give feedback.
All reactions