全球主机交流论坛

标题: nginx高手进来看看这个神马情况? linode768内存, [打印本页]

作者: leozhang    时间: 2012-1-20 20:58
标题: nginx高手进来看看这个神马情况? linode768内存,
本帖最后由 leozhang 于 2012-1-25 10:39 编辑

nginx 服务器,跑的PHP 商城, linode 768的方案, 经常load一下就上来,CPU也上来, 好象很有规律的. 站基本没有流量, 一个月5%都用不完, 一天30,50个IP的, 不知道怎么回事,经常会突然就起来

补充一下,我还装了个Wordpress,是不是这个东东在搞鬼.

tuningprimer 测试结果:

   -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.0.84 i686

Uptime = 0 days 0 hrs 5 min 28 sec
Avg. qps = 77
Total Questions = 25387
Threads Connected = 1

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 0 out of 25408 that take longer than 10 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 4
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 400
Current threads_connected = 2
Historic max_used_connections = 6
The number of used connections is 1% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 132 M
Current InnoDB data space = 232 M
Current InnoDB buffer pool free = 91 %
Current innodb_buffer_pool_size = 640 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 854 M
Configured Max Per-thread Buffers : 4.02 G
Configured Max Global Buffers : 792 M
Configured Max Memory Limit : 4.80 G
Physical Memory : 750 M

Max memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 2 M
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 134
Key buffer free ratio = 88 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 128 M
Current query_cache_used = 9 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 7.38 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 4 M
Current read_rnd_buffer_size = 2 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 2000 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 64 tables
You have a total of 447 tables
You have 64 open tables.
Current table_cache hit rate is 3%
, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 128 M
Of 3036 temp tables, 6% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 4 M
Current table scan ratio = 6 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 26776
Your table locking seems to be fine

附上: 现在my.cnf的配置:


innodb_buffer_pool_size=640M
innodb_additional_mem_pool=16M
max_allowed_packet=64M
sort_buffer_size=4M
read_buffer_size=4M
read_rnd_buffer_size=2M
myisam_sort_buffer_size=64M
tmp_table_size=128M
thread_cache_size=8
query_cache_size=128M
query_cache_type=1
max_connections=400
wait_timeout=300

作者: cnweb    时间: 2012-1-20 20:58
流量很大??
作者: leozhang    时间: 2012-1-20 21:01
站基本没有流量, 一个月5%都用不完, 一天30,50个IP的, 不知道怎么回事,经常会突然就起来
作者: leozhang    时间: 2012-1-20 21:01
本帖最后由 leozhang 于 2012-1-20 21:02 编辑
qiedan0521 发表于 2012-1-20 21:00
一有访问就上去了?
动态的大数据处理的慢?


有可能, 运行的是magento,有点吃内存.如此说来还是要优化MYSQL? 每次我看LOAD比较高的时候,MYSQL进程占CPU都很多.
作者: leozhang    时间: 2012-1-20 21:02
cnweb 发表于 2012-1-20 20:58
流量很大??

一天40个IP就不错了,哪有流量
作者: pmalc    时间: 2012-1-20 21:04
magento...... community版的性能实在成问题
作者: leozhang    时间: 2012-1-20 21:07
pmalc 发表于 2012-1-20 21:04
magento...... community版的性能实在成问题

主要是不会优化,如果把没用的MODULE全停掉,也不会太慢的.
作者: leozhang    时间: 2012-1-20 21:07
360111697 发表于 2012-1-20 21:05
从不用nginx处理动态

我用768装AP更悲催
作者: leozhang    时间: 2012-1-20 21:13
刚看了下, MYSQL占 %MEM 是最大的.
作者: Kvm    时间: 2012-1-20 21:19
nginx重来不处理动态
作者: wdlth    时间: 2012-1-20 21:20
MySQL用innoDB,用优化工具看参数够不够。
nginx和MySQL加上加google-perftools,耗内存增加性能。
作者: leozhang    时间: 2012-1-20 21:21
Kvm 发表于 2012-1-20 21:19
nginx重来不处理动态

你的意思是搞成AP?
作者: leozhang    时间: 2012-1-20 21:22
Kvm 发表于 2012-1-20 21:19
nginx重来不处理动态

我原来弄了个brust的便宜VPS, 装NGINX还能跑,AP直接卡死
作者: leozhang    时间: 2012-1-20 21:27
wdlth 发表于 2012-1-20 21:20
MySQL用innoDB,用优化工具看参数够不够。
nginx和MySQL加上加google-perftools,耗内存增加性能。 ...

我再去看看innoDB的参数,这个用哪个工具可以看呢? google-perftools?
作者: wdlth    时间: 2012-1-20 21:32
leozhang 发表于 2012-1-20 21:27
我再去看看innoDB的参数,这个用哪个工具可以看呢? google-perftools?

http://www.day32.com/MySQL/tuning-primer.sh
这个工具可以检测你的MySQL参数设置是否恰当,这类工具很多。
google-perftools是编译软件时加进去的。
作者: leozhang    时间: 2012-1-20 21:44
wdlth 发表于 2012-1-20 21:32
http://www.day32.com/MySQL/tuning-primer.sh
这个工具可以检测你的MySQL参数设置是否恰当,这类工具很 ...

