Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to optimize CentOS6.X character set

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to optimize the CentOS6.X character set". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Recently doing php-fpm memory optimization, run the command

Pmap $(pgrep php-fpm | head-n 1)

Found that a large 99m file was loaded into the memory.

/ usr/lib/locale/locale-archive

This file is about language support, including various languages and character set support by default. The server uses a character interface, so you don't need so much at all. En_US.UTF-8 is enough, at most, add a Chinese zh_CN.

Streamlining method

# View language support list

Localedef-list-archive

# streamlining locale

Cd / usr/lib/locale/

Mv locale-archive locale-archive.old

Localedef-I en_US-f UTF-8 en_US.UTF-8

# add Chinese support (optional)

Localedef-I zh_CN-f UTF-8 zh_CN.UTF-8

Localedef-I zh_CN-f GB2312 zh_CN

Localedef-I zh_CN-f GB2312 zh_CN.GB2312

Localedef-I zh_CN-f GBK zh_CN.GBK

# the following are also optional and can enrich Chinese support (Hong Kong / Taiwan / Singapore)

Localedef-f UTF-8-I zh_HK zh_HK.UTF-8

Localedef-f UTF-8-I zh_TW zh_TW.UTF-8

Localedef-f UTF-8-I zh_SG zh_SG.UTF-8

Streamlined results

# pmap $(pgrep php-fpm | head-n 1) | grep local

00007f3d906d1000 1500K rMurmuri-/ usr/lib/locale/locale-archive

It becomes 1.5m. If you add basic Chinese support, it is 5m.

On the other hand, if you are afraid of affecting other services, it is safer to delete languages other than Chinese and English. The solution is as follows:

Localedef-- list-archive | egrep-v ^ "en_US | zh" | xargs localedef-- delete-from-archive

Mv-f / usr/lib/locale/locale-archive / usr/lib/locale/locale-archive.tmpl

Build-locale-archive

In this way, the file will be reduced to 10m.

# du locale-archive

10892 locale-archive

This is the end of "how to optimize the CentOS6.X character set". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report