Unexpected Inbound Traffic to Backend Service in Railway Environment
zhangjiankun-1997
HOBBYOP

2 years ago

I have deployed a Remix frontend service, a Spring Boot backend service, a PostgreSQL instance, and a Redis instance in a project on Railway. As this is a test environment, I initially enabled the auto-sleep feature for all services to save costs. The backend service connects to the database and Redis using internal network addresses (connecting directly using service names), and everything was working fine.

However, I noticed that requests from the internal network did not wake up the database and Redis when I accessed the backend service. As a result, I had to set the backend service to access the database and Redis from the external network with generate domains.

Now, I'm facing a new issue. When I stop accessing the frontend page, the frontend service goes to sleep as expected, but the backend service continues to run, even though I have turned off the external network generate domain for the backend service.

Upon checking the metrics report for the backend service, I noticed that there is still inbound traffic. I'm unsure where this traffic is coming from and would like to know how I can investigate this issue.

3 Replies

2 years ago

I'm unsure where this traffic is coming from and would like to know how I can investigate this issue.

You likely answered yourself…

I had to set the backend service to access the database and Redis from the external network.

That creates public traffic.

I noticed that requests from the internal network did not wake up the database and Redis when I accessed the backend service.

Yep, this is a known limitation, you can't wake a service via the private network at this moment. You would want to connect to the databases via the private network and only enable app sleeping on the backend and frontend services and not the databases.

I'm unsure where this traffic is coming from and would like to know how I can investigate this issue.

It's most likely coming from the public database connections, but other than that Railway doesn't provide any networking logs so you would only have your intuition to debug this with.


zhangjiankun-1997
HOBBYOP

2 years ago

@brody Yes, I also suspect that the public traffic between the backend service and the database is causing them to wake each other up. Unfortunately, I haven't found information about whether Spring Data JPA will poll the database to check the health status, and I will observe and test it locally.

Anyway, thank you for your reply and insights!Hava a good day!


2 years ago

Sounds good, let me know if you have any more questions!


Loading...