老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

怎么加大mysql內(nèi)存 mysql占多大內(nèi)存

mysql耗內(nèi)存嗎?應(yīng)該怎么處理?

mysql耗內(nèi)存嗎?很多人都說MySQL占用了很大的虛擬內(nèi)存,那么這個問題應(yīng)該怎么解決呢?下面是我收集整理的一些方法,現(xiàn)在分享給大家!

成都創(chuàng)新互聯(lián)公司于2013年創(chuàng)立,先為澄海等服務(wù)建站,澄海等地企業(yè),進行企業(yè)商務(wù)咨詢服務(wù)。為澄海企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

解決mysql耗內(nèi)存的具體方法一:

在分析的過程中發(fā)現(xiàn)最耗內(nèi)存的是MySQL,其中近1GB的內(nèi)存被它吞了,而且不在任務(wù)管理器體現(xiàn)出來。這個數(shù)據(jù)庫軟件是EMS要用到了,所以必須要運行。這個軟件在安裝的時候會根據(jù)機器的實際內(nèi)存自動進行配置,PC機物理內(nèi)存越多,它默認(rèn)占有的內(nèi)存就越多,難怪3GB的內(nèi)存被它給吞了近1GB。

優(yōu)化方法:

1. 退出EMS clientserver

2. 在CMD里運行:net stop mysql

3. 找到MySQL\MySQL Server的安裝目錄,里面有個my.ini文件,參考附件的配置對參數(shù)query_cache_size tmp_table_size myisam_sort_buffer_size key_buffer_size innodb_buffer_pool_size進行修改,注意不要改動innodb_log_file_size,修改前備份my.ini

4. 在CMD里運行:net start mysql,如果提示成功,則說明修改的參數(shù)沒有什么問題,如果失敗,重新調(diào)整一下上面的參數(shù)

5. 找到EMS 安裝目錄runGUI.bat runServer.bat腳本,找到-Xmx700m,改為-Xmx256m,注意修改前備份這兩個文件,感謝Liping Sun提供幫助

6. 重新運行EMS

前后對比,對于3GB的PC,發(fā)現(xiàn)可以節(jié)省近1GB的內(nèi)存。對于2GB的PC,也可以節(jié)省600-800MB。優(yōu)化后發(fā)現(xiàn)EMS啟動稍微慢一些,但是其它的軟件運行速度提高了很多,不在經(jīng)常出現(xiàn)卡機現(xiàn)象了。如果在運行過程中發(fā)現(xiàn)EMS特別慢的話,自己也可以適當(dāng)放大上面提到的一些參數(shù)。

my.ini

# MySQL Server Instance Configuration File

# ----------------------------------------------------------------------

# Generated by the MySQL Server Instance Configuration Wizard

#

#

# Installation Instructions

# ----------------------------------------------------------------------

#

# On Linux you can copy this file to /etc/my.cnf to set global options,

# mysql-data-dir/my.cnf to set server-specific options

# (@localstatedir@ for this installation) or to

# ~/.my.cnf to set user-specific options.

#

# On Windows you should keep this file in the installation directory

# of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To

# make sure the server reads the config file use the startup option

# "--defaults-file".

#

# To run run the server from the command line, execute this in a

# command line shell, e.g.

# mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"

#

# To install the server as a Windows service manually, execute this in a

# command line shell, e.g.

# mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini"

#

# And then execute this in a command line shell to start the server, e.g.

# net start MySQLXY

#

#

# Guildlines for editing this file

# ----------------------------------------------------------------------

#

# In this file, you can use all long options that the program supports.

# If you want to know the options a program supports, start the program

# with the "--help" option.

#

# More detailed information about the individual options can also be

# found in the manual.

#

#

# CLIENT SECTION

# ----------------------------------------------------------------------

#

# The following options will be read by MySQL client applications.

# Note that only client applications shipped by MySQL are guaranteed

# to read this section. If you want your own MySQL client program to

# honor these values, you need to specify it as an option during the

# MySQL client library initialization.

#

[client]

port=3306

[mysql]

default-character-set=utf8

# SERVER SECTION

# ----------------------------------------------------------------------

#

# The following options will be read by the MySQL Server. Make sure that

