Skip to main content
11 events
when toggle format what by license comment
Dec 28, 2025 at 23:47 comment added Steve @freakish, that's called an "unauthorised overdraft"! As you say, the concept exists because they cannot, in all possible circumstances, guarantee to prevent the account going overdrawn
Dec 28, 2025 at 23:43 comment added freakish @Basilevs many financial institutions would not agree that rejecting orders is better than overselling. That depends on the ratios. For example if you end up with 1 oversale per 10000 then it is better to oversale and have blazingly fast (and cheap) system. That's literally what all banks (try to) do. Under some rare circumstances you can have a negative bank balance (even when theoretically the account does not allow it). Noone cares.
Dec 28, 2025 at 21:05 comment added Steve Also, generally speaking you don't just want to avoid cancelling orders already placed, but you don't want to present an offer which will be withdrawn before the customer can possibly proceed with it in the following few minutes (unless it explicitly says "last 5 available" or something, where the customer is on good notice that it's about to expire imminently). (2/2)
Dec 28, 2025 at 21:05 comment added Steve @tusharRawat, whether you can eke out more performance in this context is a matter for an expert you would need to employ to look at all your setup directly. Quite often, what experts do is not solving problems exactly within terms dictated by non-experts, but explaining to non-experts which of their terms have to change for a solution. As I say, I don't see why you can't oversell (or undersell) a promotional offer, and I don't see why you can't just throttle down the rate of presentation until the contention on this particular field is reduced to the point that your database copes. (1/2)
Dec 28, 2025 at 18:59 comment added Basilevs @tusharRawat this is a fundamental problem. There is nothing you can do to solve it.
Dec 28, 2025 at 16:24 comment added tusharRawat @Basilevs, DBMS might have caching but on update it must acquire locks correct ? Having 300RPS to update the same counter without any race condition, will serialise all of our requests, and there we have a chance of increase tail latencies and request on DB will be queued for update, and this is the problem here.
Dec 28, 2025 at 16:06 comment added Basilevs @tusharRawat whatever caching your are trying to do DBMS already has one better. With and without replication. Do not attempt.
Dec 28, 2025 at 16:00 comment added tusharRawat @Steve the idea here is if SSI or any other advanced technique can really help with contention here. Or we have to update the counters in the background only in batching by using some sort of workers, etc
Dec 28, 2025 at 15:59 comment added tusharRawat That correct @Basilevs, we plan to reject the order, we will handle it gracefully only on UI part (something like offer is not available anymore please retry, etc), but that's better than later cancel it or overselling it. We were thinking if inc operations on cache would be faster, which can act as a gatekeeper here, and in background we can have a worker scanning logs and updating counters something like that, would that sound feasible approach ?
Dec 28, 2025 at 10:49 comment added Basilevs Rejecting a few orders would be a better user experience than overselling or retracting a discount. Users cannot find out if order was rejected legitimately, so they can not complain.
Dec 28, 2025 at 10:38 history answered Steve CC BY-SA 4.0