deployment - Ruby on Rails on few servers -
i have big application. 1 of part of highload processing user files. decide provide 1 dedicate server. there nginx distribution content , programs (non rails) processing files.
i have 2 question:
- what better use on server? (rails or else, maybe sinatra)
- if i'll use rails how deploy? can't find instruction. if have 1 app , 2 servers how deploy , delegate task each other?
ps need authorize user on both servers. in rails use devise.
you can use rails this. if both servers act web client end user you'll need sort of load balancer in front of 2 servers. haproxy great job on this.
as far getting 2 applications communicate each other, less trivial may think. should use locking mechanism on performing tasks. delayed_job
default lock job in queue other works not try , work on same job. can use callbacks activejob
notify user via web sockets whenever job completed.
anything take time or calling external api should placed background processing queue you're not holding user.
if cannot spin more 2 servers, should make 1 of them master or @ least have clear roles of 2 servers. example, 1 server may background processing , memcache server while other storing database , handles web sockets.
there lot of different ways of configuring services , including , beyond i've mentioned opinionated.
having separate servers handling tasks preference makes them easier manage sys admin perspective. example, if find our web sockets server hammered, can spin few more web socket servers , throw them load balancer pool. end user not negatively impacted networking changes. whereas, if have servers performing dual roles outside of standard rails installation, may find cloning , wasting resources. each of web servers perform background tasks on low-intermediate priority queues while dedicated server left handling mission critical jobs.
Comments
Post a Comment