# you have installed the server correctly (see above) so it reads this

# file.

#

[mysqld]

# The TCP/IP Port the MySQL Server will listen on

port=3306

#Path to installation directory. All paths are usually resolved relative to this.

basedir="D:/Program Files/MySQL/MySQL Server 5.1/"

#Path to the database root

datadir="C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/"

# The default character set that will be used when a new schema or table is

# created and no character set is defined

character-set-server=utf8

# The default storage engine that will be used when create new tables when

default-storage-engine=INNODB

# Set the SQL mode to strict

sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

# The maximum amount of concurrent sessions the MySQL server will

# allow. One of these connections will be reserved for a user with

# SUPER privileges to allow the administrator to login even if the

# connection limit has been reached.

max_connections=1510

# Query cache is used to cache SELECT results and later return them

# without actual executing the same query once again. Having the query

# cache enabled may result in significant speed improvements, if your

# have a lot of identical queries and rarely changing tables. See the

# "Qcache_lowmem_prunes" status variable to check if the current value

# is high enough for your load.

# Note: In case your tables change very often or if your queries are

# textually different every time, the query cache may result in a

# slowdown instead of a performance improvement.

query_cache_size=16M

# The number of open tables for all threads. Increasing this value

# increases the number of file descriptors that mysqld requires.

# Therefore you have to make sure to set the amount of open files

# allowed to at least 4096 in the variable "open-files-limit" in

# section [mysqld_safe]

table_cache=3020

# Maximum size for internal (in-memory) temporary tables. If a table

# grows larger than this value, it is automatically converted to disk

# based table This limitation is for a single table. There can be many

# of them.

tmp_table_size=4M

# How many threads we should keep in a cache for reuse. When a client

# disconnects, the client's threads are put in the cache if there aren't

# more than thread_cache_size threads from before. This greatly reduces

# the amount of thread creations needed if you have a lot of new

# connections. (Normally this doesn't give a notable performance

# improvement if you have a good thread implementation.)

thread_cache_size=64

#*** MyISAM Specific options

# The maximum size of the temporary file MySQL is allowed to use while

# recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.

# If the file-size would be bigger than this, the index will be created

# through the key cache (which is slower).

myisam_max_sort_file_size=100G

# If the temporary file used for fast index creation would be bigger

# than using the key cache by the amount specified here, then prefer the

# key cache method. This is mainly used to force long character keys in

# large tables to use the slower key cache method to create the index.

myisam_sort_buffer_size=4M

# Size of the Key Buffer, used to cache index blocks for MyISAM tables.

# Do not set it larger than 30% of your available memory, as some memory

# is also required by the OS to cache rows. Even if you're not using

# MyISAM tables, you should still set it to 8-64M as it will also be

# used for internal temporary disk tables.

key_buffer_size=16M

# Size of the buffer used for doing full table scans of MyISAM tables.

# Allocated per thread, if a full scan is needed.

read_buffer_size=64K

read_rnd_buffer_size=256K

# This buffer is allocated when MySQL needs to rebuild the index in

# REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE

# into an empty table. It is allocated per thread so be careful with

# large settings.

sort_buffer_size=256K

#*** INNODB Specific options ***

# Use this option if you have a MySQL server with InnoDB support enabled

# but you do not plan to use it. This will save memory and disk space

# and speed up some things.

#skip-innodb

# Additional memory pool that is used by InnoDB to store metadata

# information. If InnoDB requires more memory for this purpose it will

# start to allocate it from the OS. As this is fast enough on most

# recent operating systems, you normally do not need to change this

# value. SHOW INNODB STATUS will display the current amount used.

innodb_additional_mem_pool_size=9M

# If set to 1, InnoDB will flush (fsync) the transaction logs to the

# disk at each commit, which offers full ACID behavior. If you are

# willing to compromise this safety, and you are running small

# transactions, you may set this to 0 or 2 to reduce disk I/O to the

# logs. Value 0 means that the log is only written to the log file and

# the log file flushed to disk approximately once per second. Value 2

# means the log is written to the log file at each commit, but the log

# file is only flushed to disk approximately once per second.

innodb_flush_log_at_trx_commit=1

# The size of the buffer InnoDB uses for buffering log data. As soon as

