Hello, My production app is running on a 80USD server. My tech stack is: MongoDB+Redis NodeJS+PM2 Nginx
This is everything on 1 server. I receive no traffic in the night and hence it’s not the most efficient architecture.
However, most of the things are stateless/or need minimal changes.
I was reading about Kubernetes, which basically autoscales containers. So I want to know if I can decrease my cost by using K8s.
I can run 10USD nodes which can automatically scale up/down lowering my “computational costs”. But how does the same work for my database? Can Redis and mongo be put on K8s nodes? If yes, where is the main database stored? If yes, how is the Redis memory shared between the NodeJS nodes?
Will this architecture increase my costs? Do you have any other advices?
Also, I’m thinking about switching to Postgres in the future as my database in structured, and I use mongoose for joins which is, again, not the efficient method. So, as mongo includes an inbuilt sharding feature, please advise me if the same architecture can be followed with a different database?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!