开发者

Slow Rails website problem

开发者 https://www.devze.com 2023-01-29 11:34 出处:网络
I have a Rails website which, for the last 24 hours has been running very slowly. The odd thing is that (see logs below) every request is taking 45 or 46 seconds, as though is is waiting for some kind

I have a Rails website which, for the last 24 hours has been running very slowly. The odd thing is that (see logs below) every request is taking 45 or 46 seconds, as though is is waiting for some kind of timeout. Static content is loading quickly and the server is otherwise performing normally.

The site is at http://plantality.com and is hosted by rail playground. It uses Apache + Passenger, Rai开发者_Python百科ls 2.1.1, attachment_fu, thinking sphinx, rmagick, bbruby.

Server log samples:

Processing WikiController#finder (for 66.249.67.103 at 2010-12-05 02:58:59) [GET]
Session ID: e9e947f58fb1f0f60eeff2fc62a2de72
Parameters: {"group"=>"1", "upright"=>"1", "houseplant"=>"1", "wi_6to12"=>"1", "bushy"=>"1",  "action"=>"finder", "controller"=>"wiki", "pots_tubs"=>"1"}
Cookie set: referer=; path=/
Cookie set: geo_country=; path=/
Rendering template within layouts/global
Rendering wiki/finder
Completed in 45.06793 (0 reqs/sec) | Rendering: 0.03833 (0%) | DB: 0.00878 (0%) | 200 OK [http://plantality.com/finder?bushy=1&group=1&houseplant=1&pots_tubs=1&upright=1&wi_6to12=1]


Processing MainController#index (for 67.225.164.12 at 2010-12-05 02:59:44) [GET]
Session ID: 0389102261c509523911c65b28c7661b
Parameters: {"action"=>"index", "controller"=>"main"}
Cookie set: referer=; path=/
Cookie set: geo_country=; path=/
Rendering template within layouts/global
Rendering main/index
Completed in 45.42652 (0 reqs/sec) | Rendering: 0.23435 (0%) | DB: 0.04589 (0%) | 200 OK [http://plantality.com/]


Solution: I was using an IP to country geo-coding service. I coded it so that the result was cached in a cookie, but my site was getting about 100,000 daily hits from google. Google (and other spiders) weren't returning the cookie to me, so the IP service was throttling my usage of it.

Yah boo to all those who said this was a hosting issue and not a programming one.

0

精彩评论

暂无评论...
验证码 换一张
取 消