All Projects → perftools → Xhgui

perftools / Xhgui

Web interface for XHProf profiling data can store data in MongoDB or PDO database

Programming Languages

javascript
184084 projects - #8 most used programming language
PHP
23972 projects - #3 most used programming language
Twig
543 projects
CSS
56736 projects

Projects that are alternatives of or similar to Xhgui

docker-xhgui
An xhgui (with nginx, mongodb and php) container for profiling PHP Applications.
Stars: ✭ 24 (-98.41%)
Mutual labels:  profiler, xhgui
Blog
我的日记
Stars: ✭ 110 (-92.7%)
Mutual labels:  mongodb
Spring Boot 2.x Examples
Spring Boot 2.x code examples
Stars: ✭ 104 (-93.1%)
Mutual labels:  mongodb
Webfluxtemplate
Spring Webflux template application with working Spring Security, Web-sockets, Rest, Web MVC, and Authentication with JWT.
Stars: ✭ 107 (-92.9%)
Mutual labels:  mongodb
Meanstackjs
Mean Stack JS - MongoDB, Express JS, Angular JS & Node JS
Stars: ✭ 104 (-93.1%)
Mutual labels:  mongodb
Play Community
一个基于 Play Framework 开发的开源社区系统。
Stars: ✭ 106 (-92.97%)
Mutual labels:  mongodb
Mongo Php Library
MongoDB PHP library
Stars: ✭ 1,391 (-7.7%)
Mutual labels:  mongodb
Angular Cms
An flexiable, extendable, modular, single CMS app based on Angular, Express, MongoDB
Stars: ✭ 109 (-92.77%)
Mutual labels:  mongodb
Daudit
🌲 Configuration flaws detector for Hadoop, MongoDB, MySQL, and more!
Stars: ✭ 108 (-92.83%)
Mutual labels:  mongodb
Ymate Platform V2
YMP是一个非常简单、易用的轻量级Java应用开发框架,涵盖AOP、IoC、WebMVC、ORM、Validation、Plugin、Serv、Cache等特性,让开发工作像搭积木一样轻松!
Stars: ✭ 106 (-92.97%)
Mutual labels:  mongodb
Mongorito
🍹 MongoDB ODM for Node.js apps based on Redux
Stars: ✭ 1,409 (-6.5%)
Mutual labels:  mongodb
Shoppoint
📢 A mern stack e-commerce app
Stars: ✭ 105 (-93.03%)
Mutual labels:  mongodb
Meteor
Meteor, the JavaScript App Platform
Stars: ✭ 42,739 (+2736.03%)
Mutual labels:  mongodb
Squidex
Headless CMS and Content Managment Hub
Stars: ✭ 1,583 (+5.04%)
Mutual labels:  mongodb
Elepy
Elepy, The Headless Content Management Framework
Stars: ✭ 109 (-92.77%)
Mutual labels:  mongodb
Go To Do App
This is a to-do list application. It's server is created in Golang, db is mongodb and client is in React.
Stars: ✭ 102 (-93.23%)
Mutual labels:  mongodb
Basic Mern Stack App
A simple MERN Stack App made for practice & learning. CRUD, Authentication & Deployment in MERN.
Stars: ✭ 104 (-93.1%)
Mutual labels:  mongodb
Mean Stack Angular5 Crud
MEAN Stack (Angular 5) CRUD Web Application Example
Stars: ✭ 107 (-92.9%)
Mutual labels:  mongodb
Easy profiler
Lightweight profiler library for c++
Stars: ✭ 1,594 (+5.77%)
Mutual labels:  profiler
User.api
集成网关、身份认证、Token授权、微服务、.netcore等的基于CQRS的微服务开发框架示例
Stars: ✭ 109 (-92.77%)
Mutual labels:  mongodb

XHGui

A graphical interface for XHProf profiling data that can store the results in MongoDB or PDO database.

Application is profiled and the profiling data is transferred to XHGui, which takes that information, saves it in MongoDB (or PDO database), and provides a convenient GUI for working with it.

Build Status Scrutinizer Code Quality Code Coverage

System Requirements

XHGui has the following requirements:

  • PHP version 7.2 up to 7.3
  • If using MongoDB storage, see MongoDB requirements
  • If using PDO storage, see PDO requirements
  • To profile an application, one of the profiling PHP extensions is required. See Profiling a Web Request or CLI script. The extension is not needed to run XHGui itself.

MongoDB

The default installation uses MongoDB database. Most of the documentation speaks about MongoDB.

  • MongoDB Extension MongoDB PHP driver: pecl install mongodb XHGui requires verison 1.3.0 or later.
  • MongoDB MongoDB Itself. XHGui requires version 3.2 or later.

PDO

  • PDO PHP extension

Any of the drivers and an accompanying database:

NOTE: PDO may not support all the features of XHGui, see #320.

