R
Railway•13mo ago
Mrxbox98

Service using much more RAM on Railway than Local

Hi, my discord bot is using a lot more ram on Railway than on my local machine. Railway: https://i.mrxbox98.me/file/2023/10/firefox_7CMFWfJz4N.png Local: https://i.mrxbox98.me/file/2023/10/WindowsTerminal_bEvWZJ2DHO.png This is my first time using btop to check RAM usage so lmk if I'm measuring wrong locally.
18 Replies
Percy
Percy•13mo ago
Project ID: b820c80e-50e9-475a-85c6-89832fccdd8c
Mrxbox98
Mrxbox98OP•13mo ago
b820c80e-50e9-475a-85c6-89832fccdd8c
Brody
Brody•13mo ago
what kind of app is it, besides bun
Mrxbox98
Mrxbox98OP•13mo ago
Its a discord bot, here is the package.json
{
"name": "discord-bot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node --experimental-specifier-resolution=node --loader ts-node/esm src/index.ts",
"dev": "concurrently \"nodemon --exec node --experimental-specifier-resolution=node --loader ts-node/esm src/index.ts\"",
"build": "tsc",
"bun-run": "bun --bun run src/index.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@prisma/client": "^5.4.2",
"bun": "^1.0.7",
"colors": "^1.4.0",
"discord.js": "^14.12.1",
"express": "^4.18.2",
"jimp": "^0.22.10",
"paypal-invoices": "^1.5.0",
"qrcode-reader": "^1.0.4",
"stripe": "^13.10.0",
"ts-node": "^10.9.1"
},
"devDependencies": {
"@types/node": "^20.8.3",
"concurrently": "^7.3.0",
"nodemon": "^3.0.1",
"prisma": "^5.4.2",
"typescript": "^5.2.2"
}
}
{
"name": "discord-bot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node --experimental-specifier-resolution=node --loader ts-node/esm src/index.ts",
"dev": "concurrently \"nodemon --exec node --experimental-specifier-resolution=node --loader ts-node/esm src/index.ts\"",
"build": "tsc",
"bun-run": "bun --bun run src/index.ts"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@prisma/client": "^5.4.2",
"bun": "^1.0.7",
"colors": "^1.4.0",
"discord.js": "^14.12.1",
"express": "^4.18.2",
"jimp": "^0.22.10",
"paypal-invoices": "^1.5.0",
"qrcode-reader": "^1.0.4",
"stripe": "^13.10.0",
"ts-node": "^10.9.1"
},
"devDependencies": {
"@types/node": "^20.8.3",
"concurrently": "^7.3.0",
"nodemon": "^3.0.1",
"prisma": "^5.4.2",
"typescript": "^5.2.2"
}
}
Brody
Brody•13mo ago
railway uses the start script by default, but you aren't using the start script when testing locally
Mrxbox98
Mrxbox98OP•13mo ago
I changed the railway default so it is npm run bun-run
Brody
Brody•13mo ago
have you tested your app locally in a docker container too?
Mrxbox98
Mrxbox98OP•13mo ago
Ill try that and get back to you
Brody
Brody•13mo ago
@luna - the something to do with bun
luna
luna•13mo ago
Ah yep let me look at this on my laptop can you please change your start script to this and let me know what version it prints out? please do this locally and for railway. if there's a version mismatch that may be the issue here as they've been fixing a fair few memory issues recently. bun --revision && bun run src/index.ts
Brody
Brody•13mo ago
@Mrxbox98
Mrxbox98
Mrxbox98OP•13mo ago
My local is 1.0.7+b0393fba6200d8573f3433fb0af258a0e33ac157, for some reason the command on railway didnt print anything. Another strange thing I noticed was when I switched to node the memory on railway went down from 1.4gb to around 800mb while on my local node uses more memory than bun.
Brody
Brody•13mo ago
the increased memory usage is likely due to the difference in bun versions and environments
luna
luna•13mo ago
How did you setup the one for railway? 🤔
Mrxbox98
Mrxbox98OP•13mo ago
Nvm I was able to find it, I think I was looking at an old version. Turns out the install was for some reason installing bun verison 1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49
luna
luna•13mo ago
yep that's probably part of the issue then. i personally run a Dockerfile to make sure im on the latest version of bun because of this.
Mrxbox98
Mrxbox98OP•13mo ago
Yeah not sure why the latest bun npm release tagged 1.0.7 is actually 1.0.2
Brody
Brody•13mo ago
1.0.2 is the version railway is currently using for bun builds, nothing to do with npm
Want results from more Discord servers?
Add your server