阿里云VPS:内存512,1核CPU,系统centos5.10,python2.7,django1.84
表数据总共就17000多条,现在添加或修改保存一个数据要10秒以上,django后台打开这个模型列表也要10多秒,mysql性能不会如此差吧,
慢查询日志
#Query_time: 11.691747 Lock_time: 0.000462 Rows_sent: 10 Rows_examined:34194
mysql5.6配置如下
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
pid-file=/var/lib/mysql/mysqld.pid
datadir = /var/lib/mysql/
character_set_server=utf8
collation-server=utf8_general_ci
skip-external-locking
lower_case_table_names=1
max_connections=20
myisam_sort_buffer_size = 8M
key_buffer_size = 96M
max_allowed_packet = 1M
sort_buffer_size = 512k
read_buffer_size = 256k
read_rnd_buffer_size = 512k
net_buffer_length = 2K
innodb_buffer_pool_size = 64M
thread_cache_size = 8
query_cache_type = 1
query_cache_limit = 1M
query_cache_size= 32M
server-id = 1
thread_stack = 64K
slow-query-log=1
long_query_time=1
log_queries_not_using_indexes=on
slow_query_log = on
table_definition_cache=400
table_open_cache=256
performance_schema_max_table_instances=600
explicit_defaults_for_timestamp
innodb=OFF
ignore-builtin-innodb
skip-innodb
default-storage-engine=MYISAM
default-tmp-storage-engine=MYISAM
loose-innodb-trx=0
loose-innodb-locks=0
loose-innodb-lock-waits=0
loose-innodb-cmp=0
loose-innodb-cmp-per-index=0
loose-innodb-cmp-per-index-reset=0
loose-innodb-cmp-reset=0
loose-innodb-cmpmem=0
loose-innodb-cmpmem-reset=0
loose-innodb-buffer-page=0
loose-innodb-buffer-page-lru=0
loose-innodb-buffer-pool-stats=0
loose-innodb-metrics=0
loose-innodb-ft-default-stopword=0
loose-innodb-ft-inserted=0
loose-innodb-ft-deleted=0
loose-innodb-ft-being-deleted=0
loose-innodb-ft-config=0
loose-innodb-ft-index-cache=0
loose-innodb-ft-index-table=0
loose-innodb-sys-tables=0
loose-innodb-sys-tablestats=0
loose-innodb-sys-indexes=0
loose-innodb-sys-columns=0
loose-innodb-sys-fields=0
loose-innodb-sys-foreign=0
loose-innodb-sys-foreign-cols=0
mysql日志
2015-10-26 05:52:01 0 [Note] /usr/sbin/mysqld (mysqld 5.6.26-log) starting as process 14385 ...
2015-10-26 05:52:01 14385 [Warning] ignore-builtin-innodb is ignored and will be removed in future releases.
2015-10-26 05:52:01 14385 [Warning] The option innodb (skip-innodb) is deprecated and will be removed in a future release
2015-10-26 05:52:01 14385 [Warning] The option innodb (skip-innodb) is deprecated and will be removed in a future release
2015-10-26 05:52:01 14385 [Warning] Using unique option prefix innodb-locks instead of innodb-locks-unsafe-for-binlog is deprecated and will be removed in a future release. Please use the full name instead.
2015-10-26 05:52:01 14385 [Warning] Using unique option prefix innodb-cmp instead of innodb-cmp-per-index-enabled is deprecated and will be removed in a future release. Please use the full name instead.
2015-10-26 05:52:01 14385 [Warning] Using unique option prefix innodb-cmp-per-index instead of innodb-cmp-per-index-enabled is deprecated and will be removed in a future release. Please use the full name instead.
2015-10-26 05:52:01 14385 [Note] Plugin 'InnoDB' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_TRX' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_LOCK_WAITS' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_CMP_RESET' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_CMPMEM' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_CMPMEM_RESET' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_CMP_PER_INDEX_RESET' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_BUFFER_PAGE' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_BUFFER_PAGE_LRU' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_BUFFER_POOL_STATS' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_METRICS' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_FT_DEFAULT_STOPWORD' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_FT_DELETED' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_FT_BEING_DELETED' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_FT_CONFIG' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_FT_INDEX_CACHE' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_FT_INDEX_TABLE' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_SYS_TABLES' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_SYS_TABLESTATS' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_SYS_INDEXES' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_SYS_COLUMNS' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_SYS_FIELDS' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_SYS_FOREIGN' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'INNODB_SYS_FOREIGN_COLS' is disabled.
2015-10-26 05:52:01 14385 [Note] Plugin 'FEDERATED' is disabled.
2015-10-26 05:52:01 14385 [Warning] /usr/sbin/mysqld: unknown variable 'loose-innodb-ft-inserted=0'
/usr/sbin/mysqld: Error writing file '/var/lib/mysql/slow.log' (Errcode: 28 - No space left on device)
2015-10-26 05:52:01 14385 [ERROR] Could not open /var/lib/mysql/slow.log for logging (error 28). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
2015-10-26 05:52:01 14385 [Note] Server hostname (bind-address): '*'; port: 3306
2015-10-26 05:52:01 14385 [Note] IPv6 is not available.
2015-10-26 05:52:01 14385 [Note] - '0.0.0.0' resolves to '0.0.0.0';
2015-10-26 05:52:01 14385 [Note] Server socket created on IP: '0.0.0.0'.
2015-10-26 05:52:01 14385 [ERROR] /usr/sbin/mysqld: Error writing file '/var/lib/mysql/mysqld.pid' (Errcode: 28 - No space left on device)
2015-10-26 05:52:01 14385 [ERROR] Can't start server: can't create PID file: No space left on device
151026 05:52:01 mysqld_safe Number of processes running now: 0
磁盘
文件系统 Inode (I)已用 (I)可用 (I)已用% 挂载点
/dev/hda1 5242880 152805 5090075 3% /
tmpfs 63662 1 63661 1% /dev/shm
No space left on device。
内存空间不够了,不是硬盘空间
free -m之后的free空间
我的个人博客也是512m,推荐把buffersize减少,另外,把web服务器用lighhttp或者nginx轻量一些的。
最好写个脚本定期清理下内存的cache/buffer