10. APACHE BENCH - DEMO
1000 Requests with 5 at a time
ab -n 1000 -c 5 http://localhost/phpBB3/index.php
1000 requests with 5 at a time using keep alive
ab -n 1000 -c 5 -k http://localhost/phpBB3/index.php
Output results to Excel / GNUPlot
ab -n 1000 -c 5 -g http://localhost/phpBB3/index.php
30. VMWARE INSTALL
Run
Run VMware- VMware-
Run VMWare-fusion.dmg
player-2.5.0-118166.exe Player-2.5.0-118166.i386
.bundle
Reboot
Copy Fedora 10 Folder to Disk
Load via VMWare
php / password
31. TASK
• Visit http://localhost/phpBB3/
• View a forum after 20 seconds
• View a thread after 5 seconds
• Click reply after 60 seconds
• Sample file in flood-examples folder
32. SIEGE
Provides functionality of Apache Bench and Flood
Supports GET and POST with a simple syntax
Benchmark and Internet mode
33. SIEGE COMMANDS
1000 Requests with 5 at a time
siege -b -r 1000 -c 5 http://localhost/phpBB3/index.php
10 seconds with concurrency of 5
siege -b -c 5 -t 10 http://localhost/phpBB3/index.php
Read urls.txt for a list of URLs
siege -b -n 1000 -c 5
34. SPROXY
Creates local socks proxy on your machine
Set your browser to use the local proxy, port 9001
Browse your site with the actions you wish
urls.txt is written with the POST and GET data
35. OTHER BENCHMARKING
TOOLS
JMeter
httperf
Web Application Stress Tool
OpenWebLoad
49. PARTIAL EXECUTION TRACE
Tracing only parts of an application with
xdebug_start_trace() and xdebug_stop_trace().
Fetching the trace file name that is being used with
xdebug_get_tracefile_name().
Changing how much data is shown with
xdebug.var_display_max_children,
xdebug.var_display_max_data and
xdebug.var_display_max_depth.
53. PROFILING
Execute action as normal in browser
Outputs cachegrind file
INI settings:
xdebug.profiler_enable=1 ; enable profiler
xdebug.profile_output_dir=/tmp ; output directory
xdebug.profile_output_name=cachegrind.out.%p
54. PROFILING CONTINUED
Locate parts of the code that is slow
Work down tree to find the slow sections
Can it be cached? Can it be optimized?
Occasionally built?
57. TASK
sudo nano -w /etc/php.d/xdebug.ini
remove ; from xdebug.profiler_enabled=1
Profile a page on Wordpress
Profile a page on phpBB
Try to find something slow you think could be
improved
20 minutes
60. BRINGING IT TOGETHER
Use profiler with benchmarks
Profiling can be run on production sites
Optimise slow code
61. RESOURCES
Lunch - back at 1pm for Caching
http://talks.macvicar.net/
http://httpd.apache.org/test/flood/
http://xdebug.org/docs/
http://www.joedog.org