Redis Networking/Egress despite using internal networking
timbo-tj
PROOP

2 years ago

Hi there

We are seeing Network activity on our Redis metrics despite connecting to it via internal networking. Is this expected? (Ignore the dip! We were down for maintenance 😆 )

Project ID
4c3b4b0e-006a-407e-90c7-9c3031cd622f

92 Replies

brody
EMPLOYEE

2 years ago

well one way to make sure nothing is connecting to it publicly would be to remove its tcp proxy, then before long something will crash


timbo-tj
PROOP

2 years ago

😆 true!


timbo-tj
PROOP

2 years ago

i can do this for our stg and dev servers


timbo-tj
PROOP

2 years ago

lets see how it goes


timbo-tj
PROOP

2 years ago

oh wait, i think i know why


timbo-tj
PROOP

2 years ago

i am using the internal ip but using the public port


timbo-tj
PROOP

2 years ago

ie

**.rlwy.net:56258 -> :6379

Private Networking
redis.railway.internal


timbo-tj
PROOP

2 years ago

and I am connecting to it via redis.railway.internal:6379 lol


brody
EMPLOYEE

2 years ago

the public port is 56258 in this case, 6379 being the private port


timbo-tj
PROOP

2 years ago

oh, right right


timbo-tj
PROOP

2 years ago

then thats not it


brody
EMPLOYEE

2 years ago

what you actually described redis.railway.internal:56258 would also just outright not work


timbo-tj
PROOP

2 years ago

yeah i didn't think it would, i was kinda suprised it was working at all with what i described!


timbo-tj
PROOP

2 years ago

but yeah seems like I have that the right way around


timbo-tj
PROOP

2 years ago

disabling the public TCP proxy now for dev/stg and observing/testing


timbo-tj
PROOP

2 years ago

seems fine so far… strange.. there is so much traffic on prd


brody
EMPLOYEE

2 years ago

prod is somehow connecting to it via the public network?


timbo-tj
PROOP

2 years ago

hm… i dont think so


timbo-tj
PROOP

2 years ago

but we will see


timbo-tj
PROOP

2 years ago

i disbled it for prd too and just observing again


timbo-tj
PROOP

2 years ago

but both stg and dev still show some traffic, minor, but still


timbo-tj
PROOP

2 years ago

will see what happens with prd


brody
EMPLOYEE

2 years ago

sounds good


timbo-tj
PROOP

2 years ago

Hmm, nope


timbo-tj
PROOP

2 years ago

its like the Redis traffic counts as egress..?


timbo-tj
PROOP

2 years ago

been about 10 mins

1217674403400122400


brody
EMPLOYEE

2 years ago

the traffic on the private network shouldn't be measured, check the cost breakdown to see if your redis service is incurring any egress


timbo-tj
PROOP

2 years ago

good idea


timbo-tj
PROOP

2 years ago

1217674693021274000


timbo-tj
PROOP

2 years ago

yeah it is <:blobconfused:618587926862757888>


timbo-tj
PROOP

2 years ago

and 'double the cost' i guess since the service talking to it is also taking the egress hit


brody
EMPLOYEE

2 years ago

and you have completely removed its tcp proxy?


timbo-tj
PROOP

2 years ago

yep!


timbo-tj
PROOP

2 years ago

1217675083611377700


brody
EMPLOYEE

2 years ago

is redis somehow sending data elsewhere? there's no tcp proxy but that doesn't disconnect it from the internet


timbo-tj
PROOP

2 years ago

I am not sure how i would check that. I just spun up redis using right click > database > redis, nothing bespoke


brody
EMPLOYEE

2 years ago

what are you using redis for?


timbo-tj
PROOP

2 years ago

various things - caching, temp store, used by my redis io adapter


timbo-tj
PROOP

2 years ago

each has their own, and they are the only ones communicating with their own redis db


timbo-tj
PROOP

2 years ago

lol


timbo-tj
PROOP

2 years ago

1217676127720444000


brody
EMPLOYEE

2 years ago

okay well now I have to go off on a tangent here


brody
EMPLOYEE

2 years ago

why service groups for your different environments instead of project environments?


timbo-tj
PROOP

2 years ago

hahaha i was debating whether i should put this up because i figured you would mention that haha


timbo-tj
PROOP

2 years ago

is there a cross-project egress cost? because my API Gateway would have to be in its own project


timbo-tj
PROOP

2 years ago

then the game servers in a nother, with an environment for each


timbo-tj
PROOP

2 years ago

but it means all comms will happen from API Gateway <- across projects -> Game Server


brody
EMPLOYEE

2 years ago

well you would have a single project, with multiple environments, each environment would have a gateway, game server and it's redis database


timbo-tj
PROOP

2 years ago

yeah but the gateway directs traffic to one of the 3 environments


timbo-tj
PROOP

2 years ago

so which is the 'true true' gateway, and are the other 2 just dummies that dont do anything, i guess? haha


brody
EMPLOYEE

2 years ago

if you where to go with the architecture I mentioned, your gateway would only route traffic to a production (or set of production) game server services in the production environment, and the gateway in the development environment would route traffic to the development game server in the same environment


timbo-tj
PROOP

2 years ago

