Heroku错误R14(超出内存配额):我如何解决这个问题? [英] Heroku Error R14 (Memory quota exceeded): How do I solve this?

查看:161
本文介绍了Heroku错误R14(超出内存配额):我如何解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Heroku上有一个Rails 3.1应用程序。我看到很多这样的错误:
$ b


错误R14(超过内存配额)


通常前面的日志条目显示:
$ b


进程运行mem = 522M(102.1%)

这个确实有所不同,但从来没有太多变化,几乎可以在任何URL请求之后发生,所以它与特定的控制器操作无关据我所知。



这是一段经典的日志条目:

  2012-01-16T02:35:57 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1队列= 0等待= 0ms服务= 55ms状态= 401 bytes = 27 
2012-01-16T02:35:58 + 00:00 heroku [router]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1 queue = 0 wait = 0ms service = 155ms status = 200字节= 1
2012-01-16T02:36:02 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1队列= 0等待= 0ms服务= 13ms状态= 401字节= 27
20 12-01-16T02:36:02 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1队列= 0等待= 0ms服务= 147ms状态= 200字节= 1
2012-01-16T02:36:09 + 00:00 heroku [router]:POST prizequiz.herokuapp.com/mobile_users dyno = web.1 queue = 0 wait = 0ms service = 87ms status = 201 bytes = 624
2012-01-16T02:36:11 + 00:00 heroku [router]:GET prizequiz.herokuapp.com/quizzes/1/questions dyno = web.1 queue = 0 wait = 0ms service = 5ms status = 401 bytes = 27
2012-01-16T02:36:11 + 00:00 heroku [router]:GET prizequiz.herokuapp.com/quizzes/1/questions dyno = web.1 queue = 0 wait = 0ms service = 290ms状态= 200字节= 81412
2012-01-16T02:36:15 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1队列= 0等待= 0ms服务= 10ms status = 401 bytes = 27
2012-01-16T02:36:16 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1队列= 0等待= 0ms服务= 67ms状态= 200字节= 1
2012-01-16T02:36:33 + 00:00 heroku [路由器]:POST prizequiz.herokuapp.com/quizzes/1/sco res dyno = web.1 queue = 0 wait = 0ms service = 10ms status = 401 bytes = 27
2012-01-16T02:36:33 + 00:00 heroku [router]:POST prizequiz.herokuapp.com/ quizzes / 1 / scores dyno = web.1 queue = 0 wait = 0ms service = 132ms status = 201 bytes = 230
2012-01-16T02:36:55 + 00:00 heroku [web.1]:Process运行内存= 522M(102.1%)
2012-01-16T02:36:55 + 00:00 heroku [web.1]:错误R14(超出内存配额)
2012-01-16T02:37 :17 + 00:00 app [web.1]:
2012-01-16T02:37:17 + 00:00 app [web.1]:
2012-01-16T02:37:17 +00:00 app [web.1]:在2012-01-16 02:37:17 +0000
开始POST/ quizzes / 1 / scores为177.53.80.25 2012-01-16T02:37: 17 + 00:00 app [web.1]:cache:[POST / quizzes / 1 / scores] invalidate,pass
2012-01-16T02:37:17 + 00:00 app [web.1]:
2012-01-16T02:37:17 + 00:00 app [web.1]:
2012-01-16T02:37:17 + 00:00 app [web.1]:Started POST / q​​uizzes / 1 / scores为177.53.80.25于2012-01-16 02:37:17 +0000
2012-01-16T02:37:17 + 00:00 app [web.1]:cache :[POST / quizzes / 1 / scores]无效,通过
2012-01-16T 02:37:17 + 00:00 heroku [路由器]:邮局prizequiz.herokuapp.com/quizzes/1/scores dyno = web.1队列= 0等待= 0ms服务= 44ms状态= 201字节= 230
2012-01-16T02:37:17 + 00:00 heroku [web.1]:流程运行内存= 522M(102.1%)
2012-01-16T02:37:17 + 00:00 heroku [web。 1]:错误R14(超出内存配额)
2012-01-16T02:37:17 + 00:00 heroku [路由器]:POST prizequiz.herokuapp.com/quizzes/1/scores dyno = web.1队列= 0等待= 0ms服务= 16ms状态= 401字节= 27
2012-01-16T02:37:20 + 00:00应用[web.1]:
2012-01-16T02:37: 20 + 00:00 app [web.1]:
2012-01-16T02:37:20 + 00:00 app [web.1]:开始GET/ quizzes / 1 / scores / current_game为177.53 .80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20 + 00:00 app [web.1]:cache:[GET / quizzes / 1 / scores / current_game] miss
2012-01-16T02:37:20 + 00:00 app [web.1]:
2012-01-16T02:37:20 + 00:00 app [web.1] :
2012-01-16T02:37:20 + 00:00 app [web.1]:在2012-01-16 02:37开始GET/ quizzes / 1 / scores / current_game为177.53.80.25 :20 +0000
2012-01 -16T02:37:20 + 00:00 heroku [router]:GET prizequiz.herokuapp.com/quizzes/1/scores/current_game dyno = web.1 queue = 0 wait = 0ms service = 8ms status = 401 bytes = 27
2012-01-16T02:37:20 + 00:00 app [web.1]:cache:[GET / quizzes / 1 / scores / current_game] miss
2012-01-16T02:37:20 +00:00 heroku [router]:GET prizequiz.herokuapp.com/quizzes/1/scores/current_game dyno = web.1 queue = 0 wait = 0ms service = 6ms status = 401 bytes = 27
2012-01 -16T02:37:20 + 00:00 app [web.1]:
2012-01-16T02:37:20 + 00:00 app [web.1]:
2012-01-16T02 :37:20 + 00:00 app [web.1]:在2012-01-16 02:37:20 +0000
开始POST/ quizzes / 1 / scores为177.53.80.25 2012-01- 16T02:37:20 + 00:00 heroku [router]:POST prizequiz.herokuapp.com/quizzes/1/scores dyno = web.1 queue = 0 wait = 0ms service = 33ms status = 401 bytes = 27
2012-01-16T02:37:20 + 00:00 app [web.1]:cache:[POST / quizzes / 1 / scores] invalidate,pass
2012-01-16T02:37:20 + 00: 00 app [web.1]:
2012-01-16T02:37:20 + 00:00 app [web.1]:
2012-01-16T02:37:20 + 00:00 app [web.1]:Sta在2012-01-16 02:37:20 +0000
2012-01-16T02:37:20 + 00:00 app [web。 1]:
2012-01-16T02:37:20 + 00:00 app [web.1]:

