Jump to content

Load balancing with Ruby on Rails

MartinIAm

I want to scale my Ruby on Rails projects and use a load balancer in front of it but I’m not really sure how to do this. How will I configure storage for this and scaling across multiple virtual machines? I use puma right now because it is multithreaded and can be used in a cluster, but I’m not sure how to setup the cluster.

Link to comment
Share on other sites

Link to post
Share on other sites

i had done this for my cloud. The trick is to sprung up more processes, use a message queues, use cache, shard your databases, then rinse and repeat across as many server machines as you need to. To make this process less tedious, consider using docker, kubernetes, and automation tools like ansible. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, wasab said:

i had done this for my cloud. The trick is to sprung up more processes, use a message queues, use cache, shard your databases, then rinse and repeat across as many server machines as you need to. To make this process less tedious, consider using docker, kubernetes, and automation tools like ansible. 

I don’t run it off the cloud as I am self hosted so kubernetes and ansible isn’t a viable option for me but docker does sound like an option. 

 

You also didn’t explain how you manage your storage across the multiples virtual machines.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, MartinIAm said:

I don’t run it off the cloud as I am self hosted so kubernetes and ansible isn’t a viable option for me but docker does sound like an option. 

 

You also didn’t explain how you manage your storage across the multiples virtual machines.

For storage, i used mongodb and shard them as i said earlier. It is the industry practice for scaling out. 

https://docs.mongodb.com/manual/sharding/

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Oh! I think I understand now. So I can use mongodb as storage for active storage, and the use something like NFS to have the same replicated project across the multiple servers.

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, MartinIAm said:

I didn't know you could use mongodb for storage.

I used gridfs on Mongo. Idk if this is the ideal way to store large files but hey, it works well enough for me. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...
On 1/29/2020 at 4:17 PM, wasab said:

I used gridfs on Mongo. Idk if this is the ideal way to store large files but hey, it works well enough for me. 

Just to confirm, do you use Mongo in config/storage.yml?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×