Tuesday, February 24, 2009

Apache Gzip level adjustment

Gzip level does impact our performance, because itself is a conflicting stuff—-consuming CPU% to reduce the file size in order to reduce the long duration network time.

so we need take these three things into consideration:
1.Network speed
2.Apache http Server capacity,especially CPU
3.File Compression ratio(.js, .Css, .html,.xml)

I did a quick testing charts based on different Gzip level and high speed Network:

Chart1—response time under different Gzip level
Gzip level | response time | Apache CPU%
Level 9 | 0.85s | 98%
Level 7 | 0.60s | 97%
Level 6 | 0.53s | 96%
Level 5 | 0.45s | 95%
Level 3 | 0.42s | 93%
Level 2 | 0.40s | 93%
Level 1 | 0.38s | 93%

Chart2—X.js Compression ratio under different Gzip level
orginal size of X.js=140K

Gzip level | After compression size
Level 9 | 30.1K
Level 7 | 30.1K
Level 6 | 30.3K
level 5 | 31.2K
Level 4 | 33K

I choose:
DeflateCompressionLevel 6

so from testing result, we can see level 9 is not always right :) just for your reference, make your own Gzip level.

Friday, February 20, 2009

Apache Http server Cache

I did some investigation on our web server after looking at the Content Caching mechanism.
there are several thing to confirm:
1. using Gzip or not?
2. What kind of files should we cache?
3. Which Cache method should i choose?
4. What kind of configurations to each Cache method?

Testing preparation: prepare one simple web page and Jmeter as load generating tool


Disk cache config:

IfModule mod_cache.c
IfModule mod_disk_cache.c
CacheRoot c:/cacheroot
CacheEnable disk /
CacheDirLevels 3
CacheDirLength 2
/IfModule
/IfModule

Mem cache config:
IfModule mod_cache.c
IfModule mod_disk_cache.c
CacheDefaultExpire 86400
CacheEnable mem /
MCacheSize 100000
MCacheMaxObjectCount 10000
MCacheMinObjectSize 100
MCacheMaxObjectSize 6400000
MCacheRemovalAlgorithm LRU
/IfModule
/IfModule

we just want to cache some static files on web server, like .js,.css and some images, which are not modified often.

First, we confirm to use Gzip to improve our web site performance(even if there is some bugs on it). If only apply Cache on Apache http server, the response time is not good if you have a few large static file to load...

Disable Gzip:
1> with Mod_mem_cache: 4160ms in average response time
2> with Mod_disk_cache: 4185ms in average response time

Enable Gzip without any Apache cache:
3> 2885ms in average response time, however, the CPU% is almost 90% with highest Gzip level(Level 9)

Note: To enable Gzip, add Accept-Encoding: gzip,deflate into JMeter header manager;


So I intent to use both Apache cache and Gzip to see any great improvement on response time and CPU% on web server.

But,finding that we using Mod_mem_cache, while Gzip can not be effected... do not know why
For Mod_disk_cache, it can be living with Gzip, and more important, it will reduce CPU% of apache server! that is great!
So, it might do a pre-Gzip job first, then cache it into the cache root directive, here is the result data for your reference:

Enable Gzip:
1> with Mod_disk_cache: 2793ms in average response time
CPU%=15%
if you want to see if Mod_disk_cache works or not, one way is to look at the cache root directive folder, if there is some strange files created after or during testing, then it works!

for Mod_disk_cache configration: you have to adjust these two interesting items:
CacheDirLevels
CacheDirLength
because different combination can give different numbers, more info please see http://httpd.apache.org/docs/2.2/mod/mod_disk_cache.html

one reminder, htcacheclean is used to keep the size of mod_disk_cache's storage within a certain limit.
you can use cmd command line to run it as a daemon mode:
C:/AppServ/Apache2.2/bin/htcacheclean -t -i -d30 -pD:/cacheroot -l1M
or
create a .bat then add a schedule task:
C:/AppServ/Apache2.2/bin/htcacheclean -t -n -v -pD:/cacheroot -l1M

In one word: we want to enable mod_disk_cache+Gzip on apache http server, currently :)

Wednesday, February 18, 2009

Content check for Web_service_call's response XML in Loadrunner

You never know what you gonna get if you do not have a content check for your response data.
If only it is a non-manual test---automation test, UI based performance test or web service call performance test and something else, you need to do validation for each response data!

A simple example for your reference, hope you can have a better solution to check the response data:

Note: in following web_service_call request, i have changed "<" into "{" and ">" into "}" due to some display issue by this blog:

web_service_call( "StepName=get****ByID_101",
"SOAPMethod=******",
"ResponseParam=response_1",
"Service=VendorServiceService",
"Snapshot=t1234933987.inf",
BEGIN_ARGUMENTS,
"xml:arg0="
"{arg0}"
"{externalID}2{/externalID}"
"{uniqueID}{/uniqueID}"
"{/arg0}",
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);

find_cnt =lr_xml_find("XML={response_1}",
"Query=//meetingRoomSetups[2]/name",
"Value=banquet",
"IgnoreCase=Yes",
"NotFound=error",
LAST);

if (find_cnt ==0) {
lr_out_message(...);
lr_exit(...);
}

So you can simply use lr_xml_find()to check the critical or unique value in the response XML,just like web_reg_find() to do content check for Web requests.

of Course you can use Checkpoint for content check, it is easy to fill in the expect result in Checkpoint tab from tree view in Vugen

Monday, February 16, 2009

假如分开了,还会回来吗?

37岁的奥尼尔,在精彩的poping和霸气十足的扣篮中赢得了所有人的尊重。

这种“表演”才是全明星赛的真谛,尽情的享受篮球带给自己和球迷的快乐,大姚需要尽快的适应,腼腆不会给你带来加分和任何乐趣。。。
过去的事就随风去吧,不必总是活在自己的记忆里,科比和奥尼尔不约而同对记者提出“还会不会在一起共同比赛”的问题谁了声“No!”
分开就是分开了,大家都还有自己的一片天,把记忆永久的封存在最美好的一刻吧,合适的时候回忆起来,总会那么美好,大家还是好朋友好兄弟,分开的日子更融洽!:)

“如果有一天你决定离开了,你还会回来吗?”

Thursday, February 12, 2009

Get JMS_messaging table trend by easy SQL

I have not find a very powerful tool (and free) to monitor the JMS_messaging table status, so i intend to write some easy SQL to monitoring the trend of it. Anyway it is just a temp solution to solve my job...

Basically the SQL is to Get the JMS_messaging table destination contents by a fixing time(like every 30 seconds or something) and meanwhile i want to get the trend of JMS_messaging table to see how many DLQs in the table before,during and after my load test.

declare @i int
declare @nowtime datetime
set @i=0

while @i<20
begin

set @nowtime=getdate()

SELECT destination, count(destination)
FROM JMS_MESSAGES
group by destination

set @i=@i+1
print @i
print convert(varchar(max), @nowtime, 121)

waitfor delay '00:00:30'

end;

so i will start this SQL just before i start my tests, then start the load test, after load test then check the results and messages in SQL server 2005.
you can adjust the loop counts(@i) and time delay value according to your load tests duration.