我安装了New Relic,但一直无法识别任何用途。



如果需要,我们很乐意提供更多信息。我还有一个对Heroku的出色支持请求,但是到目前为止(2天标记为紧急)我没有回应。



添加web dynos并没有什么区别。 / p>

UPDATE ,我添加了oink gem,这是一个示例结果。

  2012-01-26T08:24:25 + 00:00 app [web.1]:
2012-01-26T08:24:25 + 00:00 app [web。 1]:
2012-01-26T08:24:25 + 00:00 app [web.1]:开始PUT/ mobile_users / 1为110.49.234.219于2012-01-26 08:24:25 +0000
2012-01-26T08:24:26 + 00:00 app [web.1]:Oink操作:mobile_users#update
2012-01-26T08:24:26 + 00:00 app [web.1]:内存使用情况:286276 | PID:16
2012-01-26T08:24:26 + 00:00 app [web.1]:Instantiation Breakdown:Total:2 | MobileUser:2
2012-01-26T08:24:26 + 00:00 app [web.1]:Oink日志输入完成
2012-01-26T08:24:26 + 00:00 app [ web.1]:缓存:[PUT / mobile_users / 1]无效,通过
2012-01-26T08:24:26 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1 queue = 0 wait = 0ms service = 460ms status = 200 bytes = 1
2012-01-26T08:24:38 + 00:00 heroku [web.1]:进程运行mem = 537M(104.9 %)
2012-01-26T08:24:38 + 00:00 heroku [web.1]:错误R14(超出内存配额)
2012-01-26T08:24:43 + 00:00 app [web.1]:
2012-01-26T08:24:43 + 00:00 app [web.1]:
2012-01-26T08:24:43 + 00:00 app [ web.1]:开始PUT/ mobile_users / 1for 103.1.165.23 at 2012-01-26 08:24:43 +0000
2012-01-26T08:24:43 + 00:00 heroku [router ]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1 queue = 0 wait = 0ms service = 544ms status = 401 bytes = 27
2012-01-26T08:24:43 + 00:00 app [web.1]:Oink操作:mobile_users#update
2012-01-26T08:24:43 + 00:00 app [web.1]:内存使用情况:288876 | PID:19
2012-01-26T08:24:43 + 00:00 app [web.1]:实例化细分:总计:0
2012-01-26T08:24:43 + 00:00 app [web.1]:Oink日志输入完成
2012-01-26T08:24:43 + 00:00 app [web.1]:cache:[PUT / mobile_users / 1] invalidate,pass
2012-01-26T08:24:47 + 00:00 app [web.1]:
2012-01-26T08:24:47 + 00:00 app [web.1]:
2012 -01-26T08:24:47 + 00:00 app [web.1]:开始PUT/ mobile_users / 1为103.1.165.23于2012-01-26 08:24:47 +0000
2012- 01-26T08:24:48 + 00:00 app [web.1]:Oink动作:mobile_users#update
2012-01-26T08:24:48 + 00:00 app [web.1]:内存使用:286412 | PID:16
2012-01-26T08:24:48 + 00:00 app [web.1]:Instantiation Breakdown:Total:2 | MobileUser:2
2012-01-26T08:24:48 + 00:00 app [web.1]:Oink日志条目完成
2012-01-26T08:24:48 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1队列= 0等待= 0ms服务= 432ms状态= 200字节= 1
2012-01-26T08:24:48 + 00:00 app [web.1]:cache:[PUT / mobile_users / 1] invalidate,pass
2012-01-26T08:24:59 + 00:00 heroku [web.1]:进程运行mem = 537M(104.9 %)
2012-01-26T08:24:59 + 00:00 heroku [web.1]:错误R14(超出内存配额)
2012-01-26T08:25:20 + 00:00 heroku [web.1]:进程运行mem = 537M(104.9%)
2012-01-26T08:25:20 + 00:00 heroku [web.1]:错误R14(超出内存配额)
2012-01-26T08:25:41 + 00:00 heroku [web.1]:进程运行内存= 537M(104.9%)
2012-01-26T08:25:41 + 00:00 heroku [web .1]:错误R14(超过内存配额)
2012-01-26T08:26:32 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1队列= 0 wait = 0ms service = 34ms status = 401 bytes = 27
2012-01-26T08:27:04 + 00:00 app [web.1]:
20 12-01-26T08:27:04 + 00:00 app [web.1]:
2012-01-26T08:27:04 + 00:00 app [web.1]:开始PUT/ mobile_users / 1for 103.1.165.23 at 2012-01-26 08:27:04 +0000
2012-01-26T08:27:04 + 00:00 app [web.1]:Oink操作:mobile_users#update
2012-01-26T08:27:04 + 00:00 app [web.1]:内存使用情况:288876 | PID:19
2012-01-26T08:27:04 + 00:00 app [web.1]:Instantiation Breakdown:Total:2 | MobileUser:2
2012-01-26T08:27:04 + 00:00 app [web.1]:Oink日志条目完成
2012-01-26T08:27:04 + 00:00 app [ web.1]:cache:[PUT / mobile_users / 1]无效,通过
2012-01-26T08:27:04 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1 queue = 0 wait = 0ms service = 337ms status = 200 bytes = 1
2012-01-26T08:27:05 + 00:00 heroku [web.1]:进程运行mem = 537M(104.9 %)
2012-01-26T08:27:05 + 00:00 heroku [web.1]:错误R14(超出内存配额)
2012-01-26T08:27:26 + 00:00 heroku [web.1]:进程运行mem = 537M(104.9%)
2012-01-26T08:27:26 + 00:00 heroku [web.1]:错误R14(超出内存配额)
2012-01-26T08:27:48 + 00:00 heroku [web.1]:进程运行内存= 537M(104.9%)
2012-01-26T08:27:48 + 00:00 heroku [web .1]:错误R14(超出内存配额)
2012-01-26T08:28:08 + 00:00 heroku [web.1]:进程运行内存= 537M(105.0%)
2012- 01-26T08:28:08 + 00:00 heroku [web.1]:错误R14(超出内存配额)
2012-01-26T08:28:29 + 00:00 heroku [web.1 ]:进程运行mem = 537M(105.0%)
2012-01-26T08:28:29 + 00:00 heroku [web.1]:错误R14(超出内存配额)
2012-01- 26T08:28:51 + 00:00 heroku [web.1]:进程运行mem = 537M(105.0%)
2012-01-26T08:28:51 + 00:00 heroku [web.1]:Error R14(超出内存配额)
2012-01-26T08:29:08 + 00:00 app [web.1]:
2012-01-26T08:29:08 + 00:00 app [web .1]:
2012-01-26T08:29:08 + 00:00 app [web.1]:开始PUT/ mobile_users / 1为85.26.234.218于2012-01-26 08:29: 08 +0000
2012-01-26T08:29:08 + 00:00 app [web.1]:Oink操作:mobile_users#update
2012-01-26T08:29:08 + 00:00应用程序[web.1]:内存使用情况:382404 | PID:13
2012-01-26T08:29:08 + 00:00 app [web.1]:实例化细分:总计:0
2012-01-26T08:29:08 + 00:00 app [web.1]:Oink日志输入完成
2012-01-26T08:29:08 + 00:00 app [web.1]:cache:[PUT / mobile_users / 1] invalidate,pass
2012-01-26T08:29:08 + 00:00 heroku [router]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1 queue = 0 wait = 0ms service = 86ms status = 401 bytes = 27
2012-01-26T08:29:09 + 00:00 app [web.1]:
2012-01-26T08:29:09 + 00:00 app [web.1]:
2012-01-26T08:29:09 + 00:00 app [web.1]:在2012-01-26 08:29:09 +0000
开始PUT/ mobile_users / 1for 85.26.234.218 2012-01-26T08:29:09 + 00:00 app [web.1]:Oink动作:mobile_users#update
2012-01-26T08:29:09 + 00:00 app [web.1]:内存使用情况:382404 | PID:13
2012-01-26T08:29:09 + 00:00 app [web.1]:Instantiation Breakdown:Total:2 | MobileUser:2
2012-01-26T08:29:09 + 00:00 app [web.1]:Oink日志输入完成
2012-01-26T08:29:09 + 00:00 app [ web.1]:cache:[PUT / mobile_users / 1]无效,通过
2012-01-26T08:29:09 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1 queue = 0 wait = 0ms service = 160ms status = 200 bytes = 1
2012-01-26T08:29:11 + 00:00 app [web.1]:
2012-01 -26T08:29:11 + 00:00 app [web.1]:
2012-01-26T08:29:11 + 00:00 app [web.1]:开始PUT/ mobile_users / 1 85.26.234.218 at 2012-01-26 08:29:11 +0000
2012-01-26T08:29:11 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1 queue = 0 wait = 0ms service = 101ms status = 401 bytes = 27
2012-01-26T08:29:11 + 00:00 app [web.1]:Oink动作:mobile_users#update
2012-01-26T08:29:11 + 00:00 app [web.1]:内存使用情况:382404 | PID:13
2012-01-26T08:29:11 + 00:00 app [web.1]:实例化细分:总计:0
2012-01-26T08:29:11 + 00:00 app [web.1]:Oink日志条目完成
2012-01-26T08:29:11 + 00:00 app [web.1]:cache:[PUT / mobile_users / 1] invalidate,pass
2012-01-26T08:29:12 + 00:00 app [web.1]:
2012-01-26T08:29:12 + 00:00 app [web.1]:
2012 -01-26T08:29:12 + 00:00 app [web.1]:85.26.234.218于2012-01-26 08:29:12 +0000
开始PUT/ mobile_users / 12012- 01-26T08:29:12 + 00:00 heroku [web.1]:进程运行mem = 537M(105.0%)
2012-01-26T08:29:12 + 00:00 heroku [web.1] :错误R14(超出内存配额)
2012-01-26T08:29:12 + 00:00应用程序[web.1]:Oink操作:mobile_users#update
2012-01-26T08:29: 12 + 00:00应用程序[web.1]:内存使用情况:288876 | PID:19
2012-01-26T08:29:12 + 00:00 app [web.1]:Instantiation Breakdown:Total:2 | MobileUser:2
2012-01-26T08:29:12 + 00:00 app [web.1]:Oink日志输入完成
2012-01-26T08:29:12 + 00:00 app [ web.1]:cache:[PUT / mobile_users / 1]无效,通过
2012-01-26T08:29:12 + 00:00 heroku [路由器]:PUT prizequiz.herokuapp.com/mobile_users/1 dyno = web.1 queue = 0 wait = 0ms service = 169ms status = 200 bytes = 1
2012-01-26T08:29:33 + 00:00 heroku [web.1]:进程运行mem = 537M(105.0 %)
2012-01-26T08:29:33 + 00:00 heroku [web.1]:错误R14(超过内存配额)

