GateWayworker 内存占用大

weoweo520

我阿里云 1核1G1M的主机 ,

在没有开启 workerman前 内存情况如下:

# free -m
             total       used       free     shared    buffers     cached
Mem:           994        438        556          0         21        185
-/+ buffers/cache:        231        763
Swap:         1023          0       1023

free 是 556M

开启后 如下:

Workerman start in DAEMON mode
----------------------- WORKERMAN -----------------------------
Workerman version:3.2.5          PHP version:5.6.99-hhvm
------------------------ WORKERS -------------------------------
user          worker            listen                    processes status
root          MsBusinessWorker  none                       3          
root          MspGateway        Websocket://0.0.0.0:8282   4          
root          Register          text://0.0.0.0:1238        1          
----------------------------------------------------------------
Input "php start.php stop" to quit. Start success.
free -m
             total       used       free     shared    buffers     cached
Mem:           994        839        155          0         21        186
-/+ buffers/cache:        631        363
Swap:         1023          0       1023

free 是 155M

也就是说 gateway 用去我401M内存?

再看一下 具体使用情况:

ps aux|head -1;ps aux|grep -v PID|sort -rn -k +4|head
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www       1861  0.0 14.3 775732 146448 ?       Sl   14:02   0:00 /usr/bin/hhvm --mode server --user www --config /etc/hhvm/server.ini --config /etc/hhvm/php.ini --config /etc/hhvm/config.hdf
root      2705  2.8  6.7 768776 68588 ?        S    14:43   0:00 hhvm start.php start -d
root      2700  3.3  6.7 768776 68628 ?        S    14:43   0:00 hhvm start.php start -d
root      2699  3.3  6.7 768776 68628 ?        S    14:43   0:00 hhvm start.php start -d
root      2698  3.5  6.7 768776 68624 ?        S    14:43   0:00 hhvm start.php start -d
root      2704  3.3  6.5 768776 66752 ?        S    14:43   0:00 hhvm start.php start -d
root      2703  3.3  6.5 768776 66752 ?        S    14:43   0:00 hhvm start.php start -d
root      2702  3.3  6.5 768776 66732 ?        S    14:43   0:00 hhvm start.php start -d
root      2701  3.5  6.5 768776 66732 ?        S    14:43   0:00 hhvm start.php start -d
root      2683  1.8  6.4 768776 66188 ?        S    14:43   0:00 hhvm start.php start -d

为什么一下开了这么多进程啊? 我手动把bussinesworker 进程 和gatwway 进程类都调低成了 2,3 还是差不多 没有什么改善 。

我想请问 gateway worker 为什么需要这么多的内存?

4124 1 0
1个回答

walkor

你用的是hhvm来运行workerman,并非php。hhvm启动后会占用很多内存,这个和workerman无关。

如果想占用内存少点,请用php来运行workerman。

  • 暂无评论
年代过于久远,无法发表回答
🔝