Monday, February 01, 2010

Thursday, January 28, 2010

Watir -Click_no_wait() does not trigger the Popup window

Due to Click_no_wait() does not work on my IE, based on the discussion and suggestion from this thread:http://jira.openqa.org/browse/WTR-320 , I have to roll back my ruby version from ruby186-27 to ruby186-26, here is my process:

1. Uninstall ruby186-27
2. Install ruby186-26
3. Run "gem update --system"
But Shit happens:
...
rubygems-update requires builder >= 0


4. manually download rubygems-1.3.5.zip
5. upzip rubygems-1.3.5.zip to C:\
6. Run "C:\rubygems-1.3.5>ruby setup.rb" --RubyGems 1.3.5 installed
7. Run "gem update --system" --Nothing to update
8. Run "gem install watir"

Done. i will see if it works now...God bless!
-- update , it did works! :)

Updated from 2010/09/25:
It has fixed this issue on ruby186-27 now, i have not tried that yet:
http://jira.openqa.org/browse/WTR-320?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Monday, January 25, 2010

Regular expression in Watir method

We can make usage of regular expression in Watir to easily access the dynamic object, for example:
you want to pick a option in select_list which id is : hello_12345, 12345 is dynamic number, so you can write like this:

cframe.select_list(:id, /hello_\d+/).select("Select one option");

Sunday, January 24, 2010

Memory Pool--Code Cache can be "GCed"

The code cache GC has been detected :)

Open expire headers to reduce 304 requests

Open expire headers on Apache http server:

[IfModule mod_expires.c]
ExpiresActive On