Installation from source

  1. Clone or download xhgui from GitHub.

  2. Point your webserver to the webroot directory.

  3. Set the permissions on the cache directory to allow the webserver to create files. If you're lazy, 0777 will work.

    The following command changes the permissions for the cache directory:

    chmod -R 0777 cache
  4. Start a MongoDB instance. XHGui uses the MongoDB instance to store profiling data.

  5. If your MongoDB setup uses authentication, or isn't running on the default port and localhost, update XHGui's config/config.php so that XHGui can connect to your mongod instance.

  6. (Optional, but recommended) Add indexes to MongoDB to improve performance.

    XHGui stores profiling information in a results collection in the xhprof database in MongoDB. Adding indexes improves performance, letting you navigate pages more quickly.

    To add an index, open a mongo shell from your command prompt. Then, use MongoDB's db.collection.ensureIndex() method to add the indexes, as in the following:

    $ mongo
    > use xhprof
    > db.results.ensureIndex( { 'meta.SERVER.REQUEST_TIME' : -1 } )
    > db.results.ensureIndex( { 'profile.main().wt' : -1 } )
    > db.results.ensureIndex( { 'profile.main().mu' : -1 } )
    > db.results.ensureIndex( { 'profile.main().cpu' : -1 } )
    > db.results.ensureIndex( { 'meta.url' : 1 } )
    > db.results.ensureIndex( { 'meta.simple_url' : 1 } )
    
  7. Install dependencies with composer

    composer install --no-dev
  8. Set up your webserver. The Configuration section below describes how to setup the rewrite rules for both nginx and apache.

Installation with Docker

This setup uses docker-compose to orchestrate docker containers.

  1. Clone or download xhgui from GitHub.

  2. Startup the containers: docker-compose up -d

  3. Open your browser at http://xhgui.127.0.0.1.xip.io:8142 or just http://localhost:8142 or type at terminal composer open

  4. To customize xhgui, copy config/config.default.php to config/config.php and edit that file.

  5. To customize docker-compose, copy docker-compose.yml to docker-compose.override.yml and edit that file.

Configuration

Configure Webserver Re-Write Rules

XHGui prefers to have URL rewriting enabled, but will work without it. For Apache, you can do the following to enable URL rewriting:

  1. Make sure that an .htaccess override is allowed and that AllowOverride has the directive FileInfo set for the correct DocumentRoot.

    Example configuration for Apache 2.4:

    <Directory /var/www/xhgui/>
        Options Indexes FollowSymLinks
        AllowOverride FileInfo
        Require all granted
    </Directory>
  2. Make sure you are loading up mod_rewrite correctly. You should see something like:

    LoadModule rewrite_module libexec/apache2/mod_rewrite.so
  3. XHGui comes with a .htaccess file to enable the remaining rewrite rules.

For nginx and fast-cgi, you can use the following snippet as a start:

server {
    listen   80;
    server_name example.com;

    # root directive should be global
    root   /var/www/example.com/public/xhgui/webroot/;
    index  index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri =404;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Profiling a Web Request or CLI script

The recommended way tho profile an application is to use perftools/php-profiler package.

You can use that package to collect data from your web applications and CLI scripts.

This data is then pushed into XHGui database where it can be viewed with this application.

It offers submitting data directly to XHGui instance once the profiling is complete at the end of the request.

If the site cannot directly connect to XHGui instance, the package offers solution to capture profiling data to file which you can import using external/import.php script:

php external/import.php -f /path/to/jsonlinesfile.jsonl

Warning: Importing the same file twice will create duplicate profiles.

Limiting MongoDB Disk Usage

Disk usage can grow quickly, especially when profiling applications with large code bases or that use larger frameworks.

To keep the growth in check, configure MongoDB to automatically delete profiling documents once they have reached a certain age by creating a TTL index.

Decide on a maximum profile document age in seconds: you may wish to choose a lower value in development (where you profile everything), than production (where you profile only a selection of documents). The following command instructs Mongo to delete documents over 5 days (432000 seconds) old.

$ mongo
> use xhprof
> db.results.ensureIndex( { "meta.request_ts" : 1 }, { expireAfterSeconds : 432000 } )

Waterfall Display

The goal of XHGui's waterfall display is to recognize that concurrent requests can affect each other. Concurrent database requests, CPU-intensive activities and even locks on session files can become relevant. With an Ajax-heavy application, understanding the page build is far more complex than a single load: hopefully the waterfall can help. Remember, if you're only profiling a sample of requests, the waterfall fills you with impolite lies.

Some Notes:

  • There should probably be more indexes on MongoDB for this to be performant.
  • The waterfall display introduces storage of a new request_ts_micro value, as second level granularity doesn't work well with waterfalls.
  • The waterfall display is still very much in alpha.
  • Feedback and pull requests are welcome :)

Monitoring

Prometheus metrics suitable for monitoring service health are exposed on /metrics. (This currently only works if using PDO for storage.)

Releases / Changelog

See the releases for changelogs, and release information.

License

Copyright (c) 2013 Mark Story & Paul Reinheimer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].