Rails web application becomes extremely slow over time
tim-lynn-clark
PROOP

6 months ago

A pretty simple Rails application running on Railway becomes slower and slower over time after deployment. It is snappy and quick after deployment. But, after a few weeks of use (3 to be exact), it gets to the point that it is taking 5-10 seconds for a page to load. I really need to get to the bottom of this, or move the app to another service.

  • On the Pro plan

  • App is set to max at 32 vcpu, so that is not the issue

  • App is set to max at 32 GB of ram, so that is not the issue

  • DB is Supabase and the query response times are in the 10's of ms range, so not the DB

  • Engineering team has already optimized the Rails app based on common performance improvements.

I am fairly new to managing Railway deployments, so please, if you can, help me figure this out.

$30 Bounty

9 Replies

Railway
BOT

6 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


tim-lynn-clark
PROOP

6 months ago

Also, randomly, users can get CloudFlare errors due to no server response, reload the page, and then see the app.


clashing
HOBBY

6 months ago

Please provide the snippet of the resource usage for your application (by going to the observability tab of the project) so that we can see the memory/CPU consumptions by your app in the past 30 days.

Because there is nothing on Railway that would intentionally downgrade your service's performance over time


tim-lynn-clark
PROOP

6 months ago

The app is using memcache, so I assume that is the reason it is consuming as much memory as it does. The drops in the memory look to be when I deploy a new release.

Attachments


shxkm
PRO

6 months ago

By memcache do you mean in-memory cache or Memcached the open source key value store? If it’s the former then you may have your answer.


tim-lynn-clark

The app is using memcache, so I assume that is the reason it is consuming as much memory as it does. The drops in the memory look to be when I deploy a new release.

clashing
HOBBY

6 months ago

Yes, that is the case! Only at the time of re-deploying, the usage metrics comes down, as Railway is deploying everything again!

Btw, how many services are there in your current Railway setup? If there are more than one, please ensure that all of them are in the same region, because the most common root causes for high resources utilization are mismatched service regions/infrastructure.

You can find that info under the deploy settings

As you are already on the highest plan, this can only aid you a bit v emoji

Attachments


clashing

Yes, that is the case! Only at the time of re-deploying, the usage metrics comes down, as Railway is deploying everything again!Btw, how many services are there in your current Railway setup? If there are more than one, please ensure that all of them are in the same region, because the most common root causes for high resources utilization are mismatched service regions/infrastructure.You can find that info under the deploy settingsAs you are already on the highest plan, this can only aid you a bit

tim-lynn-clark
PROOP

6 months ago

Thanks for all the help, and for being nice about it. Some people can be really flippant in their responses. I did check the services and they are all within the same region.


shxkm

By memcache do you mean in-memory cache or Memcached the open source key value store? If it’s the former then you may have your answer.

tim-lynn-clark
PROOP

6 months ago

Yes, memcached. It was such a simple Rails app with very low user load, I really did not think it would be necessary to setup Redis and caching. I will give that a try and see if it helps.


tim-lynn-clark

Yes, memcached. It was such a simple Rails app with very low user load, I really did not think it would be necessary to setup Redis and caching. I will give that a try and see if it helps.

clashing
HOBBY

6 months ago

Any update, tim!


Loading...