Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by eru on Tuesday October 21, 2025 @07:55PM
(#45663291)
You better not write your API in Python, or any language/library that uses amortised algorithms in the standard (like Rust and C++ do). And let's not mention garbage collection.
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by pdimitar on Wednesday October 22, 2025 @09:46AM
(#45669082)
Huh? Could you please clarify wrt to Rust and C++? Can't they use another allocator if needed? Or that's not the problem?
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by sethherr on Tuesday October 21, 2025 @07:55PM
(#45663295)
I’m asking because I genuinely don’t know - what are “pages” here?
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by adastra22 on Tuesday October 21, 2025 @08:00PM
(#45663328)
That’s a fair question. A page is the smallest allocatable unit of RAM, from the OS/kernel perspective. The size is set by the CPU, traditionally 4kB, but these days 8kB-4MB are also common.
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by gnosek on Wednesday October 22, 2025 @12:08AM
(#45664809)
Or you can set the vm.swappiness sysctl to 0.
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by baq on Wednesday October 22, 2025 @12:54AM
(#45665015)
If you’re writing services in anything higher level than C you’re leaking something somewhere that you probably have no idea exists and the runtime won’t ever touch again.
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by bayindirh on Wednesday October 22, 2025 @06:44AM
(#45667197)
> I DON’T WANT THE KERNEL PRIORITIZING CACHE OVER NRU PAGES.
Then tell the Kernel about it. Don't remove a feature which might benefit other things running on your system.
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by dwattttt on Wednesday October 22, 2025 @06:55AM
(#45667278)
If you're getting this far into the details of your memory usage, shouldn't you use mlock to actually lock in the parts of memory you need to stay there? Then you get to have three tiers of priority: pages you never want swapped, cache, then pages that haven't been used recently.
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by pdimitar on Wednesday October 22, 2025 @09:49AM
(#45669131)
Can mlock be instructed to f.ex. "never swap pages from this pid"?
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by bayindirh on Wednesday October 22, 2025 @09:51AM
(#45669173)
The application requests this itself from the Kernel. See https://man7.org/linux/man-pages/man2/mlock.2.html
Re:Replacing a $3000/mo Heroku bill with a $55/mo server
by dwattttt on Wednesday October 22, 2025 @04:47PM
(#45674932)
From the link, mlockall with MCL_CURRENT | MCL_FUTURE
> Lock all pages which are currently mapped into the address space of the process.
> Lock all pages which will become mapped into the address space of the process in the future.
I DON’T WANT THE KERNEL PRIORITIZING CACHE OVER NRU PAGES. The easiest way to do this is to disable swap.