如何限制齿轮人作业服务器内存分配?
问题描述:
如何限制gearman作业服务器的内存分配?似乎Gearman作业服务器不会限制自己的内存使用量。有没有办法限制gearman job server不要超过1G?如何限制齿轮人作业服务器内存分配?
答
你说得对,传动员服务器目前没有限制其内存使用的选项。
然而,这里有两种解决方法:
- 在虚拟机内运行gearmand像Virtualbox。
- 如果您正在运行Linux,请尝试使用
ulimit
命令来限制内存使用情况。
$ ulimit -Sv 1000000
$ gearmand [the rest of your command line parameters]
where:
-S Specifies the soft limit for the given resource
-v Specifies virtual memory allocation, in kbytes
使用ulimit限制内存使用可能会影响虚拟机内的其他应用程序。也许码头工是一个更好的解决方案。但我仍然希望有任何方法来限制gearman服务器自己的内存。 – Kay
仅为运行gearman创建一个单独的用户帐户,并且ulimit应该只影响在该帐户下运行的进程。 –