- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我最近获得了新硬件,但我在使用 mysql 时遇到了问题。它比在旧服务器上慢。当我在新服务器上运行 sysbench 工具时,我得到了这个:
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password= --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 8
Doing OLTP test.
Running mixed OLTP test
Doing read-only test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Threads started!
Time limit exceeded, exiting...
(last message repeated 7 times)
Done.
OLTP test statistics:
queries performed:
read: 365694
write: 0
other: 52242
total: 417936
transactions: 26121 (435.14 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 365694 (6091.93 per sec.)
other operations: 52242 (870.28 per sec.)
Test execution summary:
total time: 60.0293s
total number of events: 26121
total time taken by event execution: 479.9747
per-request statistics:
min: 0.52ms
avg: 18.38ms
max: 117.91ms
approx. 95 percentile: 53.21ms
Threads fairness:
events (avg/stddev): 3265.1250/19.37
execution time (avg/stddev): 59.9968/0.01
旧服务器产生了这个:
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password= --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
sysbench 0.4.12: multi-threaded system evaluation benchmark
No DB drivers specified, using mysql
Running the test with following options:
Number of threads: 8
Doing OLTP test.
Running mixed OLTP test
Doing read-only test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
Using auto_inc on the id column
Threads started!
Time limit exceeded, exiting...
(last message repeated 7 times)
Done.
OLTP test statistics:
queries performed:
read: 952294
write: 0
other: 136042
total: 1088336
transactions: 68021 (1133.58 per sec.)
deadlocks: 0 (0.00 per sec.)
read/write requests: 952294 (15870.18 per sec.)
other operations: 136042 (2267.17 per sec.)
Test execution summary:
total time: 60.0052s
total number of events: 68021
total time taken by event execution: 479.5141
per-request statistics:
min: 3.27ms
avg: 7.05ms
max: 31.63ms
approx. 95 percentile: 8.60ms
Threads fairness:
events (avg/stddev): 8502.6250/11.10
execution time (avg/stddev): 59.9393/0.00
旧服务器有 E3-1230 cpu 和 16GB 内存。新服务器有 E5-1660 v3 和 32GB 内存。操作系统都是 debian wheezy,mysql 版本是 5.5.43。下面是我的.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 256M
key_buffer_size = 256M
sort_buffer_size = 2M
read_rnd_buffer_size = 4M
innodb_buffer_pool_size = 1G
max_allowed_packet = 32M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
max_connections = 300
table_cache = 256M
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 200M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#slow_query_log_file = /var/log/mysql/mysql-slow.log
#slow_query_log = 1
#long_query_time = 2
#log_queries_not_using_indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
有什么想法吗?
最佳答案
query_cache_size = 200M
关闭查询缓存。即使您选择保留它,也不要将大小设置为大于 50M,因为修剪的成本。
table_cache = 256M
哎哟!你不需要 25 亿张 table !!改成几百(无后缀)。
在两台机器上执行此操作,然后比较输出:
SHOW VARIABLES LIKE 'innodb%';
一些默认值随着时间的推移而改变;这应该指出他们。
关于Mysql 糟糕的性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30079057/
我想在这里说的是我在从之前离开的相同状态重新启动我的应用程序时遇到的问题。我在这方面做了很多研发,并且已经解决了 stackoverflow 中发布的问题。所以请不要说它是重复的。 我试过设置这些选项
当我在我的类中实现 __cmp__ 函数时,python 是否会在内部重载“==”,我们在 C++ 中是如何做到的? 只是好奇。我是 python 的新手。 :) 最佳答案 ==的含义当您定义 __c
我在 Raspberry Pi2 上安装了 Gitlab,几个月来它运行良好。但自从关闭了RPi的电源后,它就不再起作用了。网页返回502错误。 502 Whoops, GitLab is takin
有人知道用户登陆带有Webfonts的页面时为什么Google Chrome浏览器崩溃吗 它并不会一直发生,而是经常发生 我刚得到一个蓝屏页面,却不知道为什么:该页面不是来自重定向时就很好了。 这是我
当我登录时,Skype始终会给出此错误。 糟糕,Skype存在问题。尝试注销然后重新登录。 STARTUP_LOAD_ERROR MACBOOK 最佳答案 Macbook 用户 退出Skype 回家
我正在尝试从 flutter 开始,首先我在 cmd 上运行 flutter doctor 它有效。在我安装了 ANDROID SDK 之后,同样的命令 flutter doctor 给了我异常:
从 android studio 终端运行 flutter attach 不工作。显示错误flutter 意外退出。 终端输出: flutter attach Checking for adverti
当使用 TinyMCE 4 测试所有浏览器时,Chrome 非常慢。 (我尝试从 TinyMCE 中删除所有插件,但没有任何区别。) Chrome 需要大约 20-25 秒在 TinyMCE 中呈现一
我试图让下面的脚本工作,以便从远程服务器(服务器 1)读取特定目录中的 CSV 文件列表,并将数据移植到另一台服务器的 PostgreSQL 数据库中。 我已经创建了一个 rsa SSH key 并将
在嵌入式 linux 环境中(在 PowerPC 上定制的 2.4.25)几个小时后我得到以下内核 panic : Oops: kernel access of bad area, sig: 11 N
在将现有 Node.js (Hapi.js) + RethinkDB 从 OVH VPS(最小 vps)迁移到 AWS Lambda( Node )+ DynamoDB 的过程中,我最近遇到了一个非常
我是一名优秀的程序员,十分优秀!