it makes most sense to me if i could nest this setup inside one another.. something like

Main Project - contains Gateway                                                   | ->  Dev/Stg/Prd
   Game Server Project - contains game server/redis database. | ->  Dev/Stg/Prd   |

timbo-tj
PROOP

2 years ago

yeah but I need the single gateway to be able to route traffic to the Dev or Stg or Prd version of the server


brody
EMPLOYEE

2 years ago

no matter how you do it, you absolutely wouldn't want to be using multiple projects, and honestly with the group UI you have done it quite cleanly, was just curious is all


brody
EMPLOYEE

2 years ago

basically I'm stalling while trying to think of potential reasons for seeing such high outbound usage


timbo-tj
PROOP

2 years ago

it would be cool to be able to nest a project inside another, and then from the parent project I could have an API gateway to proxy the traffic to different environments of the sub project (dev/stg/prd)


timbo-tj
PROOP

2 years ago

and then I could spin up a dev version fo this WHOLE setup and test the entire stack


timbo-tj
PROOP

2 years ago

because right now I don't really have a 'stg' or 'dev' version of the my API gateway


brody
EMPLOYEE

2 years ago

-> 🙂


timbo-tj
PROOP

2 years ago

For that, I could use the environments feature. Have a Dev/Stg version of my current project that, inside it, has the Dev/Stg/Prd game services 'baked in'


timbo-tj
PROOP

2 years ago

hah! right? its a lot of traffic


timbo-tj
PROOP

2 years ago

we do run a multiplayer game so there is a lot of traffic going in and out, so I think the volume maybe makes sense


brody
EMPLOYEE

2 years ago

does the game server even have comparable traffic?


timbo-tj
PROOP

2 years ago

yeah, much more


timbo-tj
PROOP

2 years ago

i am grappling with this now, as our egress costs have made hosting on railway much more expensive than heroku hah


brody
EMPLOYEE

2 years ago

the gateway doesn't touch redis at all right?


brody
EMPLOYEE

2 years ago

yeah unfortunately there's not much railway can do about that right now since GCP has very high egress costs


timbo-tj
PROOP

2 years ago

so i am trying to make sure i am doing everything right and only incuring egress from what is absolutely neccessary, to get a better cost estimate. and thats how i encountered this odity with Redis


timbo-tj
PROOP

2 years ago

+1 yep


brody
EMPLOYEE

2 years ago

railway is moving to bare metal, I suspect the egress costs will drop and they will hopefully pass that down to the users too


brody
EMPLOYEE

2 years ago

but I am genuinely stumped here


timbo-tj
PROOP

2 years ago

fingers crossed, yeah it is a bit too pricing, it stings. I was excited about railway for future projects - for hosting game servers and such, but it might just cost too much in terms of egress for realtime applications


timbo-tj
PROOP

2 years ago

here is our prd game server

1217679908713791500


brody
EMPLOYEE

2 years ago

it might sting less if redis didn't have traffic for some reason <:mildpanic:804271964587819059>


timbo-tj
PROOP

2 years ago

exactly! hah 🙂


brody
EMPLOYEE

2 years ago

but good news, you're pro so I can escalate this to the team, hopefully they can dig into some of the internal network logs for these services, any last ideas before i do that though?


timbo-tj
PROOP

2 years ago

i just double checked my redis urls and such


timbo-tj
PROOP

2 years ago

but i guess with public networking disabled it doesnt mean much


timbo-tj
PROOP

2 years ago

so no, not really. I am also stumped! thanks 🙂


brody
EMPLOYEE

2 years ago

the team when available will communicate via that help station thread


brody
EMPLOYEE

2 years ago

I've heard they love when I escalate long debugging threads 🙂


timbo-tj
PROOP

2 years ago

😄 awesome thanks so much, curious to see what the outcome will be


brody
EMPLOYEE

2 years ago

me too!


timbo-tj
PROOP

2 years ago

Ok - I figured it out. While waiting for DNS changes to propagate I left our Heroku Dyno live. I had it connected to our Railway Redis service via public networking. I figured if I disable public networking it would kill any active connections but it seems like thats not the case? The Heroku Dyno was still connected to the Redis Service.

Anyway, shutting down the dyno reduced network usage as expected

1217689263827587000


brody
EMPLOYEE

2 years ago

how was the dyno generating so much network usage lol


timbo-tj
PROOP

2 years ago

Hmm, yeah, I am not sure why there is so much inbound traffic. I sort of expect the outbound. We're using the Redis Adapator with Socket IO to stream realtime multiplayer gameplay from Railways to the Heroku Dyno


timbo-tj
PROOP

2 years ago

anyway, I'll have to make sure I didn't write something too stupid on my end.


timbo-tj
PROOP

2 years ago

but atleast the egress issue is solved


timbo-tj
PROOP

2 years ago

tldr user error, though it is curious that the dynos connection to the Redis DB was not 'severed' when I disabled public networking


brody
EMPLOYEE

2 years ago

i will ask the person who wrote the tcp proxy if that would even be possible


brody
EMPLOYEE

2 years ago

but glad you where able to solve!


brody
EMPLOYEE

2 years ago

all the more reasons to shut down all your dynos 😉


Loading...