スティルハウスの書庫の書庫

はてなダイアリーで書いてた「スティルハウスの書庫」を移転してきました。

#appengine アプリの処理時間は「平均1秒以下」にすべし!重いのはTQへ!

ひがさんがつぶやかれてた件のソースです:

Chat Time transcript for May 5, 2010

Q: Why am I seeing a lot of warning logs saying "Request was aborted
after waiting too long to attempt to service your request"? 

A: As of release 1.3.1, there is no longer an upper limit on the number of
requests an app can service simultaneously -- the number of
application instances now scales indefinitely with your load, but only
if your average request latency is under 1,000 ms. If you see this
warning, it usually indicates that your latency is too high; reducing
your latency to 1,000 ms will make the error go away. Note: this does
not affect tasks, which can run for up to 30s before being terminated,
so move your heavier processing to the background using tasks. Also,
take advantage of Appstats which can help with performance profiling.
[7:15, 7:17, 7:20-7:21, 7:27] 
  • アプリの平均リクエスト処理時間が1秒以下ならば、制限なくスケールアウトできる
  • Task Queueのタスクはこの判断対象とはならないので、重い処理はTQにまわすのがお勧め