timo 770 2.0 0.1 219016 13520 ? Ss Jan19 4233:48 /usr/bin/python /data/apps/opt/nginx/sbin/dyups_nginx.py root 848 0.0 0.1 778708 14112 ? Ss Jan19 0:02 nginx: master process /data/apps/opt/nginx/sbin/nginx timo 16002 0.8 4.5 1010392 348068 ? S May11 443:28 nginx: worker process timo 16004 4.2 16.4 2114232 1268584 ? S May11 2132:53 nginx: worker process timo 16005 2.4 15.2 2077140 1179936 ? S May11 1223:14 nginx: worker process timo 26205 7.2 3.2 997208 253672 ? S 15:50 0:56 nginx: worker process
Jun 15 15:50:35 ugp-nginx-server1 kernel: Out of memory: Kill process 16003 (nginx) score 139 or sacrifice child Jun 15 15:50:35 ugp-nginx-server1 kernel: Killed process 16003 (nginx) total-vm:2070420kB, anon-rss:972728kB, file-rss:64kB, shmem-rss:102480kB
$ ll -tr -rw-r--r-- 1 timo timo 3195026 May 19 12:00 rest2-31786-log.log.2021-05-19-11.gz -rw-r--r-- 1 timo timo 1874155 May 19 12:00 rest2-31786-error.log.2021-05-19-11.gz -rw-r--r-- 1 timo timo 1040719 May 19 13:00 rest2-31786-log.log.2021-05-19-12.gz -rw-r--r-- 1 timo timo 8416 May 19 13:01 rest2-31786-error.log.2021-05-19-12.gz -rw-r--r-- 1 timo timo 1076004 May 19 14:00 rest2-31786-log.log.2021-05-19-13.gz -rw-r--r-- 1 timo timo 7012 May 19 14:02 rest2-31786-error.log.2021-05-19-13.gz -rw-r--r-- 1 timo timo 4300585 May 19 14:19 rest2-31786-log.log -rw-r--r-- 1 timo timo 157327 May 19 14:19 rest2-31786-error.log -rw-r--r-- 1 timo timo 4141677 May 19 14:19 rest2-31786-gc-log.log.3.current
那如何解决这个问题呢?
在nginx的upstream里有相应的共享zone的配置。
1 2 3 4 5 6
Syntax: zone name [size]; Default: — Context: upstream This directive appeared in version 1.9.0.
Defines the name and size of the shared memory zone that keeps the group’s configuration and run-time state that are shared between worker processes. Several groups may share the same zone. In this case, it is enough to specify the size only once.