- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在具有 4 核/8GB RAM 的虚拟机上有一个流量非常小的 WordPress 网站。我注意到该站点的查询有时运行得非常慢,因此通过运行 mysqltuner.pl 脚本进行调查。结果如下:
[OK] Currently running supported MySQL version 10.1.22-MariaDB
[OK] Operating on 64-bit architecture
-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: ./master_error.log(1M)
[OK] Log file ./master_error.log exists
[OK] Log file ./master_error.log is readable.
[OK] Log file ./master_error.log is not empty
[OK] Log file ./master_error.log is smaller than 32 Mb
[!!] ./master_error.log contains 89 warning(s).
[!!] ./master_error.log contains 24 error(s).
[--] 4 start(s) detected in ./master_error.log
[--] 1) 2017-03-24 3:43:22 140281079671040 [Note] /usr/sbin/mysqld: ready for connections.
[--] 2) 2017-03-24 3:41:30 140390495832320 [Note] /usr/sbin/mysqld: ready for connections.
[--] 3) 2017-03-24 3:37:36 139677438822656 [Note] /usr/sbin/mysqld: ready for connections.
[--] 4) 2017-03-03 11:45:32 139685722654976 [Note] /usr/sbin/mysqld: ready for connections.
[--] 3 shutdown(s) detected in ./master_error.log
[--] 1) 2017-03-24 3:42:18 140390132259584 [Note] /usr/sbin/mysqld: Shutdown complete
[--] 2) 2017-03-24 3:40:01 139677360564992 [Note] /usr/sbin/mysqld: Shutdown complete
[--] 3) 2017-03-24 3:37:32 139685358557952 [Note] /usr/sbin/mysqld: Shutdown complete
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE
[--] Data in InnoDB tables: 277M (Tables: 677)
[OK] Total fragmented tables: 0
-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[!!] There is no basic password file list!
-------- CVE Security Recommendations --------------------------------------------------------------
[--] Skipped due to --cvefile option undefined
-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 13d 11h 25m 55s (3M q [2.764 qps], 43K conn, TX: 20G, RX: 451M)
[--] Reads / Writes: 97% / 3%
[--] Binary logging is disabled
[--] Physical Memory : 7.6G
[--] Max MySQL memory : 24.3G
[--] Other process memory: 2.3G
[--] Total buffers: 22.5G global + 12.5M per thread (151 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[!!] Maximum reached memory usage: 22.7G (296.63% of installed RAM)
[!!] Maximum possible memory usage: 24.3G (318.26% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (11K/3M)
[OK] Highest usage of available connections: 10% (16/151)
[OK] Aborted connections: 0.00% (2/43596)
[--] Skipped name resolution test due to skip_networking=ON in system variables.
[!!] Query cache may be disabled by default due to mutex contention.
[OK] Query cache efficiency: 40.2% (1M cached / 4M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (7 temp sorts / 71K sorts)
[OK] No joins without indexes
[!!] Temporary tables created on disk: 51% (44K on disk / 86K total)
[OK] Thread cache hit rate: 99% (23 created / 43K connections)
[OK] Table cache hit rate: 22% (854 open / 3K opened)
[OK] Open file limit used: 0% (60/16K)
[OK] Table locks acquired immediately: 100% (1M immediate / 1M locks)
-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema isn't installed.
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is enabled.
[--] Thread Pool Size: 4 thread(s).
[--] Using default value is good enough for your version (10.1.22-MariaDB)
-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.9% (2B used / 11B cache)
[OK] Key buffer size / total MyISAM indexes: 11.0G/123.0K
[OK] Read Key buffer hit rate: 99.3% (1K cached / 9 reads)
[OK] Write Key buffer hit rate: 100.0% (60 cached / 60 writes)
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[OK] InnoDB buffer pool / data size: 11.0G/278.0M
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (1.77556818181818 %): 100.0M * 2/11.0G should be equal 25%
[!!] InnoDB buffer pool instances: 8
[--] InnoDB Buffer Pool Chunk Size not used or defined in your version
[OK] InnoDB Read buffer efficiency: 100.00% (111655571 hits/ 111658256 total)
[OK] InnoDB Write log efficiency: 97.88% (1070445 hits/ 1093608 total)
[OK] InnoDB log waits: 0.00% (0 waits / 23163 writes)
-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is enabled.
[OK] Aria pagecache size / total Aria indexes: 128.0M/1B
[OK] Aria pagecache hit rate: 97.3% (1M cached / 35K reads)
-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.
-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.
-------- RocksDB Metrics ---------------------------------------------------------------------------
[--] RocksDB is disabled.
-------- Spider Metrics ----------------------------------------------------------------------------
[--] Spider is disabled.
-------- Connect Metrics ---------------------------------------------------------------------------
[--] Connect is disabled.
-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.
-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] This is a standalone server.
-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
Control warning line(s) into ./master_error.log file
Control error line(s) into ./master_error.log file
Reduce your overall MySQL memory footprint for system stability
Dedicate this server to your database for highest performance.
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries which have no LIMIT clause
Performance should be activated for better diagnostics
Consider installing Sys schema from https://github.com/mysql/mysql-sys
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
query_cache_type (=0)
tmp_table_size (> 64M)
max_heap_table_size (> 64M)
performance_schema = ON enable PFS
innodb_log_file_size * innodb_log_files_in_group should be equals to 1/4 of buffer pool size (=5G) if possible.
innodb_buffer_pool_instances(=11)
...这是我的 server.conf:
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[mysqld]
# Connection and Thread variables
socket = /var/lib/mysql/mysql.sock
pid-file=/var/lib/mysql/maria.pid
tmpdir = /run/mariadb
optimizer_search_depth=0
bind-address = 127.0.0.1
skip-external-locking
key_buffer_size = 11G
max_allowed_packet = 1M
table_open_cache = 4000
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 256M
query_cache_limit = 4M
tmp_table_size = 64M
max_heap_table_size = 64M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 2
innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql
innodb_buffer_pool_size = 11G
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 100M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 0
innodb_lock_wait_timeout = 50
innodb_thread_concurrency = 0
innodb_read_io_threads = 64
innodb_write_io_threads = 64
# Security variables
local_infile = 0
secure_auth = 1
sql_mode = TRADITIONAL,NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip_name_resolve = 1
symbolic-links=0
skip-networking
### LOGS ###
# MySQL error log
log_error = master_error.log
log_warnings = 2
# innodb_print_all_deadlocks = 1
# Slow Query Log
slow_query_log_file = master_slow.log
slow_query_log = 1
log_queries_not_using_indexes = 1
long_query_time = 0.5
min_examined_row_limit = 100
# General Query Log
general_log_file = master_general.log
general_log = 0
[mysqldump]
quick
max_allowed_packet = 16M
有些事情看起来显然是错误的,例如 table_open_cache 为 4000,但我想在开始摆弄设置之前看看一些专家是否有一些建议。也很困惑为什么会有如此高的内存使用率,但仍然建议进一步增加值。
最佳答案
mysqltuner 并不完美。但您确实有一些设置对于 8GB RAM 来说确实太高了...
8GB RAM 并且基本上没有 MyISAM 表? key_buffer_size
应该更像 20M,而不是 11G!如果 mysqltuner 人们正在倾听,他们应该修复该测试。
此外,innodb_buffer_pool_size
应该仅为 5G,以避免耗尽 RAM! (并将 innodb_buffer_pool_instances 更改为 5。)
query_cache_size
超过大约 50M 时效率就会降低。
log_queries_not_using_indexes
不必要地使慢日志变得困惑;将其关闭。
Aria - 1B
是一个字节还是十亿字节? (mysqltuner 的另一个错误)。
由于您为 MySQL 过度分配了 RAM,因此它可能正在交换。对于 MySQL 来说,交换非常效率低下,因为它假设所有缓冲区都驻留在 RAM 中。
关于MySql 最大内存过高,仍要求增加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43259441/
我正在寻找一种方法来创建根据价格选择我的产品的过滤器(选择下拉菜单)。 我知道这样的查询是完全可能的: SELECT * FROM products ORDER BY price ASC SELECT
函数参数中或显示尺寸时(高度,宽度)的顺序是否有约定? 最佳答案 我不知道大量的语言,但我使用过的语言(宽度,高度)。它更适合沿着 (x, y) 坐标线。 关于language-agnostic -
在我的表单中,我让用户输入房间的长度高度和宽度以获得 m2、m3 和瓦特的计算值。但是用户也应该能够直接输入 height 和 m2 来获取值。我尝试了很多语法,但 if else 不能正常工作。我知
我在 Elasticsearch 中创建了一个索引,看起来像 {"amazingdocs":{"aliases":{},"mappings":{"properties":{"Adj Close":{"
我有以下功能,我需要清除数据库中的所有图片列并移动到文件系统。当我一次性完成这一切时,内存太多并且会崩溃。我切换到递归函数并执行 20 次写入和批量操作。 我需要为大约 6 个表执行此操作。我的 Re
我正在编写一个函数来计算 PI 的值,并将其作为 double 值返回。到目前为止,一切都很好。但是一旦函数到达小数点后14位,它就不能再保存了。我假设这是因为 double 有限。我应该怎么做才能继
2020年是中国CDN行业从98年诞生到今天快速发展的第二十四年,相关数据显示,全国感知网速持续上扬,达到了3.29兆/秒,标志着在宽带中国的政策指导下,中国的网速水平正在大步赶上世界发达国家的水平
在 aerospike 集合中,我们有四个 bin userId、adId、timestamp、eventype,主键是 userId:timestamp。在 userId 上创建二级索引以获取特定用
$('#container').highcharts('Map', { title : { text : 'Highmaps basic demo'
有没有办法显示自定义宽度/高度的YouTube视频? 最佳答案 在YouTube网站上的this link中: You can resize the player by editing the obj
我使用 Highcharts ,我想在 Highcharts 状态下悬停时制作动态不同的颜色。 正如你可以看到不同的颜色,这就是我做的 var usMapChart , data = [] ; va
在所有节点上运行 tpstats 后。我看到很多节点都有大量的 ALL TIME BLOCKED NTR。我们有一个 4 节点集群,NTR ALL TIME BLOCKED 的值为: 节点 1:239
我发现 APC 上存在大量碎片 (>80%),但实际上性能似乎相当不错。我有 read another post这建议在 wordpress/w3tc 中禁用对象缓存,但我想知道减少碎片是否比首先缓存
对于我的脚本类(class),我们必须制作更高/更低的游戏。到目前为止,这是我的代码: import random seedVal = int(input("What seed should be u
我发现 APC 上存在大量碎片 (>80%),但实际上性能似乎相当不错。我有 read another post这建议在 wordpress/w3tc 中禁用对象缓存,但我想知道减少碎片是否比首先缓存
对于我的脚本类(class),我们必须制作更高/更低的游戏。到目前为止,这是我的代码: import random seedVal = int(input("What seed should be u
我已经 seen >2 字节的 unicode 代码点,如 U+10000 可以成对编写,如 \uD800\uDC00。它们似乎以半字节 d 开头,但我只注意到了这一点。 这个 split Actio
有人可以帮我理解为什么我的饼图百分比计算不正确吗?看截图: 根据我的计算,如 RHS 上所示,支出百分比应为 24.73%。传递给 Highcharts 的值如下:- 花费:204827099.36-
我阅读了有关该问题的所有答案,但我还没有找到任何解决方案。 我有一个应用程序,由我的 api 服务器提供。 Wildfly 8.1 和 Mysql 5.6。当查看时间到来时(Wildfly 服务器连接
我正在用选定的项目创建圆形导航。当用户单击任何项目时,它将移动到定义的特定点。一切都很好,除了当你继续点击项目时,当动画表现不同并且项目在 360 度圆中移动并且它被重置直到你重复场景时,我希望它
我是一名优秀的程序员,十分优秀!