laravel JOB_TOO_BIG Pheanstalk - 可以做什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29199302/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JOB_TOO_BIG Pheanstalk - what can be done?
提问by commandantp
On Laravel 4.2 & Laravel Forge
在 Laravel 4.2 和 Laravel Forge 上
I Made a mistake and accidentally pushed some code on to the production sever, but there was a bug and it pushed a job to the queue without deleting it once done. Now I can't push anything in the queue anymore, I get:
我犯了一个错误,不小心将一些代码推送到了生产服务器,但是有一个错误,它将作业推送到队列中,而一旦完成就没有删除它。现在我不能再在队列中推送任何东西了,我得到:
Pheanstalk_Exception JOB_TOO_BIG: job data exceeds server-enforced limit
Pheanstalk_Exception JOB_TOO_BIG:作业数据超出服务器强制限制
What can I do?
我能做什么?
回答by HPage
You can increase the max job size with the -z option for Beanstalkd: http://linux.die.net/man/1/beanstalkd
您可以使用 Beanstalkd 的 -z 选项增加最大作业大小:http: //linux.die.net/man/1/beanstalkd
To do this on Forge you need to SSH into the server and edit the /etc/default/beanstalkd
file.
要在 Forge 上执行此操作,您需要通过 SSH 连接到服务器并编辑/etc/default/beanstalkd
文件。
Add the following line (or uncomment the existing BEANSTALKD_EXTRA line and edit it):
BEANSTALKD_EXTRA="-z 524280"
添加以下行(或取消注释现有的 BEANSTALKD_EXTRA 行并对其进行编辑):
BEANSTALKD_EXTRA="-z 524280"
Restart beanstalkd after making the change:
sudo service beanstalkd restart
更改后重新启动 beanstalkd:
sudo service beanstalkd restart
The size should be specified in bytes.
大小应以字节为单位指定。
I am not sure if this could have serious performance effects - so far, so good for me. I would appreciate any comments on performance.
我不确定这是否会产生严重的性能影响 - 到目前为止,对我来说很好。我将不胜感激任何对性能的评论。
回答by Wader
This is because you're trying to store too much data in the queue itself. Try to cut down the data you're pushing to the queue.
这是因为您试图在队列本身中存储太多数据。尝试减少您推入队列的数据。
For example if your queue job involves using models, just pass the model ID into the queue and as part of the job fetch them from the database, rather than passing the queue the entire model instance.
例如,如果您的队列作业涉及使用模型,只需将模型 ID 传递到队列中,并作为作业的一部分从数据库中获取它们,而不是将整个模型实例传递给队列。
If you're using eloquent models, they're automatically handled in this way.
如果您使用的是 eloquent 模型,它们会以这种方式自动处理。