2 years ago
hi, im developing a Discord bot and wanted to host it, so I decided on Railway. running it on local works great (at most a second delay) from receiving commands to execution. the bot requires some memory-intensive processing so I upgraded to hobby plan to get 8GB, but currently im experiencing serious delay when it runs on Railway — up to 10 seconds on maxed out specs, though i think its bandwidth related. its an important feature for the bot to respond relatively quickly. is there anything that can be done to reduce latency from user commands?
eb591fbe-8984-470f-9f2c-c9fca1d535b5
51 Replies
2 years ago
I've been running bots on Railway for 2 years and I've never had any issues with latency
2 years ago
Do you have a database on Railway that your bot is using?
2 years ago
Can you make sure they're on the same region and that you're connecting to postgres through the private network?
2 years ago
exactly, to be sure you can check if it uses a railway.internal domain
2 years ago
awesome, and the region?
2 years ago
on the exact same area in US-west?
2 years ago
they're both US West Oregon ?
2 years ago
<:sus_apple:1032821016319234068>
2 years ago
Alright, then your service's connection to the database is as fast as can be (low single digit ms range)
beyond optimizing that connection, there isn't anything else you can do to speed up things on Railway's side, the rest is your app
My suggestion would be to place more metrics in-app so you can figure out what exactly is slowing your app down, and you can work from there
2 years ago
this is one of my bot's running on Railway

i had to migrate from SQLite to Postgres, besides that and the hardware I would expect them to behave the exact same
2 years ago
im kinda confused from reading, are you running part of the bot on your pc, or you are saying there is a 10 second delay from discord command to bot processing it on railway?
2 years ago
ohhhh
2 years ago
what library are you using?
2 years ago
hmm, I was wondering if it was time server stuff, but prob not an issue in discordpy
2 years ago
do you get that delay on all commands? even a simple ping command?
2 years ago
good question
2 years ago
hmm
2 years ago
huh
2 years ago
just how great is your pc lmao
2 years ago
yeah.... ok
2 years ago
agreed
2 years ago
what do these memory intensive commands do?
make a bunch of web requests, stitch tiles together and render an image, do a projection and send it to the channel
2 years ago
im interested also in that some commands do not get a response
2 years ago
oh.
2 years ago
so it did not work fully on your pc
2 years ago
ah
2 years ago
hmmm
2 years ago
is the extra time just network request times?
2 years ago
hmm