# it is full, InnoDB will have to flush it to disk. As it is flushed

# once per second anyway, it does not make sense to have it very large

# (even with long transactions).

innodb_log_buffer_size=5M

# InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and

# row data. The bigger you set this the less disk I/O is needed to

# access data in tables. On a dedicated database server you may set this

# parameter up to 80% of the machine physical memory size. Do not set it

# too large, though, because competition of the physical memory may

# cause paging in the operating system. Note that on 32bit systems you

# might be limited to 2-3.5G of user level memory per process, so do not

# set it too high.

innodb_buffer_pool_size=32M

# Size of each log file in a log group. You should set the combined size

# of log files to about 25%-100% of your buffer pool size to avoid

# unneeded buffer pool flush activity on log file overwrite. However,

# note that a larger logfile size will increase the time needed for the

# recovery process.

innodb_log_file_size=88M

# Number of threads allowed inside the InnoDB kernel. The optimal value

# depends highly on the application, hardware as well as the OS

# scheduler properties. A too high value may lead to thread thrashing.

innodb_thread_concurrency=8

   解決mysql耗內(nèi)存的具體方法二:

更改后如下:

innodb_buffer_pool_size=576M -256M InnoDB引擎緩沖區(qū)占了大頭,首要就是拿它開刀

query_cache_size=100M -16M 查詢緩存

tmp_table_size=102M -64M 臨時表大小

key_buffer_size=256m -32M

重啟mysql服務(wù)后,虛擬內(nèi)存降到200以下.

另外mysql安裝目錄下有幾個文件:my-huge.ini 、my-large.ini、my-medium.ini...這幾個是根據(jù)內(nèi)存大小作的建議配置,新手在設(shè)置的時候也可以參考一下。

2G內(nèi)存的MYSQL數(shù)據(jù)庫服務(wù)器 my.ini優(yōu)化 (my.ini)

2G內(nèi)存,針對站少,優(yōu)質(zhì)型的設(shè)置,試驗特:

table_cache=1024 物理內(nèi)存越大,設(shè)置就越大.默認(rèn)為2402,調(diào)到512-1024最佳

innodb_additional_mem_pool_size=8M 默認(rèn)為2M

innodb_flush_log_at_trx_commit=0 等到innodb_log_buffer_size列隊滿后再統(tǒng)一儲存,默認(rèn)為1

innodb_log_buffer_size=4M 默認(rèn)為1M

innodb_thread_concurrency=8 你的服務(wù)器CPU有幾個就設(shè)置為幾,默認(rèn)為8

key_buffer_size=256M 默認(rèn)為218 調(diào)到128最佳

tmp_table_size=64M 默認(rèn)為16M 調(diào)到64-256最掛

read_buffer_size=4M 默認(rèn)為64K

read_rnd_buffer_size=16M 默認(rèn)為256K

sort_buffer_size=32M 默認(rèn)為256K

max_connections=1024 默認(rèn)為1210

試驗一:

table_cache=512或1024

innodb_additional_mem_pool_size=2M

innodb_flush_log_at_trx_commit=0

innodb_log_buffer_size=1M

innodb_thread_concurrency=8 你的服務(wù)器CPU有幾個就設(shè)置為幾,默認(rèn)為8

key_buffer_size=128M

tmp_table_size=128M

read_buffer_size=64K或128K

read_rnd_buffer_size=256K

sort_buffer_size=512K

max_connections=1024

試驗二:

table_cache=512或1024

innodb_additional_mem_pool_size=8M

innodb_flush_log_at_trx_commit=0

innodb_log_buffer_size=4M

innodb_thread_concurrency=8

key_buffer_size=128M

tmp_table_size=128M

read_buffer_size=4M

read_rnd_buffer_size=16M

sort_buffer_size=32M

max_connections=1024

一般:

table_cache=512

innodb_additional_mem_pool_size=8M

innodb_flush_log_at_trx_commit=0

innodb_log_buffer_size=4M

innodb_thread_concurrency=8

key_buffer_size=128M

tmp_table_size=128M

read_buffer_size=4M

read_rnd_buffer_size=16M

sort_buffer_size=32M

max_connections=1024

