Has anyone had success running a Node server on Railway.app for cheap?

First, I'd love if anyone could share a code example of a cheap to run http server they've run on railway. I attached a screenshot of my simple Elysia (library for bun) server and the pricing associated with running this for a few days. I was averaging around $1.50 per day. The memory and CPU usage were far greater than what I'd expect. FWIW I was seeing similar high usage with express before switching over. The high usage persists when I comment out the connections to redis and postgres (the postgres memory usage also seemed high for what I was doing - not making requests). The experience with Railway was fantastic, except that, in this case, it was using up the resources constantly. The server was receiving 0 requests. If anyone is interested in seeing the code: https://github.com/tylerlaws0n/sprt.dev I was happy enough with the UX of railway that I'd consider paying if there is hope that I can resolve whatever is going on currently. Any help debugging why a server receiving 0 requests would require so much usage would be greatly appreciated.
GitHub
GitHub - tylerlaws0n/sprt.dev: Terminal friendly sport schedule
Terminal friendly sport schedule. Contribute to tylerlaws0n/sprt.dev development by creating an account on GitHub.
No description
No description
10 Replies
Juraj98
Juraj986mo ago
Not the same use case, but I'm running two small servers through railway using bun - One is websockets, and another is HocusPocus (realtime text editing collaboration). My memory usage is 85MB on Websockets, and 202MB on HocusPocus. My estimated cost is $2.09 for HocusPocus and $0.88 for Websockets. Looking at your billing, it seems that most cost comes from CPU usage. You're also using --smol inside your start script. This argument decreases your memory usage, but increases your CPU usage. Maybe this could be a source of your high costs?
Juraj98
Juraj986mo ago
Full breakdown:
No description
No description
tylersayshi
tylersayshiOP6mo ago
That probably was a bit of it. I had high cpu usage without the flag as well though. Are your projects open source? I’d like to poke through the code to see if I can narrow anything else down if you’re ok with it.
Juraj98
Juraj986mo ago
No they are not. But I added you to collaborators, so you can take a look. Please don't do anything bad 😄 Also, these servers are a lot more simpler than what you're doing.
tylersayshi
tylersayshiOP6mo ago
Thanks! I'm just gonna read through 🙂 appreciate you sharing. The logic of what I need is very very simple and my goal is to cut the cost of my service, so this is really helpful to see as an example for running things cheaply. Do you use the railway setting to sleep when inactive?
Juraj98
Juraj986mo ago
No settings for sleep. My railway configuration is all default
tylersayshi
tylersayshiOP6mo ago
I think it might sleep on inactivity by default. It results in some slow cold starts, but presumably saves a lot in usage costs
No description
tylersayshi
tylersayshiOP6mo ago
I think I might just turn this project into a CLI tool though for now and not host it 😅 It was a helpful exercise to set it up as a robust project to try out the tooling, but the cost to run it is massive overkill for what the tool does.
Juraj98
Juraj986mo ago
I double checked the sleep setting. Both projects have it off
tylersayshi
tylersayshiOP6mo ago
Dang. Nice then. That’s cheap considering it’s always on.
Want results from more Discord servers?
Add your server