There are a number of approaches to getting performance metrics for a web site. Ultimately web site performance should be best gauged by the page response within a client browser.
Using a collection of available tools such as Firefox, Firebug and Harlog you can get a realistic baseline of your expected site performance. This approach leverages Firefox and Firebug to collect data on site performance. Using Firebox to fetch pages from the site gives results that would be similar to those seen by visitors. Firebug is used to collect detailed metrics on page performance. NetExport is a plug-in for Firebug that lets to send Firebug results to a data receiving service. Harlog is used as a data reciever to collect metrics and to generate a tab delimited file that can be used to generate reports in Excel or another reporting tool.
Install Firefox, Firebug, NetExport and Harlog on a test PC.
Setup Harlog by downloading the latest files from http://www.imagossoftware.com/harlog/ and copying them into a suitable directory. For this example I will use c:\harlog. Create a directory under c:\harlog also called logs. Edit the HarLog.exe.config file and create a series of XML format settings between the tags. These settings are:
<add key=”directory” value=”C:\harlog\logs”/>
<add key=”output” value=”c:\harlog\results.txt”/>
<add key=”header” value=”all”/>
<add key=”style” value=”basic”/>
<add key=”output” value=”c:\harlog\results.txt”/>
<add key=”header” value=”all”/>
<add key=”style” value=”basic”/>
Now you can run the HarLog.exe with a -w switch to run as a mini-web server.
Now launch Firefox, and go to about:config (this will allow you to change the beacon URL for NetExport to send data to HarLog). Find the preference setting for extensions.firebug.netexport.beaconServerURL and if you have installed HarLog locally set the value to http://localhost:9090/ also set extensions.firebug.netexport.autoExportToServer to true. If are running HarLog on another PC or port set the address appropriately.
Next launch Firefox go to your test site, and open the Firebug window and go to the Net panel. Under the “Export” activate “Auto Export”. This will send the results from the Firebug Net “waterfall” to HarLog each time a page from the site is loaded.
When you have completed your testing, import the “results.txt” file into Excel or another reporting application to format and or chart your site results.
Site Performance Testing (Part 2) – Weblogic
Jvisualvm is a great tool for looking at various aspects of Java application performance. When you are running your application on an application server such as Weblogic it can be more difficult to use. The steps below allow you to attach Jvisualvm to a remote instance of Weblogic
You either need to run jstatd on the remote side, or specify a JMX connection using host:port.
Jstatd:
After that: add a remote connection to the target machine, and on the properties of that remote connection configure the jstatd connection.
(permissions.txt contains for example this:
You should now see the processes on the remote side in visualvm
To connect JMX to weblogic
Add the following JVM parameters to your Weblogic startup scripts:
You’ll be able to connect remotely via JConsole/VisualVM/etc at host:8888 then
You either need to run jstatd on the remote side, or specify a JMX connection using host:port.
Jstatd:
jstatd -J-Djava.security.policy=permissions.txt [-p port]
After that: add a remote connection to the target machine, and on the properties of that remote connection configure the jstatd connection.
(permissions.txt contains for example this:
grant {
permission java.security.AllPermission;
};
- ssh -D 9696 me@remote, and run jstatd as above on the remote command line. If you want jstatd to be on a different port than the default 1099, use the -p argument to jstatd.
- run visualvm.exe -J-Dnetbeans.system_socks_proxy=localhost:9696 -J-Djava.net.useSystemProxies=true on the local machine
You should now see the processes on the remote side in visualvm
To connect JMX to weblogic
Add the following JVM parameters to your Weblogic startup scripts:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
and restart the server. You’ll be able to connect remotely via JConsole/VisualVM/etc at host:8888 then
No comments:
Post a Comment