經(jīng)過測試.沒有特殊情況,最好還是用默認(rèn)的.

2G內(nèi)存,針對站多,抗壓型的設(shè)置,最佳:

table_cache=1024 物理內(nèi)存越大,設(shè)置就越大.默認(rèn)為2402,調(diào)到512-1024最佳

innodb_additional_mem_pool_size=4M 默認(rèn)為2M

innodb_flush_log_at_trx_commit=1

(設(shè)置為0就是等到innodb_log_buffer_size列隊滿后再統(tǒng)一儲存,默認(rèn)為1)

innodb_log_buffer_size=2M 默認(rèn)為1M

innodb_thread_concurrency=8 你的服務(wù)器CPU有幾個就設(shè)置為幾,建議用默認(rèn)一般為8

key_buffer_size=256M 默認(rèn)為218 調(diào)到128最佳

tmp_table_size=64M 默認(rèn)為16M 調(diào)到64-256最掛

read_buffer_size=4M 默認(rèn)為64K

read_rnd_buffer_size=16M 默認(rèn)為256K

sort_buffer_size=32M 默認(rèn)為256K

max_connections=1024 默認(rèn)為1210

thread_cache_size=120 默認(rèn)為60

query_cache_size=64M

優(yōu)化mysql數(shù)據(jù)庫性能的十個參數(shù)

(1)、max_connections:

允許的同時客戶的數(shù)量。增加該值增加 mysqld 要求的文件描述符的數(shù)量。這個數(shù)字應(yīng)該增加,否則,你將經(jīng)常看到 too many connections 錯誤。 默認(rèn)數(shù)值是100,我把它改為1024 。

(2)、record_buffer:

每個進行一個順序掃描的線程為其掃描的每張表分配這個大小的一個緩沖區(qū)。如果你做很多順序掃描,你可能想要增加該值。默認(rèn)數(shù)值是131072(128k),我把它改為16773120 (16m)

(3)、key_buffer_size:

索引塊是緩沖的并且被所有的線程共享。key_buffer_size是用于索引塊的緩沖區(qū)大小,增加它可得到更好處理的索引(對所有讀和多重寫),到你能負(fù)擔(dān)得起那樣多。如果你使它太大,系統(tǒng)將開始換頁并且真的變慢了。默認(rèn)數(shù)值是8388600(8m),我的mysql主機有2gb內(nèi)存,所以我把它改為 402649088(400mb)。

4)、back_log:

要求 mysql 能有的連接數(shù)量。當(dāng)主要mysql線程在一個很短時間內(nèi)得到非常多的連接請求,這就起作用,然后主線程花些時間(盡管很短)檢查連接并且啟動一個新線程。

back_log 值指出在mysql暫時停止回答新請求之前的短時間內(nèi)多少個請求可以被存在堆棧中。只有如果期望在一個短時間內(nèi)有很多連接,你需要增加它,換句話說,這值對到來的tcp/ip連接的偵聽隊列的大小。你的操作系統(tǒng)在這個隊列大小上有它自己的限制。試圖設(shè)定back_log高于你的操作系統(tǒng)的限制將是無效的。

當(dāng)你觀察你的主機進程列表,發(fā)現(xiàn)大量 264084 | unauthenticated user | xxx.xxx.xxx.xxx | null | connect | null | login | null 的待連接進程時,就要加大 back_log 的值了。默認(rèn)數(shù)值是50,我把它改為500。

(5)、interactive_timeout:

服務(wù)器在關(guān)閉它前在一個交互連接上等待行動的秒數(shù)。一個交互的客戶被定義為對 mysql_real_connect()使用 client_interactive 選項的客戶。 默認(rèn)數(shù)值是28800,我把它改為7200。

(6)、sort_buffer:

每個需要進行排序的線程分配該大小的一個緩沖區(qū)。增加這值加速order by或group by操作。默認(rèn)數(shù)值是2097144(2m),我把它改為 16777208 (16m)。

(7)、table_cache:

為所有線程打開表的數(shù)量。增加該值能增加mysqld要求的文件描述符的數(shù)量。mysql對每個唯一打開的表需要2個文件描述符。默認(rèn)數(shù)值是64,我把它改為512。