ExpiresByType image/* "access plus 30 days"
ExpiresByType application/x-javascript "access plus 30 days"
ExpiresByType text/javascript "access plus 30 days"
ExpiresByType text/css "access plus 30 days"
ExpiresByType image/x-icon "access plus 360 days"

[/IfModule]


before enabling Expire header:


After enabling Expire header:


you can see all of the static files, like images, .js and .css are read from browser cache directly instead of sending additional requests to the server and get 304 not modified response status code. it improves our performance and saving bandwidth as well.

Thursday, January 21, 2010

Enable Gzip on Apache Http server

Enable Gzip, modify the httpd.conf:

Apache Httpd.conf change:

LoadModule deflate_module modules/mod_deflate.so

LoadModule headers_module modules/mod_headers.so

.....

#Enable Gzip



# we do not need to 9 level, due to CPU% is high but no further compression benefit
DeflateCompressionLevel 7



# Insert filter
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/javascript application/x-javascript

AddOutputFilter DEFLATE css js


# Netscape 4.x has some problems...

BrowserMatch ^Mozilla/4 gzip-only-text/html


# Netscape 4.06-4.08 have some more problems

BrowserMatch ^Mozilla/4\.0[678] no-gzip



# MSIE masquerades as Netscape, but it is fine

BrowserMatch \bMSIE !no-gzip !gzip-only-text/html



# Don't compress images and already compressed files

SetEnvIfNoCase Request_URI \\.(?:gif|jpg|cab|jpe?g|exe|bmp|rar|zip|swf|png)$ no-gzip dont-vary



# Make sure proxies don't deliver the wrong content, need load mod_headers.so

Header append Vary User-Agent env=!dont-vary





or if you want things simple(may bring some bugs on certain browsers):


DeflateCompressionLevel 7
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css

Friday, January 15, 2010

move your mouse automaticly :)

Access directory of JDK6/bin and run jrunscript.exe (note: only for JDK6)
Input scripts:
r = java.awt.Robot();
r.setAutoDelay(500);
while(true){r.mouseMove(500+100*Math.random(), 500+100*Math.random());}


share and enjoy it!

simple thread dump analysis Awk scripts

Here are the Thread.state we usually see and pay attention to:
* RUNNABLE
* BLOCKED
* WAITING
* TIMED_WAITING

If want to know what kind of status of thread dump i picked up from app server when CPU% is pretty high or want to find blocking threads, this is useful give you some insights, you can develop yours in 10 mins:)

BEGIN {RS="\n\"";IGNORECASE = 1;count1=0;count2=0;count3=0;count4=0;count5=0}

($0~ /workmanager\(/){

if ($0~ /State: runnable/) {

count1=count1+1;

}


if ($0~ /State: TIMED_WAITING on/){

count2=count2+1;

}

if ($0~ /State: WAITING\n/) {

count3=count3+1;

}

if ($0~ /State: WAITING on /) {

count4=count4+1;

}

if ($0~ /State: Blocked on /) {

count5=count5+1;

}


{

sum=sum+1;
}

}

END{
print "# of runnable threads is:" count1;
print "# of timed_Waiting on condition threads is: " count2;
print "# of Waiting threads is: " count3;
print "# of Waiting on condition threads is: " count4;
print "# of Blocked threads is: " count5;
print "Total num of threads: " sum;
}
-------------------
Sample output:

# of runnable threads is:10
# of timed_Waiting on condition threads is: 85
# of Waiting threads is: 0
# of Waiting on condition threads is: 3
# of Blocked threads is: 2
Total num of threads: 100


BTW, i found "timed_Waiting on" and "Blocked" threads number is huge, then you got problem on synchronization probably, dig into it.

Wednesday, December 23, 2009

Performance engineering internal group(team) responsibility

Here is a draft of internal performance group(team) responsibility chart in my mind, so much things to do, we need to prioritize each section better to maximum its value :

Responsibility

Tasks

Role

Delivery

Capacity planning

1. Current user pattern/distribution

2. Gap analysis

3. Predict trend of usage

4. Top slow transactions

5. Top usage of transactions

QA lead, Performance QA(owner)

PM, OPS(supportive)

SDM, TL(consultant)

Access log analysis result

RFP distribution pattern

Performance Environment Setup

1. Setup Performance environment

2. Data preparation

3. Server configuration

SCM/Dev (owner)

Performance QA (supportive)

Testable performance environment

Performance test planning and design

1. Performance test strategy design

2. Performance testing scripts/scenario design

3. Keep performance test scripts/ load distribution update to date

Performance QA(owner)

Performance Dev(supportive)

SDM, TL, QA lead(consultant)

Performance test scripts/ scenarios

Code review and design inspection

1. code review and Performance inspection checklist

Performance Dev , TL(owner)

Performance QA(supportive)

Arch(consultant)

Code review retro

Performance testing Execution

1. User-story based performance test

2. Weekly performance test

3. Release performance testing

4. End-end performance test

5. Performance initiatives

6. Performance test report

Performance QA(owner)

Performance Dev(supportive)

Performance test result report

Performance result analysis

1. Server log issues analysis

2. Performance test result analysis

3. Conclusion of performance Grade and suggestion of further investigation

Performance Dev(owner)

Performance QA(supportive)

Identify any potential Performance bottlenecks

Escalate Performance issues to the team

Performance improvement planning

1. making follow up plan for escalated performance issues

SDM, TL, QA lead(owner)

Performance QA/Dev(supportive)

Create tech user stories for each performance issue

Triage the priority of each performance user story

Performance tuning

1. Java back-end performance tuning

2. DB tuning

3. Front-end performance tuning

4. Performance Validation

SDM, TL, Dev (owner)

Performance QA(supportive)

Tuning analysis summary

Performance improvement comparison result

Code review

Check-in code into new release

Production Performance issues Follow up

1. Log performance issue in Rally

2. Server log analysis

3. Reproduce performance issue on local

4. Find the root cause of bottleneck

Performance Dev(owner)

Performance QA(supportive)

Performance issue analysis result

Reproduce suggestions

Tuesday, December 15, 2009

Analysis Jmeter result log with Google Charts by Ruby

A thought from long time ago, but never pick it up...

Thanks to http://googlecharts.rubyforge.org/, it give me the inspiration on how to combine ruby and Google Charts, then i just make it by ruby

Thanks to my intern Tom as well, he has helped me to re-factoring of my previous code, he made the charts a little bit fancy than mine:)

enjoy it!

Note: the data of bellowing Diagram is not real data , just for testing purpose :)



Ruby Source Code V1.0:

require 'gchart'

def getresdata(block1)
# scan for the first numeric token
str = block1.scan(/\d+/)[0];
return str;
end

# format RGB
def fill(str)
i = 6 - str.length();
while(i > 0)
str = '0' + str;
i -= 1;
end
return str;
end

def format_color(num, boundary)
return "000000" if num < boundary =" 0"> 16777215;

color = boundary;
increment = (16777216 - boundary)/num;

retStr = "%x" % [boundary];
retStr = fill(retStr);

while(num > 1)
color += increment;
str = "%x" % [color];
str = fill(str);

num -= 1;
retStr += ',' + str;
end

return retStr;
end

def Draw_Perf_data(file)
url_sum = Hash.new();
IO.foreach(file) { |line|
next if !line.include?("lb="); # skip when this is xml head line

line.strip!(); # trim
url = line.scan(/lb="\w+/)[0]; # fetch the 'lb=' token
puts url.sub!("lb=\"", ""); # fetch the value of lb

if url_sum.has_key?(url)
url_sum[url].push(getresdata(line).to_i); # exist, then add cell
else
url_sum[url] = Array.new(1, getresdata(line).to_i); #!exist, then create
end
}

datas = Array.new();
actions = Array.new();

url_sum.each { |key, val|
datas.push(val);
actions.push(key);
}

colors = format_color(3, 0);
arrayabc = Gchart.line(:size => "800x375",:title => "Request Log", :data => datas, :line_colors => colors, :legend => actions, :axis_with_labels => ['y'], :custom => "chg=100,25");

puts(arrayabc);
return arrayabc;
end


######################
# Call the method, just input your Jmeter result log as a parameter, note it should be the default format of your logs

Draw_Perf_data("123.txt");




here is my configuration for my JMeter result file: