honestly just /dev/shm is pretty underrated
Posted by anish2good@reddit | linux | View on Reddit | 15 comments
Bidding needed a live blacklist. 50k req/s. Using Redis Worked fine but it was another service to maintain/monitor and another potential failure point. Tried an in-memory map. Faster, but died on every deploy. Cache gone.
Then we tried `/dev/shm`. Just wrote temp files there. RAM speed. Survives restarts because the OS holds it since it's temp it won't survive os restart but in our use case it's doesn't; matter
os.CreateTemp("/dev/shm", "blacklist-*")
Novero95@reddit
Dude learn to fucking write
jlrueda@reddit
Maybe you are in the wrong subreddit?
https://www.reddit.com/r/Anger/comments/1sy6dzd/my_girl_just_left_me_because_of_my_anger_issues/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
Novero95@reddit
What? I don't think I have anger issues if that's what you're saying, it's just that people create garbage posts, written like their KPIs depend on their writing and giving terrible advice and then refuse to elaborate and leave.
Put all that together and the reddit experience is horrible, boring and uninteresting. If people just did a little more thinking (or less AI slopping) before posting their garbage...
To put it in perspective, English is not my main language yet you can understand all of my comments, unlike OOP's post, because of things like punctuation marks and correct grammar.
Ezmiller_2@reddit
That's not AI writing. I have complete articulate conversations with Claude. I think OP posted while smoking weed.
Novero95@reddit
I know but It wouldn't surprise me the least if AI has been involved in the process that resulted in this post.
The weed thing, who knows?
AutoModerator@reddit
This submission has been removed due to receiving too many reports from users. The mods have been notified and will re-approve if this removal was inappropriate, or leave it removed.
This is most likely because:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
natermer@reddit
yeah tmpfs is nice.
michaelpaoli@reddit
tmpfs isn't exactly something new. These days many distros do tmpfs for /tmp - at least default. Most have had it on /dev/shm for quite a long time.
Oh, and you can grow and shrink tmpfs dynamically while it's mounted.
tmpfs will use swap if it runs short of physical RAM, but that'll still be faster overall than direct on drive. And yes, one can also add/remove swap dynamically too.
anish2good@reddit (OP)
we initially thought of doing /tmp RAM mount but different problem arises all the deployment stuff writing to /tmp eating memory and then other problem machines are in spot instances are different families some going on disk some on ram on the on contray the /dev/shm is guaranteed to be RAM a cleaner solution
dkopgerpgdolfg@reddit
No.
dkopgerpgdolfg@reddit
... not sure what the value or reason of this post is.
You replaced Redis with pure text files or something, because Redis is a possible point of failure, while ignoring that shm is too (size limit etc., permission topics, ...)
At least make your own tmpfs somewhere else (but yes, this too is a point of failure)
anish2good@reddit (OP)
All fair point but we are bidding platform where latency is the key if we can't bid under 15ms means we are not bidding at all the /dev/shm on N servers eliminates the redis and provide a few ms save calling redis N/w call
dkopgerpgdolfg@reddit
If you haven't already, look into things like uring, various network stack features (man socket, man ip, man tcp) and nic cpu core binding, a thraed-per-core architecture, shared memory channels and caches, ...
aloobhujiyaay@reddit
People forget Linux already gives you a lot before you add another dependency
ThomasterXXL@reddit
Yeah, but I prefer having a desktop environment.