(8)、thread_cache_size:

可以復(fù)用的保存在中的線程的數(shù)量。如果有,新的線程從緩存中取得,當(dāng)斷開連接的時候如果有空間,客戶的線置在緩存中。如果有很多新的線程,為了提高性能可以這個變量值。通過比較 connections 和 threads_created 狀態(tài)的變量,可以看到這個變量的作用。我把它設(shè)置為 80。

(9)mysql的搜索功能

用mysql進行搜索,目的是能不分大小寫,又能用中文進行搜索

只需起動mysqld時指定 --default-character-set=gb2312

(10)、wait_timeout:

服務(wù)器在關(guān)閉它之前在一個連接上等待行動的秒數(shù)。 默認(rèn)數(shù)值是28800,我把它改為7200。

注:參數(shù)的調(diào)整可以通過修改 /etc/my.cnf 文件并重啟 mysql 實現(xiàn)。這是一個比較謹(jǐn)慎的工作,上面的結(jié)果也僅僅是我的一些看法,你可以根據(jù)你自己主機的硬件情況(特別是內(nèi)存大小)進一步修改。

如何增大 MYSQL 內(nèi)存

查看 /proc/meminfo

Tips:

“大內(nèi)存頁”也稱傳統(tǒng)大頁、大頁內(nèi)存等有助于 Linux 進行虛擬內(nèi)存的管理,標(biāo)準(zhǔn)的內(nèi)存頁為 4KB,這里使用“大內(nèi)存頁”最大可以定義 1GB 的頁面大小,在系統(tǒng)啟動期間可以使用“大內(nèi)存頁”為應(yīng)用程序預(yù)留一部分內(nèi)存,這部分內(nèi)存被占用且永遠不會被交換出內(nèi)存,它會一直保留在那里,直到改變配置。(詳細(xì)介紹請看下面鏈接官方解釋)

那么這么大頁內(nèi)存是分配給誰的呢?

查詢一下:

shell /proc/sys/vm/hugetlb_shm_group

27

shell id 27

uid=27(mysql) gid=27(mysql) groups=27(mysql)

hugetlb_shm_group 文件里填的是指定大頁內(nèi)存使用的用戶組 id,這里查看到是 MySQL 組 id,那既然是給 MySQL 的為什么 free 等于 total,并且 mysql 還只有 20 多 G 實際使用內(nèi)存呢?

原來在 MySQL 中還有專門啟用大內(nèi)存頁的參數(shù),在 MySQL 大內(nèi)存頁稱為 large page。

查看 MySQL 配置文件

發(fā)現(xiàn)配置文件中確實有 large-page 配置,但出于禁用狀態(tài)。

后與業(yè)務(wù)確認(rèn),很早之前確實啟用過 mysql 的 large page,不過后面禁用了。排查到這基本就有了結(jié)論。

結(jié)論

這套環(huán)境之前開啟了 20000 的大內(nèi)存頁,每頁大小為 2MB,占用了 40G 內(nèi)存空間,給 MySQL 使用,并且 MySQL 開啟了 large page,但后來不使用的時候,只關(guān)閉了 MySQL 端的 large page 參數(shù),但沒有實際更改主機的關(guān)于大內(nèi)存頁的配置,所以導(dǎo)致,實際上主機上的還存在 20000 的大內(nèi)存頁,并且沒在使用,這一部分長期空閑,并且其他程序不能使用。

所以 MySQL 在使用 20G 內(nèi)存左右,整個主機內(nèi)存就飽和了,然后在部分條件下,就觸發(fā)了 OOM,導(dǎo)致 mysqld 被 kill,但主機上又有 mysqld_safe 守護程序,所以又再次給拉起來,就看到了文章初的偶爾連接不上的現(xiàn)象。

MySQL 內(nèi)存占用總是太高,你需要立即進行這些操作……

生產(chǎn)環(huán)境中,MySQL 不經(jīng)意間吃掉全部的內(nèi)容,然后開始吃掉 SWAP,性能一降再降,怎么辦?

可以從下面三點查看原因:

MySQL 使用內(nèi)存,有兩個途徑。

永久占用的內(nèi)容

