a water
2006-Sep-22 04:22 UTC
[Backgroundrb-devel] how about the global data when multiple backgroundrbs ?
Ezra, Suppose a chatroom application, a RailsApp + 2 backgroundrbs: MiddleMan1& MiddleMan2, running in 2 machines. When Chater1 login, RailsApp call MiddleMan1 to get something about Chater1 from db to memory, like his contacts or other personal settings. When Chater2 login, RailsApp call MiddleMan2 do the same thing. But who is reponsible for the Global Data? like a Online Chaters List, or Active Chat Room List ? I think, for the MiddleMan1 & MiddleMan2 located in different machines, global data should not be there. So global data in RailsApp as Global Variables? But how about RailsApp also running in 2+ servers ? It seems the possible ways to store global data is db or network file system ? Hope for suggestions, thanks.>>On Sep 21, 2006, at 5:44 AM, sherwin velasco wrote:>> i''m in a team that is currently developing a web 2.0 application that >> really needs to scale in the very near future. >> we are using backgroundrb for some of the server tasks. >> currently, we have two servers (in RubyOnRails) that connects to a >> single backgroundrb daemon. >> is there a way that we can run multiple backgroundrb and have the >> servers do a round robin on them to retrieve a worker using a key that >> was saved in the session? >> >> _______________________________________________ >> Backgroundrb-devel mailing list >> Backgroundrb-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/backgroundrb-devel> Hey Sherwin- > > This could be coded up to work for you. You would basically write a classthat wraps multiple middleman clients and tries to get the workers by checking for MiddleMan.jobs.keys.include? session [:jobkey] . So you could have MiddleMan1, MiddleMan2..MiddleManN .>And just make a wrapper that iterates over each midleman checking to see ifit contains the job you are looking for and using the right middleman.> This would not be too hard to come up with and I might add something tosupport this soon. I do have a completele new version of the whole plugin cooking. >I hope to get it released this weekend but we shall see. The new version will support spawning multiple processes and managing those through the same interface.>-Ezra-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060922/2f3d6122/attachment.html
Jason Edgecombe
2006-Sep-24 13:52 UTC
[Backgroundrb-devel] how about the global data when multiple backgroundrbs ?
Hi, The answer is that nobody is responsible unless you code them to be. The easiest solution is to use the DB. I''m guessing you could also make one middleman the "master" that holds all of the globals. The DB gives the best data persistence. Since you''re already using a two server set up, I would recommend checking out memcached at www.danga.org. If you care about data persistence, then use the DB with memcached as a cache. Otherwise, just use memcached my itself. Some other options might be Rinda or a third plan drb process. Sincerely, Jason a water wrote:> > Ezra, > Suppose a chatroom application, a RailsApp + 2 backgroundrbs: > MiddleMan1& MiddleMan2, running in 2 machines. > > When Chater1 login, RailsApp call MiddleMan1 to get something about > Chater1 from db to memory, like his contacts or other personal settings. > > When Chater2 login, RailsApp call MiddleMan2 do the same thing. > > But who is reponsible for the Global Data? like a Online Chaters > List, or Active Chat Room List ? > > I think, for the MiddleMan1 & MiddleMan2 located in different > machines, global data should not be there. > > So global data in RailsApp as Global Variables? But how about > RailsApp also running in 2+ servers ? > > It seems the possible ways to store global data is db or network > file system ? > > Hope for suggestions, thanks. > > >>On Sep 21, 2006, at 5:44 AM, sherwin velasco wrote: > > >> i''m in a team that is currently developing a web 2.0 application that > >> really needs to scale in the very near future. > >> we are using backgroundrb for some of the server tasks. > >> currently, we have two servers (in RubyOnRails) that connects to a > >> single backgroundrb daemon. > >> is there a way that we can run multiple backgroundrb and have the > >> servers do a round robin on them to retrieve a worker using a key that > >> was saved in the session? > >> > >> _______________________________________________ > >> Backgroundrb-devel mailing list > >> Backgroundrb-devel at rubyforge.org <http://rubyforge.org> > >> http://rubyforge.org/mailman/listinfo/backgroundrb-devel > > > > Hey Sherwin- > > > > This could be coded up to work for you. You would basically write a > class that wraps multiple middleman clients and tries to get the > workers by checking for MiddleMan.jobs.keys.include ? session > [:jobkey] . So you could have MiddleMan1, MiddleMan2..MiddleManN . > >And just make a wrapper that iterates over each midleman checking to > see if it contains the job you are looking for and using the right > middleman. > > > This would not be too hard to come up with and I might add something > to support this soon. I do have a completele new version of the whole > plugin cooking. >I hope to get it released this weekend but we shall > see. The new version will support spawning multiple processes and > managing those through the same interface. > > > >-Ezra > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel