3 ms·
With a million requests per month (~1k a minute average, non uniform distribution ofc), why not just use something like sqlite? I wouldn't want to work with csv
by OrderlyTiamat 2y ago
With a million requests per month (~1k a minute average, non uniform distribution ofc), why not just use something like sqlite? I wouldn't want to work with csv files, and development time is the same.
It's a more standard setup, and enables better logging and later changes.
- kazinator 2y agoIf they expire in 5 days, that's 1/6 of a million.
- pcthrowaway 2y agoYou don't really need anything relational, so I think sqlite is overkill, and since multiple locations presumably need to write to it, you'd either have to use something like Litestream or write a coordination server to manage the updates from the mail intake locations I think a Redis instance would be better. Assuming each mail intake device has a unique ID, and ID 0 is intended for un-redeemed postzegelcodes, you could have newly created postzegelcodes SETNX a key with value 0 and a TTL of 5 days, then when mail is being scanned, WATCH the key in a multi transaction, and if the value is 0, SET it to the ID of the intake device, while removing the TTL. The mail can then be rejected at intake if the transaction failed. Upon mail delivery then, you clear the key, which frees it for later re-use.