我不知道除了Heroku认为我是
以外,看起来没有那么多的内存。内存使用情况:288876 vs Process running mem = 537M( 105.0%)

解决方案

我有这个问题..使用find_in_batches解决。



如果有人仍然有这个错误,我会把代码放在这里。
由于需要很长时间才能运行,我找到了一个可以帮助用户的progress_bar gem。将它放在这里,因为我认为它在几乎所有情况下都是强制性的。

  bar = ProgressBar.new(total)
Texto.find_in_batches(:batch_size => 100)do | textos |
textos.each {| texto |
... do_stuff ...
}
bar.increment! textos.size
结束

进度条:
https://github.com/paul/progress_bar/issues


I have a Rails 3.1 app on Heroku. I am seeing a lot of these errors:

Error R14 (Memory quota exceeded)

Typically the preceding log entry is showing:

Process running mem=522M(102.1%)

This does vary a little but never by much and can occur after almost any URL request, so it's not related to a specific controller action as far as I can tell.

This is a classic block of log entries:

2012-01-16T02:35:57+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=55ms status=401 bytes=27
2012-01-16T02:35:58+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=155ms status=200 bytes=1
2012-01-16T02:36:02+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=13ms status=401 bytes=27
2012-01-16T02:36:02+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=147ms status=200 bytes=1
2012-01-16T02:36:09+00:00 heroku[router]: POST prizequiz.herokuapp.com/mobile_users dyno=web.1 queue=0 wait=0ms service=87ms status=201 bytes=624
2012-01-16T02:36:11+00:00 heroku[router]: GET prizequiz.herokuapp.com/quizzes/1/questions dyno=web.1 queue=0 wait=0ms service=5ms status=401 bytes=27
2012-01-16T02:36:11+00:00 heroku[router]: GET prizequiz.herokuapp.com/quizzes/1/questions dyno=web.1 queue=0 wait=0ms service=290ms status=200 bytes=81412
2012-01-16T02:36:15+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=10ms status=401 bytes=27
2012-01-16T02:36:16+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=67ms status=200 bytes=1
2012-01-16T02:36:33+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=10ms status=401 bytes=27
2012-01-16T02:36:33+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=132ms status=201 bytes=230
2012-01-16T02:36:55+00:00 heroku[web.1]: Process running mem=522M(102.1%)
2012-01-16T02:36:55+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-16T02:37:17+00:00 app[web.1]: 
2012-01-16T02:37:17+00:00 app[web.1]: 
2012-01-16T02:37:17+00:00 app[web.1]: Started POST "/quizzes/1/scores" for 177.53.80.25 at 2012-01-16 02:37:17 +0000
2012-01-16T02:37:17+00:00 app[web.1]: cache: [POST /quizzes/1/scores] invalidate, pass
2012-01-16T02:37:17+00:00 app[web.1]: 
2012-01-16T02:37:17+00:00 app[web.1]: 
2012-01-16T02:37:17+00:00 app[web.1]: Started POST "/quizzes/1/scores" for 177.53.80.25 at 2012-01-16 02:37:17 +0000
2012-01-16T02:37:17+00:00 app[web.1]: cache: [POST /quizzes/1/scores] invalidate, pass
2012-01-16T02:37:17+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=44ms status=201 bytes=230
2012-01-16T02:37:17+00:00 heroku[web.1]: Process running mem=522M(102.1%)
2012-01-16T02:37:17+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-16T02:37:17+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=16ms status=401 bytes=27
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: Started GET "/quizzes/1/scores/current_game" for 177.53.80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20+00:00 app[web.1]: cache: [GET /quizzes/1/scores/current_game] miss
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: Started GET "/quizzes/1/scores/current_game" for 177.53.80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20+00:00 heroku[router]: GET prizequiz.herokuapp.com/quizzes/1/scores/current_game dyno=web.1 queue=0 wait=0ms service=8ms status=401 bytes=27
2012-01-16T02:37:20+00:00 app[web.1]: cache: [GET /quizzes/1/scores/current_game] miss
2012-01-16T02:37:20+00:00 heroku[router]: GET prizequiz.herokuapp.com/quizzes/1/scores/current_game dyno=web.1 queue=0 wait=0ms service=6ms status=401 bytes=27
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: Started POST "/quizzes/1/scores" for 177.53.80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20+00:00 heroku[router]: POST prizequiz.herokuapp.com/quizzes/1/scores dyno=web.1 queue=0 wait=0ms service=33ms status=401 bytes=27
2012-01-16T02:37:20+00:00 app[web.1]: cache: [POST /quizzes/1/scores] invalidate, pass
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: Started GET "/quizzes/1/scores/current_game" for 177.53.80.25 at 2012-01-16 02:37:20 +0000
2012-01-16T02:37:20+00:00 app[web.1]: 
2012-01-16T02:37:20+00:00 app[web.1]: 

