Hi all. I have two Rails applications. Each is on its own VPS hosted by Pipespring (excellent service btw). My app runs lightning quick - AFTER the first load. If I visit my site after a period of inactivity (i.e. no visitors to my site), it takes up to 10 seconds to load that first time. After that I can hop around with no problems. Has anyone run into this before? Ideas? - Rabbit _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Yeah, I''ve noticed the same thing. But it only happens - for me anyway - in development mode. The first hit often times out. After that, it loads about as fast as production mode. Production mode is always fast. I don''t know why this is. I''m using webbrick for development mode, and scgi for production mode (can''t remember if scgi in development mode suffers the same first-hit problem). csn --- Rabbit <rabbitblue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all. I have two Rails applications. Each is on > its own VPS hosted by > Pipespring (excellent service btw). > > My app runs lightning quick - AFTER the first load. > If I visit my site after > a period of inactivity (i.e. no visitors to my > site), it takes up to 10 > seconds to load that first time. After that I can > hop around with no > problems. > > Has anyone run into this before? Ideas? > > - Rabbit > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >__________________________________ Yahoo! for Good - Make a difference this year. http://brand.yahoo.com/cybergivingweek2005/
Ah... Yeah the site it seems to happen to most IS in development. I have another site though that is in production mode and it still tends to lag if there''s been no activity on it for a while. But, glad I''m not the only one experiencing this. If I find out what''s causing it I''ll post it here. :) - Rabbit --- On 12/27/05, CSN <cool_screen_name90001-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > > Yeah, I''ve noticed the same thing. But it only happens > - for me anyway - in development mode. The first hit > often times out. After that, it loads about as fast as > production mode. Production mode is always fast. > > I don''t know why this is. I''m using webbrick for > development mode, and scgi for production mode (can''t > remember if scgi in development mode suffers the same > first-hit problem). > > csn > > > --- Rabbit <rabbitblue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi all. I have two Rails applications. Each is on > > its own VPS hosted by > > Pipespring (excellent service btw). > > > > My app runs lightning quick - AFTER the first load. > > If I visit my site after > > a period of inactivity (i.e. no visitors to my > > site), it takes up to 10 > > seconds to load that first time. After that I can > > hop around with no > > problems. > > > > Has anyone run into this before? Ideas? > > > > - Rabbit > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > __________________________________ > Yahoo! for Good - Make a difference this year. > http://brand.yahoo.com/cybergivingweek2005/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I experience this as well and I''m pretty sure it''s just swapping on the server. If the server doesn''t have enough memory to hold all rails processes at once, then those not getting hit will be sent to disk. When you come along to request it, it has to recover that process from disc and put it back in memory. If you have shell access on your hosting account you should be able to view this using top and ps and/or ''free'' and ''vmstat''. Chris Nolan.ca http://kekova.ca/ On Dec 27, 2005, at 20:57, Rabbit wrote:> Hi all. I have two Rails applications. Each is on its own VPS > hosted by Pipespring (excellent service btw). > > My app runs lightning quick - AFTER the first load. If I visit my > site after a period of inactivity (i.e. no visitors to my site), it > takes up to 10 seconds to load that first time. After that I can > hop around with no problems. > > Has anyone run into this before? Ideas? > > - Rabbit
Here''s what ''free'' shows on my box: total used free shared buffers cached Mem: 1029868 1019924 9944 0 442652 292420 -/+ buffers/cache: 284852 745016 Swap: 2048276 386416 1661860 So, with +/- buffers I should have about 750MB free. ''ps axu|grep ruby'' shows: csn 25060 0.0 0.0 35800 4 pts/3 S Dec15 4:36 ruby /usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/bin/scgi_service config/scgi.yaml csn 18359 1.9 4.3 158584 44956 pts/3 D Dec21 183:17 ruby /usr/local/lib/ruby/gems/1.8/gems/scgi_rails-0.4.3/bin/scgi_service config/scgi.yaml csn 30260 0.0 1.5 28372 16208 pts/3 S Dec24 1:32 ruby ./script/server csn 26902 0.1 1.2 27248 13344 pts/5 S 00:59 0:08 ruby ./script/server -p 3001 So the webbrick servers are using about 28K/15K VSZ/RSS each, and the one scgi has 158K/45K. The scgi servers do seem to grow rather large in size after a while. I don''t think it''s due to swapping, but rather perhaps something timing out - like webbrick shuts down after a while and then has to startup. But still, my first hit after a while almost always results in a timeout (after about 30 seconds). I dunno... csn --- "Chris Nolan.ca" <rubyonrails-KoDwELoOUhLbB4Hn5RLMFg@public.gmane.org> wrote:> I experience this as well and I''m pretty sure it''s > just swapping on > the server. > > If the server doesn''t have enough memory to hold all > rails processes > at once, then those not getting hit will be sent to > disk. When you > come along to request it, it has to recover that > process from disc > and put it back in memory. > > If you have shell access on your hosting account you > should be able > to view this using top and ps and/or ''free'' and > ''vmstat''. > > Chris Nolan.ca > http://kekova.ca/ > > On Dec 27, 2005, at 20:57, Rabbit wrote: > > > Hi all. I have two Rails applications. Each is on > its own VPS > > hosted by Pipespring (excellent service btw). > > > > My app runs lightning quick - AFTER the first > load. If I visit my > > site after a period of inactivity (i.e. no > visitors to my site), it > > takes up to 10 seconds to load that first time. > After that I can > > hop around with no problems. > > > > Has anyone run into this before? Ideas? > > > > - Rabbit > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >__________________________________ Yahoo! for Good - Make a difference this year. http://brand.yahoo.com/cybergivingweek2005/
I have seen this same behavior on a few sites I made that don''t get much traffic. I''m not exactly sure why the processes ''hibernate'' or whatever they do but the way I have fixed the problem is thus: Create a cron job that curl''s or wget''s a page on your site every 5 minutes and sends the output to /dev/null . This will ''exercise'' your site and keep the processes from having to startup or unswap or whatever they are doing. Cheer- -Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org 509-577-7732
Sweet. Thanks for the work-around Ezra. :) --- On 12/28/05, Ezra Zygmuntowicz <ezra@yakima-herald.com> wrote:> > I have seen this same behavior on a few sites I made that don''t > get > much traffic. I''m not exactly sure why the processes ''hibernate'' or > whatever they do but the way I have fixed the problem is thus: > > Create a cron job that curl''s or wget''s a page on your site every > 5 > minutes and sends the output to /dev/null . This will ''exercise'' your > site and keep the processes from having to startup or unswap or > whatever they are doing. > > Cheer- > > -Ezra Zygmuntowicz > WebMaster > Yakima Herald-Republic Newspaper > ezra@yakima-herald.com > 509-577-7732 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060107/b41dd23c/attachment.html
The lag during development mode has to do with the fact that your pages are being pulled from source every time you load them. You best option would be to put your app into production mode and work on caching content in order to increase speed. -Kenny On 1/7/06, Rabbit <rabbitblue@gmail.com> wrote:> > Sweet. Thanks for the work-around Ezra. :) > > --- > > On 12/28/05, Ezra Zygmuntowicz <ezra@yakima-herald.com > wrote: > > > > I have seen this same behavior on a few sites I made that don''t > > get > > much traffic. I''m not exactly sure why the processes ''hibernate'' or > > whatever they do but the way I have fixed the problem is thus: > > > > Create a cron job that curl''s or wget''s a page on your site > > every 5 > > minutes and sends the output to /dev/null . This will ''exercise'' your > > site and keep the processes from having to startup or unswap or > > whatever they are doing. > > > > Cheer- > > > > -Ezra Zygmuntowicz > > WebMaster > > Yakima Herald-Republic Newspaper > > ezra@yakima-herald.com > > 509-577-7732 > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060107/47f347eb/attachment.html
We are talking about production sites here that run on fcgi and don''t get traffic for large intervals of time. When these apps first get hit after a period of inactivity it takes a few seconds for the first page to load. Then after that the performance is great. The fcgi processes seem to get paged out of memory and take a few seconds to ''wake up''. So this method of using cron and wget just keeps the fcgi''s exercised and in memory instead of paged out to disk. Cheers- -Ezra On Jan 7, 2006, at 2:45 PM, Kenneth Parnell wrote:> The lag during development mode has to do with the fact that your > pages are being pulled from source every time you load them. You > best option would be to put your app into production mode and work > on caching content in order to increase speed. > > -Kenny > > > On 1/7/06, Rabbit <rabbitblue@gmail.com> wrote: > Sweet. Thanks for the work-around Ezra. :) > > --- > > > On 12/28/05, Ezra Zygmuntowicz <ezra@yakima-herald.com > wrote: > I have seen this same behavior on a few sites I made that > don''t get > much traffic. I''m not exactly sure why the processes ''hibernate'' or > whatever they do but the way I have fixed the problem is thus: > > Create a cron job that curl''s or wget''s a page on your site > every 5 > minutes and sends the output to /dev/null . This will ''exercise'' your > site and keep the processes from having to startup or unswap or > whatever they are doing. > > Cheer- > > -Ezra Zygmuntowicz > WebMaster > Yakima Herald-Republic Newspaper > ezra@yakima-herald.com > 509-577-7732 > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-Ezra Zygmuntowicz WebMaster Yakima Herald-Republic Newspaper ezra@yakima-herald.com 509-577-7732 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060108/15aa20f6/attachment.html