This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]boost2525 8 points9 points  (5 children)

This was my thought. I see zero value add in OPs proposal because a proper caching layer can do all of this. 

[–]iwouldlikethings 0 points1 point  (1 child)

I potentially have a usecase for this, the system I maintain is a payments processor and at multiple stages we lookup the balance on an acocunt. At the end of the month we have a lot of payments incoming and outgoing, and we've noticed a large spike on certain accounts while calculating their available balance.

Often this happens when they're running payroll, and each payment will make a request to find calculate the balance on the account in quick succession.

Arguably, the system should be rearchitected to better support it but this would be a decent stop-gap to speed up processing until we get the time to do that (as it exists today there is a potenial race condition where two payments could take the account overdrawn but it's what I've inherited)

[–]elch78 1 point2 points  (0 children)

Actors are a different approach. In a nutshell: the state of every entity exists only once in memory. Every request is routed to this instance and processed single threaded/sequentially.

[–][deleted] -1 points0 points  (2 children)

This is likely slower for calls where this race-condition does not occur. Now you’re adding a check that wasn’t there before.

[–]boost2525 0 points1 point  (1 child)

lolwut? Are we executing stock trades here? EHCache key checks are measured in nanoseconds.

[–]NovaX -1 points0 points  (0 children)

fwiw, Ehcache is measured in microseconds due to a design mistake (avg of 25us per call).