Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js and redis on same server?

We're using cloud hosting (Linode) to host a node.js based (and socket.io) chat app, with redis as the main DB. We haven't launched yet, but we're looking at hosting redis and node.js on the same machine (8 gb instance, redis limited to 5 GB for instance). All communication will be held in redis (ie straight from client to redis, no variables for dialog in node.js). To avoid network travel times amonsgt other bottle necks, we are looking at hosting redis and node.js on the same server. I can't find anything in documentation that would state this is a bad idea, but our sysops guy isn't convinced. Are there any drawbacks to going down this route?

like image 991
StackOverflowed Avatar asked Oct 31 '22 07:10

StackOverflowed


1 Answers

Refer to a very similar answer I posted on a similar matter on SO: Redis deployment configuration - master slave replication where the OP was having a similar issue but his concern was more related to performance.

My main issue with your solution (a simply side note on the other answer) is the simple fact that your node.js application by design has to be cloud facing, e.g., the internet whereas your Redis or other Databases shouldn't.

It doesn't mean you'll have a security issue by all means, but in my opinion it's a best practice to only expose the hosts you really need to, e.g., the ones usually serving content directly to the user.

By not deploying Redis to an internet facing host you enforce a lot of security constrains simply by the topology design of your network.

Is it ok to host those services in the same box:

Yes, do run the benchmarks from time to time to check if you need to scale horizontally or just bump up the flooded hosts.

Check: Redis deployment configuration - master slave replication

Will I have security problems by having Redis or another service facing the internet?

If you know what you are doing - no, you won't have security issues. I still wouldn't do it though.

like image 159
bitoiu Avatar answered Nov 15 '22 05:11

bitoiu