比如全局緩沖區(qū)(Global Buffer)類別,是在服務(wù)器啟動期間從操作系統(tǒng)獲得的,不會釋放到任何一個別的進程。

動態(tài)請求的內(nèi)存

線程緩沖區(qū)由MySQL使用,它是在處理新查詢時從操作系統(tǒng)請求的內(nèi)存。在執(zhí)行查詢之后,該內(nèi)存被釋放回操作系統(tǒng)。

這意味著 MySQL 的內(nèi)存使用,是 全局緩沖區(qū) 加上 線程緩沖區(qū) 以及 允許的最大連接數(shù) 。

對于專用數(shù)據(jù)庫服務(wù)器,該值需要保持在服務(wù)器內(nèi)存的90%以下。在共享服務(wù)器的情況下,它應(yīng)該保持在服務(wù)器內(nèi)存的50%以下。

檢查一下 MySQL 設(shè)置,有助于確定內(nèi)存使用情況,從而為 MySQL 分配合適的值。

一個近似的公式:

當(dāng)網(wǎng)站受到攻擊時,有可能在短時間內(nèi)建立異常高的連接數(shù)量。MySQL 中的 PROCESSLIST 可用于檢測頂級用戶并阻止對濫用連接的訪問。

找出查詢需要很長時間才能執(zhí)行的語句,因為這些查詢需要進一步優(yōu)化服務(wù)器才能更好地執(zhí)行,可以通過服務(wù)器查詢?nèi)罩具M行識別。由于查詢速度慢,導(dǎo)致磁盤讀取較多,導(dǎo)致內(nèi)存和CPU使用率較高,影響服務(wù)器性能。

最后,到了加內(nèi)存條的時候了。雖然在優(yōu)化數(shù)據(jù)庫設(shè)置之后,服務(wù)器會不斷地路由到使用交換內(nèi)存,但也必須增加內(nèi)存。俗話說:“巧婦難為無米之炊”,就是這個意思。

上面說的這些方向,大家可以在實際操作中驗證體會,希望大家在數(shù)據(jù)庫優(yōu)化的路上,麻溜順暢,砥礪前行。

linux 下怎么優(yōu)化mysql占用內(nèi)存?

修改mysql配置文件,優(yōu)化緩存大小和連接數(shù)連接方式,優(yōu)化sql語句 ,記得mysql好像是有工具可以查看最占用資源的sql語句,找到他,優(yōu)化他。

安裝好mysql后,配制文件應(yīng)該在/usr/local/mysql/share/mysql目錄中,配制文件有幾個,有my-huge.cnf my-medium.cnf my-large.cnf my-small.cnf,不同的流量的網(wǎng)站和不同配制的服務(wù)器環(huán)境,當(dāng)然需要有不同的配制文件了。

一般的情況下,my-medium.cnf這個配制文件就能滿足我們的大多需要;一般我們會把配置文件拷貝到/etc/my.cnf 只需要修改這個配置文件就可以了,使用mysqladmin variables extended-status _u root _p 可以看到目前的參數(shù),有3個配置參數(shù)是最重要的,即key_buffer_size,query_cache_size,table_cache。

key_buffer_size只對MyISAM表起作用,

key_buffer_size指定索引緩沖區(qū)的大小,它決定索引處理的速度,尤其是索引讀的速度。一般我們設(shè)為16M,實際上稍微大一點的站點 這個數(shù)字是遠遠不夠的,通過檢查狀態(tài)值Key_read_requests和Key_reads,可以知道key_buffer_size設(shè)置是否合理。比例 key_reads / key_read_requests應(yīng)該盡可能的低,至少是1:100,1:1000更好(上述狀態(tài)值可以使用SHOW STATUS LIKE ‘key_read%’獲得)。 或者如果你裝了phpmyadmin 可以通過服務(wù)器運行狀態(tài)看到,筆者推薦用phpmyadmin管理mysql,以下的狀態(tài)值都是本人通過phpmyadmin獲得的實例分析:

這個服務(wù)器已經(jīng)運行了20天

key_buffer_size _ 128M

key_read_requests _ 650759289

key_reads - 79112

比例接近1:8000 健康狀況非常好

MYSQL怎么更改內(nèi)存表容量

