CentOS6.5 Character Set Optimization
These two days just good to do PHP-FPM memory optimization, in the view of PHP-FPM memory usage found locale-archive memory 96 M, the file is language, environment, font-related index files, because many languages are useless, deleting them to squeeze the memory. Any setlocale program will map the locale-archive file to the memory.
Memory usage details
[Root @ AY14070313210045657aZ ~] # Pmap-d 'pidof php-fpm | awk' {print $1} '7124: php-fpm: pool www Address Kbytes ModeOffset devicemapping000000400000 11028 r-x -- 0000000000000000 0ca: 00001 php-fpm00000000010c5000 116 rw --- 0000000000ac5000 0ca: 00001 php-fpm .... omitting 20177f033ea1a00064 r-x -- 0000000000000000 0ca: 00001 libGB. so00007f033ea2a0002044 ----- 0000000000010000 0ca: 00001 libGB. so00007f033ec29000 4 r ---- zookeeper f000 0ca: 00001 libGB. soft-7f033ec2a000 4 rw --- 0000000000010000 0ca: 00001 libGB. so00007f033ec2b00012 r-x -- 0000000000000000 0ca: 00001 EUC-CN.so00007f033ec2e0002044 ----- 0000000000003000 0ca: 00001 EUC-CN.so00007f033ee2d000 4 r ---- 0000000000002000 0ca: 00001 EUC-CN.so00007f033ee2e000 4 rw --- 0000000000003000 0ca: 00001 EUC-CN.so00007f033ee2f000 96832 r ---- 0000000000000000 0ca: 00001 locale-archive00007f0344cbf00048 r-x -- 0000000000000000 0ca: 00001 libnss_files-2.12.so00007f0344ccb0002048 ----- %%%%c000 0ca: 00001 libnss_files-2.12.so00007f0344ecb000 4 r ---- %%%%c000 0ca: 00001 libnss_files-2.12.so00007f0344ecc000 4 rw --- %%%%d000 0ca: 00001 libnss_files-2.12.so00007f0344ecd00028 r-x -- 0000000000000000 0ca: 00001 pdo_mysql.sow.7f0344ed40002044 ----- 0000000000007000 0ca: 00001 pdo_mysql.so00007f03450d3000 4 rw --- 0000000000006000 0ca: 00001 pdo_mysql.so
Make corresponding adjustments (here, consider what the application needs as appropriate)
### Rename the file ### [root @ ipython ~] # Mv/usr/lib/locale-archive/usr/lib/locale/locale-archive.bak ### re-add language support ### [root @ ipython ~] # Localedef-I en_US-f UTF-8 en_US.UTF-8 [root @ ipython ~] # Localedef-I zh_CN-f UTF-8 zh_CN.UTF-8 ### optional Chinese support ### [root @ ipython ~] # Localedef-I zh_CN-f GB2312 zh_CN [root @ ipython ~] # Localedef-I zh_CN-f GB2312 zh_CN.GB2312 [root @ ipython ~] # Localedef-I zh_CN-f GBK zh_CN.GBK ### supported by Fu zhongwen (HK/TW/SG) ### [root @ ipython ~] # Localedef-f UTF-8-I zh_HK zh_HK.UTF-8 [root @ ipython ~] # Localedef-f UTF-8-I zh_TW zh_TW.UTF-8 [root @ ipython ~] # Localedef-f UTF-8-I zh_SG zh_SG.UTF-8 #### restart the server, and then check the use of ### [root @ ipython ~] # Pmap-d 'pidof php-fpm | awk' {print $1} ''| awk'/locale/'20177f38d07170003104 r ---- 0000000000000000 0ca: 00001 locale-archive ### as a result, it will be much smaller. If you need an insurance method, use the following command ### [root @ ipython ~] # Localedef -- list-archive | egrep-v ^ "en_US | zh" | xargs localedef -- delete-from-archive [root @ ipython ~] # Mv-f/usr/lib/locale-archive/usr/lib/locale/locale-archive.bak [root @ ipython ~] # Build-locale-archive