Hi, I am developping a little chat application with rails. On my chat page I make ajax request every 10 seconds to check if there are news messages. I think if I keep this thing with a lot of user my performance will get really low. How can I improve this? Is is possible to observe when a row is added? Or how can I effeciently cache the messages? Thanks, Greg -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You might have a look at node.js - I''ve heard recently of apps which combine node.js w/ redis pubsub to get a pretty nifty quick experience w/ no polling. From a scalability and performance point of view, this has a couple of drawbacks - susceptible to network latencies, quality (may be better suited for intranet), and second, each client may need it''s own port (this for node.js). Here''s a pretty cool little app - http://www.web2media.net/laktek/2010/05/25/real-time-collaborative-editing-with-websockets-node-js-redis/ cheers, m On Mon, May 31, 2010 at 10:46 AM, Greg Ma <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, > I am developping a little chat application with rails. On my chat page I > make ajax request every 10 seconds to check if there are news messages. > I think if I keep this thing with a lot of user my performance will get > really low. > > How can I improve this? Is is possible to observe when a row is added? > Or how can I effeciently cache the messages? > > Thanks, > Greg > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Greg Ma wrote:> Hi, > I am developping a little chat application with rails. On my chat page I > make ajax request every 10 seconds to check if there are news messages. > I think if I keep this thing with a lot of user my performance will get > really low. >It shouldn''t if you structure your queries efficiently> How can I improve this? Is is possible to observe when a row is added?Perhaps, but pushing to the browser is difficult or impossible.> Or how can I effeciently cache the messages? > > Thanks, > GregYou''re doing premature optimization. Worry about the bottlenecks when you can actually measure them, not when you''re just speculating. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe you want to give this a try (there seems to be "no activity" currently, though...) http://code.google.com/p/canhaschat/ -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.