a year 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
a year ago
I've been running bots on Railway for 2 years and I've never had any issues with latency
a year ago
Do you have a database on Railway that your bot is using?
a year ago
Can you make sure they're on the same region and that you're connecting to postgres through the private network?
a year ago
exactly, to be sure you can check if it uses a railway.internal domain
a year ago
awesome, and the region?
a year ago
on the exact same area in US-west?
a year ago
they're both US West Oregon ?
a year ago
<:sus_apple:1032821016319234068>
a year 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
a year 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
a year 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?
a year ago
ohhhh
a year ago
what library are you using?
a year ago
hmm, I was wondering if it was time server stuff, but prob not an issue in discordpy
a year ago
do you get that delay on all commands? even a simple ping command?
a year ago
good question
a year ago
hmm
a year ago
huh
a year ago
just how great is your pc lmao
a year ago
yeah…. ok
a year ago
agreed
a year 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
a year ago
im interested also in that some commands do not get a response
a year ago
oh.
a year ago
so it did not work fully on your pc
a year ago
ah
a year ago
hmmm
a year ago
is the extra time just network request times?
a year ago
hmm