Phalcon improves performance: What to do next? (Increasing performance: What's Next ?)

Source: Internet
Author: User
Tags apc

To develop high-performance applications, you must consider the following factors: servers, clients, networks, databases, web servers, and static resources. In this chapter, I focus on how to improve system performance and how to detect application bottlenecks. About the server (profile on the server )?

Each application is different. Persistent performance analysis is essential for identifying system bottlenecks. Performance analysis allows us to more intuitively see where is the performance bottleneck and where is not. Performance analysis may be inconsistent between one request and another. Therefore, you must make sufficient analysis and trade-offs to draw a conclusion.

About xdebug (profiling with xdebug )?

Xdebug provides a simple performance analysis method. After installation, you can configure the following in PHP. ini:

xdebug.profiler_enable = On

Webgrid _ can be used to analyze which functions or methods are slower than others:


About xhprof (profiling with xhprof )?

Xhprof is also a very interesting extension. Developers can add the following code to the Startup file:

<?phpxhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);

Then save the performance analysis data at the end of the Startup file:

<?php$xhprof_data = xhprof_disable(‘/tmp‘);$XHPROF_ROOT = "/var/www/xhprof/";include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";$xhprof_runs = new XHProfRuns_Default();$run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_testing");echo "http://localhost/xhprof/xhprof_html/index.php?run={$run_id}&source=xhprof_testing\n";

Xhprof provides a built-in HTML view for displaying performance analysis data:



About SQL statements (profiling SQL statements )?

Almost all database systems provide related tools to find out which slow SQL statements are executed. Detecting and repairing slow queries is very important to improve the performance of the server-side system. In MySQL databases, developers can enable slow query logs to record slow queries:

log-slow-queries = /var/log/slow-queries.loglong_query_time = 1.5
About the client (profile on the client )?

Sometimes developers need to increase the loading speed of static resources, such as slice, JavaScript, and CSS. The following tools enable developers to detect static resource loading bottlenecks from the client:

(Use Chrome/Firefox For performance analysis) profile with Chrome/Firefox?

Almost all modern browsers have tools to detect page loading times. In Chrome, developers can use the web browser to obtain the loading time of all resources on a page:


Firebug provides similar functions:


Yahoo! Yslow?

Developers can use yslow to analyze webpages. yslow will give suggestions based on rules for high performance web pages (High Performance Web pages:


Using speed trace for Performance Analysis (profile with speed tracer )?

The speed tracer tool helps developers identify web application performance problems. This engineer analyzes the web application performance from the bottom layer of the browser. The speed tracer plug-in can be installed on chrome of windows or Linux.


This is a very useful tool that shows the HTML page rendering time, JavaScript and CSS execution (rendering) time, and so on.

Use the latest PHP version (use a recent PHP version )?

PHP itself is running faster and faster. Using the latest version of PHP and Phalcon can improve the web application execution speed.

Use PHP bytecode cache (use a PHP bytecode cache )?

Like other bytecode caching tools, APC can help Web applications reduce the time it takes to read and parse PHP files. After APC is installed, add the following configuration in PHP. ini:

apc.enabled = On

Php5.5 contains a built-in bytecode cache, I .e., zendoptimizer +. This extension also exists in PHP 5.3 and 5.4, but not in the built-in but in the extended form.

Do blocking work in the background )?

It is time-consuming to process videos, send e-mails, and compress files and images. It is best to perform these operations in the background. Developers can use queues and message systems to process these operations to improve the performance of Web applications. The following components can be used:

    • Beanstalkd
    • Redis
    • Rabbitmq
    • Resque
    • Gearman
    • Zeromq
Google Page speed?

Mod_pagespeed can accelerate the website operation speed and reduce the loading time of the website. This open-source Apache Web Server Module (ngx_pagespeed under nginx) automatically optimizes the performance of webpages, static resources (CSS, JavaScript, images), and so on, without the need for developers to modify existing code, content, and workflows.

Note: For more performance-related configurations or suggestions, you can view specific Web servers, such as mod_cache and mod_disk_cache provided in Apache.

Phalcon improves performance: What to do next? (Increasing performance: What's Next ?)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.