腾讯蓝鲸论坛-专业的技术交流论坛

 找回密码
 立即注册
忘了密码?
搜索
热搜: 用户手册 FAQ
查看: 644|回复: 2

bk-cmdb 请求很耗时 在 web 界面操作感觉很慢

[复制链接]

2

主题

0

好友

18

积分

预备会员

Rank: 1

发表于 2017-6-8 16:29:34 |显示全部楼层
为什么请求那么耗时?有些请求需要 20 秒,是配置有什么不对的吗?
使用的是github上的最新版:https://github.com/Tencent/bk-cmdb.git

下面是 nginx 访问日志,其中 upstream_response_time 是 php 执行时间:
08/Jun/2017:16:19:42 +0800 upstream_response_time: 20.199 GET /index.php s=/host/hostQuery 200
08/Jun/2017:16:19:20 +0800 upstream_response_time: 16.191 POST /index.php s=/topology/modulelist 200
08/Jun/2017:16:17:09 +0800 upstream_response_time: 9.192 POST /index.php s=/host/getHost4QuickImport 200
08/Jun/2017:15:37:25 +0800 upstream_response_time: 8.199 GET /index.php s=/host/quickImport 200
08/Jun/2017:16:11:08 +0800 upstream_response_time: 8.190 GET /index.php s=/host/quickImport 200
08/Jun/2017:16:18:09 +0800 upstream_response_time: 7.193 GET /index.php s=/host/hostQuery 200
08/Jun/2017:15:37:36 +0800 upstream_response_time: 7.187 GET /index.php s=/host/quickImport 200
08/Jun/2017:16:18:25 +0800 upstream_response_time: 5.194 POST /index.php s=/UserCustom/setUserCustom/ 200
08/Jun/2017:16:13:27 +0800 upstream_response_time: 5.174 POST /index.php s=/host/getImportPrivateHostTableFieldsByExcel 200
08/Jun/2017:15:35:30 +0800 upstream_response_time: 5.167 GET /index.php - 200
08/Jun/2017:16:16:23 +0800 upstream_response_time: 5.157 POST /index.php s=/host/getHost4QuickImport 200
08/Jun/2017:16:16:18 +0800 upstream_response_time: 5.155 GET /index.php s=/host/quickImport 200
08/Jun/2017:16:19:53 +0800 upstream_response_time: 5.155 GET /index.php s=/host/getHostById&ApplicationID=2&ModuleID=3&_=1496909982342 200
08/Jun/2017:16:19:58 +0800 upstream_response_time: 5.154 POST /index.php s=/UserCustom/setUserCustom/ 200
08/Jun/2017:15:37:30 +0800 upstream_response_time: 5.152 POST /index.php s=/host/getHost4QuickImport 200
08/Jun/2017:16:17:03 +0800 upstream_response_time: 5.152 POST /index.php s=/host/getHost4QuickImport 200
08/Jun/2017:16:11:14 +0800 upstream_response_time: 5.151 POST /index.php s=/host/getHost4QuickImport 200
08/Jun/2017:15:37:41 +0800 upstream_response_time: 5.150 POST /index.php s=/host/getHost4QuickImport 200
08/Jun/2017:16:11:03 +0800 upstream_response_time: 5.150 POST /index.php s=/host/getHost4QuickImport 200


2

主题

0

好友

18

积分

预备会员

Rank: 1

发表于 2017-6-9 14:03:05 |显示全部楼层
查过 mysql 慢查询日志,也没有慢查询,这究竟是慢在哪里呢?就我一个人遇到这个问题吗?

2

主题

0

好友

18

积分

预备会员

Rank: 1

发表于 2017-6-9 14:17:06 |显示全部楼层
将 session_driver 从 memcached 改为 files 就可以很快了!请开发人员检查一下原因吧!

编辑配置文件:application/config/config.php

这样就很快:
$config['sess_driver'] = 'files';
$config['sess_save_path'] = '/var/lib/php/session';

这样就巨慢:
$config['sess_driver'] = 'memcached';
$config['sess_save_path'] = '127.0.0.1:11211';

相关环境信息如下:
# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

# uname -a
Linux 1-247 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

# php -v
PHP 5.6.30 (cli) (built: Jan 19 2017 22:31:39)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

# php --ri memcached

memcached

memcached support => enabled
Version => 2.2.0
libmemcached version => 1.0.16
SASL support => yes
Session support => yes
igbinary support => yes
json support => yes
msgpack support => no

Directive => Local Value => Master Value
memcached.sess_locking => 1 => 1
memcached.sess_consistent_hash => no value => no value
memcached.sess_binary => no value => no value
memcached.sess_lock_wait => 150000 => 150000
memcached.sess_lock_max_wait => 0 => 0
memcached.sess_lock_expire => 0 => 0
memcached.sess_prefix => memc.sess.key. => memc.sess.key.
memcached.sess_number_of_replicas => 0 => 0
memcached.sess_randomize_replica_read => no value => no value
memcached.sess_remove_failed => 1 => 1
memcached.sess_connect_timeout => 1000 => 1000
memcached.sess_sasl_username => no value => no value
memcached.sess_sasl_password => no value => no value
memcached.compression_type => fastlz => fastlz
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.serializer => igbinary => igbinary
memcached.use_sasl => no value => no value
memcached.store_retry_count => 2 => 2

您需要登录后才可以回帖 登录 | 立即注册

蓝鲸官网

GMT+8, 2018-1-20 17:22

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部