Extraordinary Costs for Discord Bot
shreyasayyengar
HOBBYOP

10 months ago

I realise that most posts regarding this topic usually ends up with a response like:

  • Pricing depends entirely on the resource usage of your service (since that's what railway charges you)

  • Railway charges based on the resources you use,

  • Railway charges you for the resources your applications consume

  • OWTTE

however last month's bill is genuinely concerning as the only thing I am running is a Discord bot. For context, since 2022 I have hosted a java discord bot on railway that typically uses about $6-8 USD per month (making my bill roughly $1-3). At the end of march, I re-wrote this Discord bot to Kotlin to be more performant (amongst other things), and put that up on Railway with a MongoDB instance as well.

very quickly after doing so (and with a bunch of searching on the discord), it was clear that MongoDB takes up a huge amount of overheard, even if DB operations are at idle. with that, i removed the MongoDB instance and replaced the connection string in my application to a DB in atlas.

to be honest, i thought it was just the MongoDB that was estimating my monthly cost (on the pricing dashboard) to be $32. But after a few days, and even a week of just leaving the Bot up, the bill was still estimated at $21, meaning it was using $26 of resources. now that the month has reset, it shows the same $21 estimate, so i've temporarily shutdown the service until i can figure out what's going on.

now, with many thanks to railway's receipts, i can see exactly what i have been charged for in the past and what the difference is this time.

2025
Dec-Jan:

  • Disk: 15,411 ($0.09)

  • Network: 590 ($0.06)

  • vCPU: 34,350 ($0.16)

  • Memory: 36,794,986 ($8.52)

Jan-Feb:

  • Disk: 16,329 ($0.09)

  • Network: 424 ($0.04)

  • vCPU: 25,030 ($0.12)

  • Memory: 34,565,581 ($8.00)

Feb-March:

  • Disk: 12,841 ($0.07)

  • Network: 342 ($0.03)

  • vCPU: 52,070 ($0.24)

  • Memory: 27,185,484 ($6.29)

Migrated to different codebase
March-April:

  • Disk: 12,705 ($0.07)

  • Network: 200 ($0.02)

  • vCPU: 4,813,726 ($22.29) <- ⁉️

  • Memory: 16,986,655 ($3.93)

as expected from the recode, the memory footprint has come down a decent amount, but the vCPU costs seem extraordinarily high, even after deleting the MongoDB within (i think) the first week of april. could anyone shed some light into why this could be? i've run a profiler in my local environment and can't get anywhere near these numbers.

2 Replies

shreyasayyengar
HOBBYOP

10 months ago

Project ID: d8c2d7d4-9cc2-4de3-a784-cb082a468bda


You mentioned that you: Migrated to different codebase

This likely would mean that this is something with your code, not so with Railway.


Loading...