swoole进行性能查看火焰图tideways_xhprof xhgui

D:\dnmp\services\php\Dockerfile
swoole进行性能查看火焰图tideways_xhprof xhgui_第1张图片

D:\dnmp\services\php\php.ini

在php的配置文件里面增加tideways_xhprof拓展:
[xhprof]
;xhprof.output_dir = /var/log/php/xhprof.log

extension=tideways_xhprof.so
在php配置文件里面加上xhgui的header:

这样就能开启所有的项目的日志记录了。但是我们可能不需要,只需要特定的项目,这时候我们可以在xghui里面进行配置:

auto_prepend_file = "/www/vendor/laynefyc/xhgui-chinese/external/header.php"
xhgui 的配置文件里面配置需要记录日志的域名

D:\WWW\vendor\laynefyc\xhgui-chinese\config\config.default.php

    // You can return true to profile every request.
    'profiler.enable' => function() {
        if($_SERVER['SERVER_NAME'] == 'anyu-portal.test'){
            // 100%采样,默认为1%
            return true;
        }else{
            return False;
        }
    },

swoole进行性能查看火焰图tideways_xhprof xhgui_第2张图片

server {
      listen       80;
      server_name php.monitor.com;
      root    /www/vendor/laynefyc/xhgui-chinese/webroot;
      index index.html index.php;
      rewrite_log on;
      location / {
           try_files $uri $uri/ /index.php?$query_string;
      }

      location ~ \.php$ {
          fastcgi_pass   php:9000;
          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          include        fastcgi_params;
      }
}

增加mongodb服务:

docker-compose里面的服务:

 mongodb:
    image: mongo:${MONGODB_VERSION}
    container_name: mongodb
    environment:
        MONGO_INITDB_ROOT_USERNAME: "${MONGODB_INITDB_ROOT_USERNAME}"
        MONGO_INITDB_ROOT_PASSWORD: "${MONGODB_INITDB_ROOT_PASSWORD}"
        TZ: "$TZ"
    volumes:
      - ${DATA_DIR}/mongo:/data/db:rw
      - ${DATA_DIR}/mongo_key:/mongo:rw
    ports:
       - "${MONGODB_HOST_PORT}:27017"
    networks:
       - default
    command:
       --auth

xhgui也需要对应的配置一下服务:

D:\WWW\vendor\laynefyc\xhgui-chinese\config\config.default.php

    'extension' => 'tideways_xhprof',

    // Can be either mongodb or file.
    /*
    'save.handler' => 'file',
    'save.handler.filename' => dirname(__DIR__) . '/cache/' . 'xhgui.data.' . microtime(true) . '_' . substr(md5($url), 0, 6),
    */
    'save.handler' => 'mongodb',

    // Needed for file save handler. Beware of file locking. You can adujst this file path
    // to reduce locking problems (eg uniqid, time ...)
    //'save.handler.filename' => __DIR__.'/../data/xhgui_'.date('Ymd').'.dat',
    'db.host' => 'mongodb://mongodb:27017',
    'db.db' => 'xhprof',

swoole进行性能查看火焰图tideways_xhprof xhgui_第3张图片

http://php.monitor.com/run/view?id=6513dd161727c175bd56ae22

swoole进行性能查看火焰图tideways_xhprof xhgui_第4张图片

swoole进行性能查看火焰图tideways_xhprof xhgui_第5张图片

你可能感兴趣的:(swoole,android,后端)