解决Zend OPcache huge_code_pages: mmap(HUGETLB) failed: Cannot allocate memory报错

前几日看到鸟哥介绍的 《让你的PHP7更快之Hugepage》, 于是想试试手给服务器加上,参照格式安装好扩展,调整好配置文件,然后重启php-fpm,结果启动一直报Zend OPcache huge_code_pages: mmap(HUGETLB) failed: Cannot allocate memory

看字面意思是无法分配内存?怎么会呢,机器内存还是很充足的,这点排查掉了。后面查找相关资料得到,是因为系统Hugepage不够,一般系统Hugepage是没有开启的,可以通过下面命令查看

cat /proc/meminfo | grep Huge
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

HugePages_Total是0,加上就可以了,加上办法

sysctl vm.nr_hugepages=128
cat /proc/meminfo | grep Huge
HugePages_Total:     128
HugePages_Free:      123
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

已经加上了,重启php-fpm,问题解决。

参考文章:

让你的PHP7更快之Hugepage

https://www.geek-share.com/detail/2654715223.html

让PHP7达到最高性能的几个Tips

http://www.laruence.com/2015/12/04/3086.html

Linux下HugePage内存功能配置

https://www.geek-share.com/detail/2633503427.html

原文地址:https://www.cnblogs.com/sohuhome/p/9866327.html

时间: 2024-07-31 10:54:30

解决Zend OPcache huge_code_pages: mmap(HUGETLB) failed: Cannot allocate memory报错的相关文章

解决Failed to allocate memory: 8转

解决Failed to allocate memory: 8 昨天换了x64的Win7,发现在Eclipse上启动模拟器的时候存在问题,当设置的模拟器分辨率大于400×800的时候会出现 Failed to allocate memory: 8This application has requested the Runtime to terminate it in an unusual way.Please contact the application's support team for m

mprotect() failed: Cannot allocate memory

遇到这个问题是在测试项目的性能时发现的,每个对象分配一页大小的空间然后mprotect() 保护起来,当系统分配3W多个页的时候会出现这个问题. google到在一份邮件列表中也曾提到该问题.https://sourceware.org/ml/libc-help/2010-04/msg00026.html 摘抄部分如下: ----------------------------------------------------------------------------------------

Failed to allocate memory: 8

Failed to allocate memory: 8This application has requested the Runtime to terminate it in an unusual way.Please contact the application's support team for more information. 解决办法直接在新建模拟器的时候把它的内存RAM设置在1024以下就可以,最好设置成512 如图:

关于阿里云ESC上go语言项目编译6l: running gcc failed: Cannot allocate memory

前段时间将自己的阿里云服务器上的系统由centos 6.5换为了ubuntu 14,其他的硬件配置都没有发生改变,将服务器上的数据恢复并且重新安装了golang的编译环境后,发现使用go build编译稍微大一点的golang项目就会报错: /usr/local/go/pkg/tool/linux_amd64/6l: running gcc failed: Cannot allocate memory 一直想不通为啥换了个系统就会报这个错,字面意思是gcc分配内存失败,应该是内存不够用,机器配置

Android ADT中增大AVD内存后无法启动:emulator failed to allocate memory 8

过程中,增大对应AVD的内存为2G后,结果无法启动AVD了: [2012-12-18 18:01:38 – Emulator] Failed to allocate memory: 8 [2012-12-18 18:01:38 – Emulator] [2012-12-18 18:01:38 – Emulator] This application has requested the Runtime to terminate it in an unusual way. [2012-12-18 1

Linux Swap故障之 swapoff failed: Cannot allocate memory

swap分区关闭 准备调整Linux下的swap分区的使用率. 在Linux下执行 swapoff -a -v报如下错误: swapoff: /dev/mapper/cryptswap1: swapoff failed: Cannot allocate memory 上述错误原因分析: 从上述的信息可以看出,当前Linux系统把/dev/mapper/cryptswap1这个设备当做了交换分区,如果当前改交换分区使用的容量大于系统当前剩余的内存,就会报这个错误,因为在关闭交换分区的时候,需要把分

安装composer后报错proc_open(): fork failed - Cannot allocate memory

1.问题描述: 在linux服务器使用composer 安装插件时,出现“proc_open(): fork failed - Cannot allocate memory” 也就是提示“提示内存不足”,我们可以通过创建swap分区解决这个问题. 2.解决方法: 先运行 free -m 看下空间是多少 在命令行环境依次运行以下三条命令 dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 mkswap /var/swap.1 swapon /var/sw

fork failed.: Cannot allocate memory

在做压力测试时候: [[email protected] ok]# webbench -c 5000 -t30 http://10.100.0.61/ Webbench - Simple Web Benchmark 1.5 Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software. Benchmarking: GET http://10.100.0.61/ 5000 clients, running 30 sec. Speed=1

解决python中'chromedriver' executable needs to be in PATH报错

在使用python中的selenium模块的时候出现以下错误 解决: 问题是没有Chrome 驱动,那么先下载驱动. 下载之前先查看自己chrome当前的版本信息: 点击chrome浏览器右上角的圆圈标记处,在帮助-->关于Google Chrome(E)中查看浏览器的版本信息 之后打开网址http://npm.taobao.org/mirrors/chromedriver/找到对应的版本,下载并解压到自己想放的路径中. 然后在代码中添加chromedriver文件路径 from seleniu