Serverless behaviour across replicas
xplusai
HOBBYOP

8 months ago

Let's say I made an app that will output to logs "Hello World!" every minute. Then I use replica system to make 5 instances of this app. And I also switch on serverless. I keep all replicas awake by sending a health check to all 5 instances every 5 minutes.

My question is, if I just send a health check to only 1 instance, will it keep all of them awake? I guess I'm trying to figure out if the serverless sleep function is connected across instances. I am wondering if 1 instance is awake then all are awake and if 1 instance is asleep then all are asleep? Or are they all treated as if they're an app on their own without being connected to the status of the other instances?

Solved

3 Replies

echohack
EMPLOYEE

7 months ago

Hi xplusai,

Each replica should operate independently of each other (they're separate containers and even on potentially separate hosts).

Hope that helps!


Status changed to Awaiting User Response Railway 8 months ago


Status changed to Solved echohack 8 months ago


xplusai
HOBBYOP

7 months ago

Thanks for the reply. That clears things up for me. I do have 1 last question. If I made an app that would constantly check a job queue in a Redis instance over Railway private network, is that still considered network traffic and keep the app awake instead of going to sleep?

Example:

while (!shouldStop) {
    try {
        const job = await redis.brpop('queue', 0);
        if (!job) continue;

        console.log(`Job found!`);
    } catch (error) {
        console.error('Error in processQueue:', error);
        await delay(1000);
    }
}

Status changed to Awaiting Railway Response Railway 8 months ago


echohack
EMPLOYEE

7 months ago

Pretty easy answer here: Yes that would still be considered network traffic.


Status changed to Awaiting User Response Railway 8 months ago


Status changed to Solved echohack 8 months ago


Loading...