弄下来了,不知道怎么用呢....小白了...
作者: wdlth    时间: 2012-1-20 21:47
leozhang 发表于 2012-1-20 21:44
弄下来了,不知道怎么用呢....小白了...

搜 tuning-primer.sh ,就有很多资料。
不过还是看官方文档认清参数比较好。
作者: leozhang    时间: 2012-1-25 09:51
是不是应该找个高手来优化下呢
作者: 汉陈帝国    时间: 2012-1-25 09:59
阿帕奇处理动态 ngx处理静态
作者: leozhang    时间: 2012-1-25 10:13
wdlth 发表于 2012-1-20 21:47
搜 tuning-primer.sh ,就有很多资料。
不过还是看官方文档认清参数比较好。

   -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.0.84 i686

Uptime = 0 days 0 hrs 5 min 28 sec
Avg. qps = 77
Total Questions = 25387
Threads Connected = 1

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 0 out of 25408 that take longer than 10 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 4
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 400
Current threads_connected = 2
Historic max_used_connections = 6
The number of used connections is 1% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 132 M
Current InnoDB data space = 232 M
Current InnoDB buffer pool free = 91 %
Current innodb_buffer_pool_size = 640 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 854 M
Configured Max Per-thread Buffers : 4.02 G
Configured Max Global Buffers : 792 M
Configured Max Memory Limit : 4.80 G
Physical Memory : 750 M

Max memory limit exceeds 90% of physical memory

KEY BUFFER
Current MyISAM index space = 2 M
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 134
Key buffer free ratio = 88 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 128 M
Current query_cache_used = 9 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 7.38 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 4 M
Current read_rnd_buffer_size = 2 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 2000 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 64 tables
You have a total of 447 tables
You have 64 open tables.
Current table_cache hit rate is 3%
, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 128 M
Of 3036 temp tables, 6% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 4 M
Current table scan ratio = 6 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 26776
Your table locking seems to be fine
  tuning-primer的结果出来了,4核的XEN, 768内存.
作者: wdlth    时间: 2012-1-25 13:27
leozhang 发表于 2012-1-25 10:13
-- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

把慢查询日志启用,把table_cache加大。
作者: Kokgog    时间: 2012-1-25 13:39
360111697 发表于 2012-1-20 21:05
从不用nginx处理动态

nginx也从来不处理动态..........
作者: leozhang    时间: 2012-1-25 17:41
本帖最后由 leozhang 于 2012-1-25 17:42 编辑
4806569 发表于 2012-1-25 13:45
1G的linode,两个magento,IP每天5000多,暂时压力不大~嘿嘿


同道呀,用什么跑的? AP还是nginx load能稳在多少? 超过0.5不?
作者: leozhang    时间: 2012-1-25 17:48
4806569 发表于 2012-1-25 13:45
1G的linode,两个magento,IP每天5000多,暂时压力不大~嘿嘿

啥时候我才能五千多IP呀,,,晕...
作者: leozhang    时间: 2012-1-27 10:49
4806569 发表于 2012-1-26 20:18
不到0.5
就LNMP得环境.
gap中国也是这环境,当然他们服务器多,促销时也挂过,呵呵.没啥问题的.apache老矣 ...

lnmp的安装包,我一直装不上magento
不知道怎么回事,能把你的MYSQL的配置发来参考下不,我觉得我的MYSQL配置 肯定有问题,
作者: Zeddicus    时间: 2012-1-27 11:34
不会优化惹得祸
作者: yexinzhu    时间: 2012-1-27 11:39
你用的程序比较耗资源把。
作者: PPS    时间: 2012-1-27 11:44
Kokgog 发表于 2012-1-25 13:39
nginx也从来不处理动态..........

nginx也从来不处理动态,确实如此,nginx本身并不能支持php,支持php的是php-fpm,以fastcgi形式运行
作者: leozhang    时间: 2012-1-27 20:59
4806569 发表于 2012-1-27 19:00
我不是用的一键安装包,现在要出去打牌,晚上回来我加你QQ,你把你QQ号PM我

已PM,,打牌,哈哈,我好久没搓了...
作者: leozhang    时间: 2012-1-27 20:59
4806569 发表于 2012-1-27 19:00
我不是用的一键安装包,现在要出去打牌,晚上回来我加你QQ,你把你QQ号PM我

已PM,,打牌,哈哈,我好久没搓了...
作者: leozhang    时间: 2012-1-27 21:00
yexinzhu 发表于 2012-1-27 11:39
你用的程序比较耗资源把。

相当耗
作者: leozhang    时间: 2012-1-27 21:01
PPS 发表于 2012-1-27 11:44
nginx也从来不处理动态,确实如此,nginx本身并不能支持php,支持php的是php-fpm,以fastcgi形式运行 ...

是的, 不过装过AP,然后也装了NGINX,发现还是NGINX跑得快点





欢迎光临 全球主机交流论坛 (https://loc.wget.at/) Powered by Discuz! X3.4