Linux 進程通過 C 標(biāo)準(zhǔn)庫中的內(nèi)存分配函數(shù) malloc 向系統(tǒng)申請內(nèi)存,但是到真正與內(nèi)核交互之間,其實還隔了一層,即內(nèi)存分配管理器(memory allocator)。常見的內(nèi)存分配器包括:ptmalloc(Glibc)、tcmalloc(Google)、jemalloc(FreeBSD)。MySQL 默認(rèn)使用的是 glibc 的 ptmalloc 作為內(nèi)存分配器。

內(nèi)存分配器采用的是內(nèi)存池的管理方式,處在用戶程序?qū)雍蛢?nèi)核層之間,它響應(yīng)用戶的分配請求,向操作系統(tǒng)申請內(nèi)存,然后將其返回給用戶程序。

為了保持高效的分配,分配器通常會預(yù)先向操作系統(tǒng)申請一塊內(nèi)存,當(dāng)用戶程序申請和釋放內(nèi)存的時候,分配器會將這些內(nèi)存管理起來,并通過一些算法策略來判斷是否將其返回給操作系統(tǒng)。這樣做的最大好處就是可以避免用戶程序頻繁的調(diào)用系統(tǒng)來進行內(nèi)存分配,使用戶程序在內(nèi)存使用上更加高效快捷。

關(guān)于 ptmalloc 的內(nèi)存分配原理,個人也不是非常了解,這里就不班門弄斧了,有興趣的同學(xué)可以去看下華庭的《glibc 內(nèi)存管理 ptmalloc 源代碼分析》【文末鏈接】。

關(guān)于如何選擇這三種內(nèi)存分配器,網(wǎng)上資料大多都是推薦摒棄 glibc 原生的 ptmalloc,而改用 jemalloc 或者 tcmalloc 作為默認(rèn)分配器。因為 ptmalloc 的主要問題其實是內(nèi)存浪費、內(nèi)存碎片、以及加鎖導(dǎo)致的性能問題,而 jemalloc 與 tcmalloc 對于內(nèi)存碎片、多線程處理優(yōu)化的更好。

目前 jemalloc 應(yīng)用于 Firefox、FaceBook 等,并且是 MariaDB、Redis、Tengine 默認(rèn)推薦的內(nèi)存分配器,而 tcmalloc 則應(yīng)用于 WebKit、Chrome 等。


名稱欄目:怎么加大mysql內(nèi)存 mysql占多大內(nèi)存
文章鏈接:http://www.xueling.net.cn/article/docjecd.html

其他資訊

在線咨詢
服務(wù)熱線
服務(wù)熱線:028-86922220
TOP
主站蜘蛛池模板: 久久久久久久久久久久久久久伊免 | 国产人妻人伦精品熟女 | 日本免费一级淫片a级中文字幕 | 亚洲阿v天堂在线 | 浴室洗澡偷拍一区二区 | www.国产一区二区三区 | 麻豆国产VA免费精品高清在线 | 日韩欧美中文字幕视频 | 蜜桃www视频高清在线观看 | 日本女人一区二区 | 越做高潮越喷奶水视频 | 一本色道综合久久亚洲精品 | 亚洲AV无码成人网站在线观看 | 成人一级黄色毛片 | 人禽杂交18禁网站免费 | 久久精品影片 | 久久精品无码免费不卡 | 日本大片在线观看 | 久久综合另类激情人妖 | 亚洲AV乱码专区国产乱码 | 手机a级毛片免费观看 | 岳的好大精品一区二区三区 | 日韩人妻中文无码一区二区 | 91看片视频 | 久久精品久久久久久久久久久久久 | 亚洲成人国产精品 | 亚洲美女视频在线 | 欧美日韩国产人妻无码 | 久色视频| 国产A级毛片久久影院 | 中文精品久久久久鬼色 | 久久九九国产精品怡红院 | 欧美肥老太交性视频免费 | 在线色站| 欧美高潮又爽又黄又硬又无遮 | 欧美综合在线观看视频 | 91精品国产色综合久久不卡98口 | 亚洲综合AV一区二区三区不卡 | 日韩在线观看成人 | 中文字幕亚洲无线码 | 好吊妞www.84com只有这里才有精品 |