I have New Relic installed but have been unable to identify anything of any use.

Will gladly supply more info if needed. I also have an outstanding support request on Heroku for this but as yet (2 days marked as urgent) I have had no response.

Adding web dynos makes no difference.

UPDATE, I have added the oink gem and this is a sample result

2012-01-26T08:24:25+00:00 app[web.1]: 
2012-01-26T08:24:25+00:00 app[web.1]: 
2012-01-26T08:24:25+00:00 app[web.1]: Started PUT "/mobile_users/1" for 110.49.234.219 at 2012-01-26 08:24:25 +0000
2012-01-26T08:24:26+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:24:26+00:00 app[web.1]: Memory usage: 286276 | PID: 16
2012-01-26T08:24:26+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:24:26+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:24:26+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:24:26+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=460ms status=200 bytes=1
2012-01-26T08:24:38+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:24:38+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:24:43+00:00 app[web.1]: 
2012-01-26T08:24:43+00:00 app[web.1]: 
2012-01-26T08:24:43+00:00 app[web.1]: Started PUT "/mobile_users/1" for 103.1.165.23 at 2012-01-26 08:24:43 +0000
2012-01-26T08:24:43+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=544ms status=401 bytes=27
2012-01-26T08:24:43+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:24:43+00:00 app[web.1]: Memory usage: 288876 | PID: 19
2012-01-26T08:24:43+00:00 app[web.1]: Instantiation Breakdown: Total: 0
2012-01-26T08:24:43+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:24:43+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:24:47+00:00 app[web.1]: 
2012-01-26T08:24:47+00:00 app[web.1]: 
2012-01-26T08:24:47+00:00 app[web.1]: Started PUT "/mobile_users/1" for 103.1.165.23 at 2012-01-26 08:24:47 +0000
2012-01-26T08:24:48+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:24:48+00:00 app[web.1]: Memory usage: 286412 | PID: 16
2012-01-26T08:24:48+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:24:48+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:24:48+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=432ms status=200 bytes=1
2012-01-26T08:24:48+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:24:59+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:24:59+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:25:20+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:25:20+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:25:41+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:25:41+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:26:32+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=34ms status=401 bytes=27
2012-01-26T08:27:04+00:00 app[web.1]: 
2012-01-26T08:27:04+00:00 app[web.1]: 
2012-01-26T08:27:04+00:00 app[web.1]: Started PUT "/mobile_users/1" for 103.1.165.23 at 2012-01-26 08:27:04 +0000
2012-01-26T08:27:04+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:27:04+00:00 app[web.1]: Memory usage: 288876 | PID: 19
2012-01-26T08:27:04+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:27:04+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:27:04+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:27:04+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=337ms status=200 bytes=1
2012-01-26T08:27:05+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:27:05+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:27:26+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:27:26+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:27:48+00:00 heroku[web.1]: Process running mem=537M(104.9%)
2012-01-26T08:27:48+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:28:08+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:28:08+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:28:29+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:28:29+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:28:51+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:28:51+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:29:08+00:00 app[web.1]: 
2012-01-26T08:29:08+00:00 app[web.1]: 
2012-01-26T08:29:08+00:00 app[web.1]: Started PUT "/mobile_users/1" for 85.26.234.218 at 2012-01-26 08:29:08 +0000
2012-01-26T08:29:08+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:29:08+00:00 app[web.1]: Memory usage: 382404 | PID: 13
2012-01-26T08:29:08+00:00 app[web.1]: Instantiation Breakdown: Total: 0
2012-01-26T08:29:08+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:29:08+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:29:08+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=86ms status=401 bytes=27
2012-01-26T08:29:09+00:00 app[web.1]: 
2012-01-26T08:29:09+00:00 app[web.1]: 
2012-01-26T08:29:09+00:00 app[web.1]: Started PUT "/mobile_users/1" for 85.26.234.218 at 2012-01-26 08:29:09 +0000
2012-01-26T08:29:09+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:29:09+00:00 app[web.1]: Memory usage: 382404 | PID: 13
2012-01-26T08:29:09+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:29:09+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:29:09+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:29:09+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=160ms status=200 bytes=1
2012-01-26T08:29:11+00:00 app[web.1]: 
2012-01-26T08:29:11+00:00 app[web.1]: 
2012-01-26T08:29:11+00:00 app[web.1]: Started PUT "/mobile_users/1" for 85.26.234.218 at 2012-01-26 08:29:11 +0000
2012-01-26T08:29:11+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=101ms status=401 bytes=27
2012-01-26T08:29:11+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:29:11+00:00 app[web.1]: Memory usage: 382404 | PID: 13
2012-01-26T08:29:11+00:00 app[web.1]: Instantiation Breakdown: Total: 0
2012-01-26T08:29:11+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:29:11+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:29:12+00:00 app[web.1]: 
2012-01-26T08:29:12+00:00 app[web.1]: 
2012-01-26T08:29:12+00:00 app[web.1]: Started PUT "/mobile_users/1" for 85.26.234.218 at 2012-01-26 08:29:12 +0000
2012-01-26T08:29:12+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:29:12+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2012-01-26T08:29:12+00:00 app[web.1]: Oink Action: mobile_users#update
2012-01-26T08:29:12+00:00 app[web.1]: Memory usage: 288876 | PID: 19
2012-01-26T08:29:12+00:00 app[web.1]: Instantiation Breakdown: Total: 2 | MobileUser: 2
2012-01-26T08:29:12+00:00 app[web.1]: Oink Log Entry Complete
2012-01-26T08:29:12+00:00 app[web.1]: cache: [PUT /mobile_users/1] invalidate, pass
2012-01-26T08:29:12+00:00 heroku[router]: PUT prizequiz.herokuapp.com/mobile_users/1 dyno=web.1 queue=0 wait=0ms service=169ms status=200 bytes=1
2012-01-26T08:29:33+00:00 heroku[web.1]: Process running mem=537M(105.0%)
2012-01-26T08:29:33+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

I have no idea what that proves other than it seems I am not using as much memory as Heroku thinks I am Memory usage: 288876 vs Process running mem=537M(105.0%)

解决方案

I had this problem .. to solved using find_in_batches.

If someone still has this error i will put the code here. As it takes long time to run, i found a progress_bar gem that help the user. will let it here too cause i think its mandatory in almost every case.

bar = ProgressBar.new( total )
Texto.find_in_batches(:batch_size => 100) do |textos|
    textos.each{| texto | 
        ...do_stuff...
    }
    bar.increment! textos.size
end

Progress Bar: https://github.com/paul/progress_bar/issues

这篇关于Heroku错误R14(超出内存配额):我如何解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