horizontally scale service/n8n workers
dogucansasioglu
PROOP

10 months ago

I'm trying to scale up my n8n workers and I wrote a small script to check the redis que and create more workers/services in the project as needed.

I found out that there's a limit to the amount of services you can open on the hobby plan.

If I upgrade to the Pro plan does that increase my limit and whats the new limit?

Solved

16 Replies

50 replicas on Pro!


Status changed to Awaiting User Response Railway 10 months ago


dogucansasioglu
PROOP

10 months ago

How about the amount of services, not the replicas. That seems to have better memory/cpu usage.


Status changed to Awaiting Railway Response Railway 10 months ago


Uncapped on Pro


Status changed to Awaiting User Response Railway 10 months ago


dogucansasioglu
PROOP

10 months ago

perfect. thank you.


Status changed to Awaiting Railway Response Railway 10 months ago


dogucansasioglu
PROOP

10 months ago

Any idea on how I can scale the postgres db? Sometimes when there are too many requests it says db is not ready.

Assuming at some point that will happen with redis too so if you have something for that feel free to throw it in there as well.


That's a N8N thing- I wouldn't be able to help you there.


Status changed to Awaiting User Response Railway 10 months ago


angelo-railway

Uncapped on Pro

dogucansasioglu
PROOP

10 months ago

Hello, it says 100 max. Could you check if I'm doing something wrong?


Status changed to Awaiting Railway Response Railway 10 months ago


brody
EMPLOYEE

10 months ago

Hello,

100 services is the limit, it was a recent change Angelo may not have been aware about.

Though this begs the question that must be asked, how is that many services and replicas needed to begin with?

Surely if that many is needed you either plan to operate on a global scale, or some really inefficient code is running?


Status changed to Awaiting User Response Railway 10 months ago


brody
EMPLOYEE

10 months ago

And I have to mention, are you keeping an eye on the usage, it seems to be climbing quite fast and we wouldn't want to have to hit you with any unexpected invoices haha.


dogucansasioglu
PROOP

10 months ago

I appreciate your concern. Yeah, usage should be fine. The idea is to keep 2 n8n workers at all times. There are times when I need to do 200k tasks; if I do that with 2 (or even 50) workers, it will take forever. So I wrote a small script that watches the Redis que and opens up n8n workers/services to scale the operation for those times. I want to finish those tasks asap and then delete the services so I think I'm fine. If you have a better idea it would help a lot.


Status changed to Awaiting Railway Response Railway 10 months ago


dogucansasioglu
PROOP

10 months ago

Also how do I add replicas on the API? I'm assuming its ServiceInstanceUpdateInput and multiRegionConfig: JSON or numReplicas: Int

But numReplicas doesn't seem to work and not sure the structure on the multiRegionConfig


brody
EMPLOYEE

10 months ago

> If you have a better idea it would help a lot.

Given you can do 50 replicas per service, I'd first scale out with replicas and then add more services with 50 replicas each.

> how do I add replicas on the API? I'm assuming its ServiceInstanceUpdateInput and multiRegionConfig: JSON or numReplicas: Int

You would want multiRegionConfig as numReplicas was deprecated, config format can be found here -

https://docs.railway.com/reference/config-as-code#multi-region-configuration


Status changed to Awaiting User Response Railway 10 months ago


dogucansasioglu
PROOP

10 months ago

Thanks for the advice, I think that's the plan too. Could you help me understand why this doesnt work?

Here's the mutation:

mutation serviceInstanceUpdate {
            serviceInstanceUpdate(
                environmentId: "${ENVIRONMENT_ID}",
                serviceId: "${serviceId}",
                input: {
					multiRegionConfig: {
						us-west2: {
							numReplicas: 10
						},
					}
                }	
            )
        }

Here's the error

errors: [

{

message: 'Syntax Error: Invalid number, expected digit but got: "w".',

locations: [Array],

extensions: [Object],

traceId: '1172814305930457991'

}

]


Status changed to Awaiting Railway Response Railway 10 months ago


dogucansasioglu
PROOP

10 months ago

Ok solved.


brody
EMPLOYEE

10 months ago

Wasn't valid JSON right?


Status changed to Awaiting User Response Railway 10 months ago


dogucansasioglu
PROOP

10 months ago

Yeah


Status changed to Awaiting Railway Response Railway 10 months ago


Status changed to Solved angelo-railway 10 months ago


Loading...