Php performance testing PHP Testing Solution
1. Performance Testing (xhprof)
1) installation
Wget http://pecl.php.net/get/xhprof-0.9.2.tgz
Tar xzvf xhprof-0.9.2.tgz
Cd xhprof-0.9.2/extension
/Usr/local/php-5.3.5/bin/phpize
./Configure? With-php-config =/usr/local/php-5.3.5/bin/php-config
Make & make install
2) configure PHP
Add the xhprof. so module to the php. ini file.
Extension =/usr/local/php-5.3.6/lib/php/extension/xxxx/xhprof. so
Save and close, and then restart PHP
Copy the xhprof_lib and xhprof_html directories to the website's root directory "xxx.xxxx.com/xhprof,
2. use
Add where performance testing is required
Start:
// XHPROF_FLAGS_CPU
// XHPROF_FLAGS_MEMORY
// XHPROF_FLAGS_NO_BUILTINS skips the built-in function
// To set the list of functions to be ignored, you can specify the second parameter [an optional parameter] for the xhprof_enable function during analysis, for example:
Xhprof_enable (XHPROF_FLAGS_MEMORY,
Array (
'Ignored _ functions' => array (
'Call _ user_func ',
'Call _ user_func_array'
)
)
);
In this way, you can view the CPU, memory, and execution time consumed by each function call.
View a single report:
Http://xxx.xxx.xxx/xhprof/xhprof_html/index.php? Run = {$ runId} & source =
View comparison report:
Http://xxx.xxx.xxx/xhprof/xhprof_html/index.php? Run1 = xxxx & run2 = xxx & source =
View the summary report:
Http://xxx.xxx.xxx/xhprof/xhprof_html/index.php? Run = 1, 2, 3 & source =
Weighted summary: we further assume that the above three features correspond to three programs, p1.php, p2.php, and p3.php, which are typically mixed with a probability of 20%, 30%, and 50%: to view the weighted average corresponding to the summary report, run the following command:
Http://xxx.xxx.xxx/xhprof/xhprof_html/index.php? Run = 1, 2, 3 & wts = 20, 30, 50 & source =
II. stress testing
Command:
AB? C 256? N 100000 http://iploc.kuaibo.com/ip/weather
-C concurrency
-N total number of requests
-T total request time, more than 50 thousand End Times
Server pressure test reference data:
1. top CPU (nginx, PHP, MYSQL)
2. free memory (nginx, PHP, MYSQL)
3. queue
4. I/O
5. network traffic
The two tests are combined to test the stress from low to high and observe the resource usage of the server. During stress testing, xhprof, a performance testing tool, is used in combination to test the bottleneck and resource usage.
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