Wednesday, April 28, 2010

AJAX LOAD TEST USING JMETER

Here are some steps:
1. Create new test plan
2. Under the Test Plan, add Config Element > Http Request Defaults
- Enter server name and port number
3. Under Test Plan, add Config Element > HTTP Cookie Manager
4. Add Thread Group under Test Plan
5. Under the Thread Group, Add > Logic Controller > Recording Controller
6. Test Plan > Add > Listener > Aggregate Report
7. Under Workbench, Add > Non-Test Element > HTTP Proxy Server
- Port 9090
- Target Controller: Thread Group > Recording Controller
- Patterns to include: Click Add then enter “.*”
8. Under HTTP Proxy Server, Add > Timer > Gaussian Random Timer
- Set Constant Delay Offset (in milliseconds): ${T}
9. Bring up the FireFox browser and under Tools/options/advanced tab/network tab/settings button/”Manual proxy configuration”
- Set 127.0.0.1 port 9090
- Enable checkbox: “Use this proxy for all protocols”
10. Bring up HTTP Proxy Server, then click Start.
11. Now simply bring up FF and perform operations you wish to be recorded into the recording controller.
12. When complete, click the “Stop” button on the HTTP Proxy Server.
13. Verify that operations were recorded on the “Recording Controller”.

=================

1. set

CookieManager.save.cookies=true

in jmeter.properties file.

2. get the session ID as COOKIE_JSESSIONID

3. define variable for script session id as ${__javaScript('B4B26203309DA29AEB9542780F307009'+Math.floor(Math.random() * 1000))}

4. use these session id and script session id in the dwr request.

Tuesday, April 27, 2010

JMETER BASIC TEST STEPS

Here are some steps:
1. Create new test plan
2. Under the Test Plan, add Config Element > Http Request Defaults
- Enter server name and port number
3. Under Test Plan, add Config Element > HTTP Cookie Manager
4. Add Thread Group under Test Plan
5. Under the Thread Group, Add > Logic Controller > Recording Controller
6. Test Plan > Add > Listener > Aggregate Report
7. Under Workbench, Add > Non-Test Element > HTTP Proxy Server
- Port 9090
- Target Controller: Thread Group > Recording Controller
- Patterns to include: Click Add then enter “.*”
8. Under HTTP Proxy Server, Add > Timer > Gaussian Random Timer
- Set Constant Delay Offset (in milliseconds): ${T}
9. Bring up the FireFox browser and under Tools/options/advanced tab/network tab/settings button/”Manual proxy configuration”
- Set 127.0.0.1 port 9090
- Enable checkbox: “Use this proxy for all protocols”
10. Bring up HTTP Proxy Server, then click Start.
11. Now simply bring up FF and perform operations you wish to be recorded into the recording controller.
12. When complete, click the “Stop” button on the HTTP Proxy Server.
13. Verify that operations were recorded on the “Recording Controller”.

Friday, April 02, 2010

AWSTATS on ubuntu

Install Awstats on Ubuntu

This has been tested with Ubuntu server 8.04 (Hardy Heron).

Installation

sudo aptitude install awstats
To see the country of your visitors (not required)

sudo aptitude install libnet-ip-perl
sudo aptitude install libgeo-ipfree-perl
Configuration

Let's assume you want to analyze the Apache 2 log file of your website “toto.com” (It can be just an IP address).

Create configuration file

sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.toto.com.conf
Update these parameters

# apache2
LogFile="/var/log/apache2/access.log"

# domain name
SiteDomain="toto.com"
HostAliases="localhost 127.0.0.1 toto.com"

LogFormat=1
You can also activate these plugins

LoadPlugin="tooltips
LoadPlugin="geoipfree"
Run

sudo /usr/lib/cgi-bin/awstats.pl -config=toto.com -update
You should get something like this

Create/Update database for config "/etc/awstats/awstats.toto.com.conf" by AWStats version 6.7 (build 1.892)
From data in log file "/var/log/apache2/access.log"...
Phase 1 : First bypass old records, searching new record...
Searching new records from beginning of log file...
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...
Jumped lines in file: 0
Parsed lines in file: 191338
Found 0 dropped records,
Found 24 corrupted records,
Found 0 old records,
Found 191314 new qualified records.
Configure Apache to view the statistics

Create /etc/apache2/conf.d/statistics

Alias /awstatsclasses "/usr/share/awstats/lib/"
Alias /awstats-icon/ "/usr/share/awstats/icon/"
Alias /awstatscss "/usr/share/doc/awstats/examples/css"
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
ScriptAlias /statistics/ /usr/lib/cgi-bin/
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Restart Apache

sudo /etc/init.d/apache2 restart
View your statistics

http://toto.com/statistics/awstats.pl
or (in case you have more than one config file)

http://toto.com/statistics/awstats.pl?config=toto.com
Update your statistics with cron

In /etc/crontab add

# update every 10 min
*/10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=toto.com -update > /dev/null
How to reset awstats

Just delete the files in /var/lib/awtstats (directory defined by DirData parameter)

sudo su - root
cd /var/lib/awstats
rm *
logout
Notes

you have to be root because for some reason, sudo rm -R awstats/* wouldn't work.
if you get the message Never updated (See 'Build/Update' on awstats_setup.html page) whereas the awstats files are there in /var/lib/awtstats, it's probably a permission problem on this folder.
Source: http://awstats.sourceforge.net/docs/awstats_faq.html#RESET

Troubleshooting

awstats "Error: SiteDomain parameter not defined in your config/domain file. You must edit it for using this version of AWStats. "
Try to this URL (with your values): http://toto.com/statistics/awstats.pl?config=toto.com

Reference

http://ubuntu-tutorials.com/2008/01/16/configuring-awstats-on-ubuntu-server/
http://www.mneylon.com/blog/archives/2005/08/03/configuring-awstats-with-apache-2-on-ubuntu/
http://awstats.sourceforge.net/
http://awstats.sourceforge.net/docs/awstats_faq.html

Tomcat on ubuntu amazon ec2

There’s a better workaround so you can keep Ubuntu’s Tomcat6 (taken from http://ubuntuforums.org/showthread.php?p=8541057, by DisDis)

In a terminal:

1. sudo apt-get install tomcat6
2. cd /usr/share/tomcat6
3. sudo ln -s /var/lib/tomcat6/conf conf
4. sudo ln -s /etc/tomcat6/policy.d/03catalina.policy conf/catalina.policy
5. sudo ln -s /var/log/tomcat6 log
6. sudo chmod -R 777 /usr/share/tomcat6/conf

sudo apt-get install tomcat6 cd /usr/share/tomcat6 sudo ln -s /var/lib/tomcat6/conf conf sudo ln -s /etc/tomcat6/policy.d/03catalina.policy conf/catalina.policy sudo ln -s /var/log/tomcat6 log sudo chmod -R 777 /usr/share/tomcat6/conf

There. Now just go to Window/Preferences/Sever/Runtime Environments, add the Apache Tomcat6 Server and use /usr/share/tomcat6 as the installation directory!

Tuesday, March 30, 2010

Ubuntu VNC keyboard Sync Issue AMAZON EC2

Applications -> System Tools -> Configuration Editor
Desktop -> Gnome -> Peripherals -> Keyboard -> KBD

Edit the layout key to delete what is there and add your "abfh" by typing asdf.

Then go to the Keyboard preferences and put back in US-105 if that's what you like.
System -> Preferences -> Keyboard
Layouts
Add
Choose your favorite. Hit OK, mark as default.

Restart VNC/EC2 Instance, and hope it works.