??xml version="1.0" encoding="utf-8" standalone="yes"?> 首先创徏两个试表:(x) create table test_long (a int primary key,b long); 用附件java代码Q往两个表里面各插入100条数据,保证插入数据是一L(fng)Qlob字段长度?0kQ如果小?kQoracle可以把它保存到到表内Q不?x)存储在表外Q性能没有问题Q这个我基本定Q而且我们应用中这个字D늻怼(x)过4kQ? 做一个简单查询对比一下:(x) SQL> set autotrace traceonly; l计信息 SQL> select * from test_long where a=1; l计信息 Ҏ(gu)一下,long开销比lob,当然你可以把lob字段启用~存Q把4ơ物理读LQ但q是多了Q?3-43Q次逻辑读,update也试了一下,lob产生的redo比long大,׃列出来了Q有兴趣的可以自p? 试下来Q看来之前的认识不对Q不定的东西最好还是动手试试,当然对于新应用,q是不徏议用longQ毕竟oracle已经废弃它了?
create table test_clob (a int primary key,b clob);
SQL> select * from test_clob where a=1;
----------------------------------------------------------
331 recursive calls
0 db block gets
69 consistent gets
4 physical reads
0 redo size
1278 bytes sent via SQL*Net to client
837 bytes received via SQL*Net from client
5 SQL*Net roundtrips to/from client
12 sorts (memory)
0 sorts (disk)
1 rows processed
----------------------------------------------------------
236 recursive calls
0 db block gets
43 consistent gets
0 physical reads
0 redo size
675 bytes sent via SQL*Net to client
531 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
1 rows processed
]]>
我们可以通过一U变通的办法来实玎ͼ(x)
首先扑ֈ你出错的面Q保存该面到参数里面:(x)
web_set_max_html_param_len(“2048”);
web_reg_save_param(“FILED”,”LB=”,”RB=”,”Search=Body”,LAST);
然后输出到日志里面:(x) lr_output_message(”#######################################%s”,lr_eval_string(”{FILED}”));
修改lr run-time的几个设|:(x)
1、Always send messages
2、continue on error Q这h能保证运行lr_output_message)
q样lr?x)把所有的lr_output_message输出保存到日志文?
当然你不要下载资源文Ӟ否则保存到的׃是html面了,可能是一个gif :(
最后,l合lr controller的错误信息,定位到出错的vuser idQ查看该vuser的log文gp看到错误面?
非常有效的一个小技巧,用它解决了一个难~的问题?
一个用户在某个旉点上当然只能发v一个用戯求,一个用戯求就是一个ƈ?br>
我们一般纠~在同一事物q发q是不同事务q发?br>
可能在一个时间点上,?00个用户在发送浏览,查询动作Q?0个用户在下订单,5个用户在做付?gu)Ƒ֊作,你说q个旉点上有多个q发hQ当然是115个了
衡量一个系l性能主要靠的是q个吞吐量(tpsQ?br>
当然我们也非常关心同?00个用户ƈ发下订单的时候系l是否能支撑Q这是通常我们大部分h理解的ƈ发)Q我们会(x)说这是核心业务,我们要得出数据(是否要考虑背景业务呢,呵呵Q很难说的清楚,我一般就不考虑Q?/p>
Ҏ(gu)环境Q?4bit Solaris + 32bit JDKQ,客户把Heap最大设|ؓ(f)2GQ开始怀?2bit JDK无法分配q么大的HeapQ经q验证,不存在这L(fng)问题Qsun|站也有相关说明Q在solaris 64bitpȝ上,32bit jdk最大可以设|到4GQ?/p>
但是从dump看到application classes loader大小已经C60M以上Q有Ҏ(gu)疑Perm|太导_(d)查了一下sun的文档,Perm区缺省大ؓ(f)64MQ估计是应用加蝲太多classesDPerm区溢出,
我们也简单模拟了一下Perm溢出Q强制设|max perm大小?2MQƈ对GCq行了监控,l果和我们预想的一_(d)看下面的gc logQ?
151.836: [Full GC 151.836: [Tenured: 25735K->25736K(1048576K), 0.8380858 secs] 25911K->25736K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8382804 secs]
152.676: [Full GC 152.676: [Tenured: 25736K->25722K(1048576K), 0.8464782 secs] 25752K->25722K(1557568K), [Perm : 32767K->32766K(32768K)], 0.8466638 secs]
153.525: [Full GC 153.525: [Tenured: 25722K->25724K(1048576K), 0.8419056 secs] 25738K->25724K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8420986 secs]
154.368: [Full GC 154.368: [Tenured: 25724K->25724K(1048576K), 0.8398816 secs] 25724K->25724K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8400498 secs]
155.212: [Full GC 155.212: [Tenured: 25724K->25725K(1048576K), 0.8365448 secs] 25788K->25725K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8367370 secs]
156.050: [Full GC 156.050: [Tenured: 25725K->25722K(1048576K), 0.8422488 secs] 25725K->25722K(1557568K), [Perm : 32767K->32766K(32768K)], 0.8424328 secs]
156.895: [Full GC 156.895: [Tenured: 25722K->25724K(1048576K), 0.8443532 secs] 25738K->25724K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8445450 secs]
157.740: [Full GC 157.741: [Tenured: 25724K->25724K(1048576K), 0.8427754 secs] 25740K->25724K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8429634 secs]
158.587: [Full GC 158.588: [Tenured: 25724K->25726K(1048576K), 0.8352290 secs] 25820K->25726K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8354212 secs]
159.424: [Full GC 159.424: [Tenured: 25726K->25723K(1048576K), 0.8435336 secs] 25726K->25723K(1557568K), [Perm : 32767K->32766K(32768K)], 0.8437092 secs]
160.270: [Full GC 160.270: [Tenured: 25723K->25725K(1048576K), 0.8477722 secs] 25739K->25725K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8479596 secs]
161.119: [Full GC 161.119: [Tenured: 25725K->25725K(1048576K), 0.8543338 secs] 25725K->25725K(1557568K), [Perm : 32767K->32767K(32768K)], 0.8545040 secs
从日志看Q和我们现场的状况非常相|heapI间充Q但是perm已经C32MQ无法再q一步分配空_(d)直接Djvm频繁做Full GCQ控制台也开始抛出OOMQPerm引v的回攉是full gcQ,q样看基本我们判断是Perm太小Q导致无法加载classesD?
和客h通之后,我们本来打算q一步验证(在生产环节打开PrintGCDetailQ获取详l的GC logQ,后面仔细查nohup.out,发现里面已经抛出?OutOfMemoryError:PermGen SpaceQ至此我们确定是Perm讄不合理导致了本次事故Q和客户认之后Q我们在启动参数中加上了MaxPermSize
后面惛_中间上了集群之后Qeos加蝲了大量的jboss cache classQ这也直接解释了Z么这D|间OOM出现的频率比之前更频J的原因
q里ȝ一下,希望对碰到类似问题的tx有借鉴意义Q强烈徏议用sun jdk 1.4.2的同学升U到>=1.4.2_12Q便于对OOM问题的诊断,q加上GC log协助验证?
q里再介l一下JVM发生OOM的几U情况:(x)
1、java.lang.OutOfMemoryError: Java heap space
q是我们q_理解的OOMQ是׃heap space实没有I间分配Q这U一般是׃内存泄漏DQ也有可能是heap space讄太小。需要具体分?
2、java.lang.OutOfMemoryError: PermGen space
jvm规范里面有定义一个method spaceQ这里主要放classes和method list和一个string poolQstring有一个internҎ(gu)Q通过q个Ҏ(gu)定义的string都放在这里(好像不常用)Q这里设|不太小?x)导致OOMQ缺?4MQ主要由于现在应用依赖的W三方类来多Q导致这c问题频J发生,需要引起重?
3、Requested array size exceeds VM limit
q种是由于申L(fng)array size出了heap space大小Q比如在一?56M的heap space中申请一?12M的arrayQ这U基本都是应用bugD
4、request <size> bytes for <reason>. Out of swap space?
q种是由于heap size讄相对于系l物理内存太大,Dpȝswap space不Q这U的解决办法是减小heap size大小
5?lt;reason> <stack trace> (Native method)
q种估计是最ȝ的了Q也是最碰到的Q是׃jni或native methodDQ如果自己没有写q类的东西,基本可以说是jdk问题
有用Websphere做过目的h可能都知道,ibm一般都在Websphere前面加一个IHS来做webserverQ据说这h能?x)提?0%左右Q这栯是否有道理呢Q下面我做了一个简单的试来验证:(x)
试环境Q?/p>
gQ?/p>
应用服务器:(x)Dell6600
压力试客户端:(x)自用W记本(T2050 1.6G)
软gQ?/p>
pȝQCentOS 4.4
Websphere 6.0.2.17+IHS6.0.2.17Q部|在同一台机器上Q?/p>
首先配置好Websphere和IHSQ发布一个简单的试应用Q用loadrunner来测试一下不同的l合看看Q录制一个打开首页可以了Q,下面是我的测试数据:(x)
试Ҏ(gu) | 每秒处理h?/td> | 响应旉 | 服务器CPU |
直接hWebsphere | 4600/s | 0.013s | 28% |
通过IHS转发h | 6800/s | 0.009s | 26% |
数据昄Q这q不是一点点提升Q竟然快接近50%Q把静态资源放|到IHS中测试了一把,基本和通过IHS转发差不多,E微有些提升Q不q放到IHS中可以方便CacheQEdge Server包括了Caching Proxy componentQ?/p>
下面记录一下如何放|静态资源文件到IHS中:(x)
1、打开Plugins中的plugin-cfg.xmlQ修改如下内容:(x)
<UriGroup Name="default_host_eos_URIs"> <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/*.jsp"/> <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/*.do"/> <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/eosmgr/*"/> <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/axis/*"/> <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/axis2/*"/> <Uri AffinityCookie="JSESSIONID" AffinityURLIdentifier="jsessionid" Name="/eoshome_deploy/*"/> </UriGroup>
也可以通过修改WEB-INF下ibm-web-ext.xmi中的fileServingEnabled为falseQ然后重新生成plugin-cfg.xmlQ但是我试了一下好像不好用?/p>
另外WebsphereQfixpacks 5.1.1.17, 6.0.2.25 and 6.1.0.15Q之后的版本lWebcontainer增加了一个自定义参数
com.ibm.ws.webcontainer.disallowAllFileServing
讑֮它ؓ(f)true产生同样的效果(而且他会(x)覆盖ibm-web-ext.xmi中的讄Q?/p>
2、拷贝你的所有资源文件到IHS的Root Directory?/p>
3、重启IHS
在应用用过E中Q我们经怼(x)到应用响应旉很慢Q甚x有响应,但是应用服务器可能ƈ不是很繁忙,cpu利用率也非常低,引vq种状况的原因有很多U,比如环境问题Q应用资源泄漏,数据库原因等{,本文主要是从一ơ应用性能诊断q程来谈谈如何通过数据库诊断应用性能问题?/p>
问题Q?/p>
试q程中发现应用中某个跌{面执行旉比较长,pȝ压力不大Qcpu利用很低Q该面需要从cache中取数据Q第一ơ的时候加载cacheQ从数据库中查询回数据ƈcacheQ?/p>
诊断Q?/p>
面逻辑比较单,我们先用loadrunner模拟q发试一下这个页面,然后再数据库端捕获sql执行情况?/p>
1、打开db2监控开?/p>
#db2 connect to eos
#db2 update monitor switches using statement on
#db2 reset monitor all
2、几分钟之后Q我们收集sqll计快照
#db2 get snapshot for dynamic sql on eos > dysqlstatus.out
现在l计信息已经存放在dysqlstatus.out中,你可以用Q意方便的文本处理工具查看Q我一般用windows上的gvim来处理,打开dysqlstatus.out
Number of executions = 1
Number of compilations = 1
Worst preparation time (ms) = 2
Best preparation time (ms) = 2
Internal rows deleted = 0
Internal rows inserted = 0
Rows read = 2
Internal rows updated = 0
Rows written = 0
Statement sorts = 0
Statement sort overflows = 0
Total sort time = 0
Buffer pool data logical reads = Not Collected
Buffer pool data physical reads = Not Collected
Buffer pool temporary data logical reads = Not Collected
Buffer pool temporary data physical reads = Not Collected
Buffer pool index logical reads = Not Collected
Buffer pool index physical reads = Not Collected
Buffer pool temporary index logical reads = Not Collected
Buffer pool temporary index physical reads = Not Collected
Total execution time (sec.ms) = 0.000377
Total user cpu time (sec.ms) = 0.010000
Total system cpu time (sec.ms) = 0.000000
Statement text = select ACTIVITYDEFID,ACTIVITYINSTID from wfworkitem wherePROCESSINSTID=104199 and CURRENTSTATE = 4
......
单说一下vi中的处理
:g!/Total execution time/d
只保留文本中的sql执行旉Q我们要按照执行旉来排?br>
通过vim的visual功能选择执行旉块({号后面的数字)Q然后排?br> Total execution time (sec.ms) = 0.050590
Total execution time (sec.ms) = 0.000170
Total execution time (sec.ms) = 0.000247
Total execution time (sec.ms) = 0.000292
Total execution time (sec.ms) = 0.000474
Total execution time (sec.ms) = 0.000330
Total execution time (sec.ms) = 0.000348
Total execution time (sec.ms) = 0.000279
Total execution time (sec.ms) = 0.000385
Total execution time (sec.ms) = 0.000296
Total execution time (sec.ms) = 0.000261
Total execution time (sec.ms) = 0.000195
Total execution time (sec.ms) = 0.000226
Total execution time (sec.ms) = 0.000227
Total execution time (sec.ms) = 0.000193
......
:'<,'>!sort
排序后的l果Q部分)
Total execution time (sec.ms) = 2.027776
Total execution time (sec.ms) = 2.203624
Total execution time (sec.ms) = 2.504677
Total execution time (sec.ms) = 2.951256
Total execution time (sec.ms) = 3.119875
Total execution time (sec.ms) = 3.303277
Total execution time (sec.ms) = 3.303517
Total execution time (sec.ms) = 4.017133
Total execution time (sec.ms) = 4.043329
Total execution time (sec.ms) = 4.252125
Total execution time (sec.ms) = 4.400952
Total execution time (sec.ms) = 4.606765
Total execution time (sec.ms) = 5.208087
Total execution time (sec.ms) = 5.778598
Total execution time (sec.ms) = 8.117470
Total execution time (sec.ms) = 9797.905136
可以看到最长时间的sql total执行旉耗费?797.905123s.
现在我们到dysqlstatus.out中去找这条语?/p>
Number of executions = 4602
Number of compilations = 4294967295
Worst preparation time (ms) = 2
Best preparation time (ms) = 2
Internal rows deleted = 0
Internal rows inserted = 0
Rows read = 2963688
Internal rows updated = 0
Rows written = 0
Statement sorts = 0
Statement sort overflows = 0
Total sort time = 0
Buffer pool data logical reads = Not Collected
Buffer pool data physical reads = Not Collected
Buffer pool temporary data logical reads = Not Collected
Buffer pool temporary data physical reads = Not Collected
Buffer pool index logical reads = Not Collected
Buffer pool index physical reads = Not Collected
Buffer pool temporary index logical reads = Not Collected
Buffer pool temporary index physical reads = Not Collected
Total execution time (sec.ms) = 9797.905136
Total user cpu time (sec.ms) = 9.290000
Total system cpu time (sec.ms) = 1.230000
Statement text = select * from XXXX_T_CNFACTIVITYDEF
q条语句d执行?602ơ,q_每次的执行时?SQ而且q些数据应该是被cacheh?nbsp; Q)
ȝQ?/p>
上面的方法简单ȝ了从数据库层面对应用的性能问题诊断Q希望对大家有所帮助Q对于数据库快照诊断问题的思\对于L数据库通用
补充一个unix上脚本处理方式:(x)
sqlsort.sh
awk 'BEGIN{RS="";FS="\n";ORS="\n"};/Statement text/{print $1, $21, $24}' $1 | awk '$5 > 0 {print "AvgTime:", $11/$5, "\t", $0}'| sort -n | head -n $2|awk '{print $0, "\n"}'
在应用中Q我们经怼(x)到sql执行很慢Q但是数据库cpu和内存用率又不高的情况Q类似的问题基本上由于锁Q排序等原因造成Q本文主要描q如何去定位锁等待问题,谁在锁等待?{待谁持有的锁?锁在那个表?
一、测试准?/p>
1、先在session1执行如下操作Q创建测试表
#db2 connect to eos #export DB2OPTIONS=+C #db2 "create table tacy_test (a int not null primary key,b varchar(10))" #db2 "insert into tacy_test values(1,'a')" #db2 "insert into tacy_test values(2,'a')" #db2 "insert into tacy_test values(3,'a')" #db2 "insert into tacy_test values(4,'a')" #db2 commit
2、在session2执行如下操作
#db2 connect to eos #export DB2OPTIONS=+C
二、生一个lock wait
在session1做一个表更新Q?/p>
#db2 "update tacy_test set b='b' where a=4"
#db2 "update tacy_test set b='c' where a=4"
q程被挂L(fng)?/p>
三、定位锁{待
1、先来看看应用的情况Q?/p>
#db2pd -db eos -applications Database Partition 0 -- Database EOS -- Active -- Up 0 days 07:37:37 Applications: Address AppHandl [nod-index] NumAgents CoorPid Status C-AnchID C-StmtUID L-AnchID L-StmtUID Appid 0x10140040 8 [000-00008] 1 8425 Lock-wait 80 2 66 1 *LOCAL.db2inst1.071124043739 0x100CE540 7 [000-00007] 1 8358 UOW-Waiting 0 0 80 2 *LOCAL.db2inst1.071124043708
可以看到有一个应用的状态处于Lock-wait
2、现在我们来看看应用在等什?/p>
#db2pd -db eos -locks showlock wait Database Partition 0 -- Database EOS -- Active -- Up 0 days 07:42:56 Locks: Address TranHdl Lockname Type Mode Sts Owner Dur HldCnt Att Rlse 0x2C8E0760 3 02001806078066020000000052 Row ..X W 2 1 0 0 0x0 TbspaceID 2 TableID 1560 RecordID 0x2668007
锁的cd为RowQ行锁)QX锁(排他锁)Q下面是我们最兛_的锁的位|?/p>
TbspaceID 2 TableID 1560 RecordID 0x2668007
其中TbspaceIDI间IDQTableID的IDQRecordID代表具体位置Q全部应该是0x0266807,其中前面三个字节为page numberQؓ(f)0x02668Q后面一个字节代表solt identifierQؓ(f)0x073、找到相应的?/p>
#db2 "select tbspace,tabschema,tabname,tableid,tbspaceid from syscat.tables where tbspaceid=2 and tableid=1560"
TBSPACE TABSCHEMA TABNAME TABLEID TBSPACEID
------------ ----------- ---------- ------- ---------
USERSPACE1 DB2INST1 TACY_TEST 1560 2
1 record(s) selected.
4、根据RecordID扑ֈ锁在哪行
db2提供了一个强大的数据分析工具db2dartQ可以dump出相应的page数据
#db2dart eos /dd /tsi 2 /oi 1560 /ps 157312p /np 1 /v y Warning: The database state is not consistent. Warning: Reorg rows MAY be due to the inconsistent state of the database. DB2DART Processing completed with warning(s)! Complete DB2DART report found in: /home/db2inst1/sqllib/db2dump/DART0000/EOS.RPT
其中tsiI间id(2)Qoiid(1560)Qps为page number(0x0266807)Q需要{换ؓ(f)十进Ӟ在结ֿdpQnp代表你要获取的页敎ͼv为是否详l输?/p>
现在我们来看看EOS.RPT
______________________________________________________________________________ _______ DART _______ D a t a b a s e A n a l y s i s a n d R e p o r t i n g T o o l IBM DB2 6000 ______________________________________________________________________________ DART (V8.1.0) Report: 2007-11-24-20.59.51.355893 Database Name: EOS Report name: EOS.RPT Old report back-up: EOS.BAK Database Subdirectory: /opt/db2/db2inst1/NODE0000/SQL00001 Operational Mode: Database Inspection Only (INSPECT) ______________________________________________________________________________ ------------------------------------------------------------------------------ Action option: DD Table-object-ID: 1560; Tablespace-ID: 2; First-page: 157312p; Number-pages: 1; Verbose: y Warning: The database state is not consistent. Warning: Reorg rows MAY be due to the inconsistent state of the database. Connecting to Buffer Pool Services... Table object report phase start. Dump format is verbose. ______________________________________ Page 0 of object 1560 from table space 2. BPS Page Header: Page Data Offset = 48 Page Data Length = 4048 Page LSN = 0000 AE97 AE41 Object Page Number = 0 Pool Page Number = 157312 Object ID = 1560 Object Type = Data Object Data Page Header: Slot Count = 8 Total Free Space = 2784 Total Reserve Space = 0 Youngest Reserve Space = n/a Youngest TID = n/a Free Space Offset = 2799 Maximum Record Size = 23 Data Records: Slot 0: Offset Location = 3996 (xF9C) Record Length = 32 (x20) Record Type = Data Object Header Control Record Page count = 1 Object Creation LSN = 0000 AE97 800C Object State = x0000 UDI Since Runstats = 0 DART Field = x00000000 Slot 1: Offset Location = 2992 (xBB0) Record Length = 1004 (x3EC) Record Type = Free Space Control Record Free space entries: 0: 2884 (x0B44), 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC) 4: 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC) 8: 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC) 省略。。? 492: 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC) 496: 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC), 4028 (x0FBC) Slot 2: Offset Location = 2916 (xB64) Record Length = 76 (x4C) Record Type = Table Directory Record MetaIndex Root Page = 157377 Index Type = 2 Table Descriptor Pointer -- Page 157312 Slot 3 Max Insert Search = 0 Flags = x02000200 bit representation = 00000010 00000000 00000010 00000000 Check pending info: Constraint status = x00 Constraint RID = Page 0 Slot 0 last BID = x00000000 Slot 3: Offset Location = 2892 (xB4C) Record Length = 24 (x18) Record Type = Table Description Record Number of Columns = 2 Column 1: Type is Long Integer Length = 4 Prohibits NULLs Prohibits Default Fixed offset: 0 Column 2: Type is Fixed Length Character String Length = 10 Allows NULLs Prohibits Default Fixed offset: 4 Slot 4: Offset Location = 2869 (xB35) Record Length = 23 (x17) Record Type = Table Data Record (FIXEDVAR) Fixed part length value = 15 Column 1: Fixed offset: 0 Type is Long Integer Value = 1 Column 2: Fixed offset: 4 Type is Fixed Length Character String 61202020 20202020 2020 a Slot 5: Offset Location = 2846 (xB1E) Record Length = 23 (x17) Record Type = Table Data Record (FIXEDVAR) Fixed part length value = 15 Column 1: Fixed offset: 0 Type is Long Integer Value = 2 Column 2: Fixed offset: 4 Type is Fixed Length Character String 61202020 20202020 2020 a Slot 6: Offset Location = 2823 (xB07) Record Length = 23 (x17) Record Type = Table Data Record (FIXEDVAR) Fixed part length value = 15 Column 1: Fixed offset: 0 Type is Long Integer Value = 3 Column 2: Fixed offset: 4 Type is Fixed Length Character String 61202020 20202020 2020 a Slot 7: Offset Location = 2800 (xAF0) Record Length = 23 (x17) Record Type = Table Data Record (FIXEDVAR) Fixed part length value = 15 Column 1: Fixed offset: 0 Type is Long Integer Value = 4 Column 2: Fixed offset: 4 Type is Fixed Length Character String 61202020 20202020 2020 a Slots Summary: Total=8, In-use=8, Deleted=0. Table object report phase end. ______________________________________ DB2DART Processing completed with warning(s)! Warning(s) detected during processing. ______________________________________ Complete DB2DART report found in: /home/db2inst1/sqllib/db2dump/DART0000/EOS.RPT _______ D A R T P R O C E S S I N G C O M P L E T E _______
扑ֈSolt 7 (0x07)QokQ你现在可以清楚的知道应用等待的Row?4,a)
ȝ
通过上面的方法,我们单描qC一个db2锁问题的定位Ҏ(gu)Q希望能l大家在分析和定位应用性能问题的时候vC定的帮助
一Q基本介l?/strong>
在Loadrunner的用中Q对于Run-time Settings下的browser emulation讄是比较容易让Z生困惑的地方。下面我们结合sniffer来具体看看每个选项的用途,以及(qing)Ҏ(gu)试的影响?
Browser Emulation ?/p>
二:(x)案例和工?/strong>
1. 试案例Q?/b>
打开|站首页两次Q对比不同Browser Emulation讄下loadrunner的行为,脚本如下?
Action() { web_url("www.primeton.com", "URL=http://www.primeton.com/", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t2.inf", "Mode=HTML", LAST); web_url("www.primeton.com", "URL=http://www.primeton.com/", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t2.inf", "Mode=HTML", LAST); return 0; }
2. sniffer工具
开源工P(x)Wireshark(前n是ethereal)Qwww.wireshark.orgQ?
三:(x)试q程
Z方便描述Q我们约定用Q?
A代表Simulate browser cache
B代表Cache URLs requiring content(HTMLs)
C代表Check for newer versions of stored pages every visit to the page
D代表Download non-HTML resources
E代表Simulate a new user on each iteratioin
F代表Clear cache on each iteration
首先讄Run Logic中的iteration?。让Actionq行两次Q看看@环运行脚本两ơ,数据包和q接数的变化?
1. L所有选项
l果Q共获取数据?5个,建立q接1个(U色标识Q,断开q接1个(蓝色标识Q?
No. Time Source Destination Protocol Info 1 0.000000 192.168.1.61 203.81.29.137 TCP 13835 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 2 0.036053 203.81.29.137 192.168.1.61 TCP http > 13835 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 92 1.415887 192.168.1.61 203.81.29.137 TCP 13835 > http [FIN, ACK] Seq=817 Ack=71762 Win=257760 Len=0 94 1.449960 203.81.29.137 192.168.1.61 TCP http > 13835 [FIN, ACK] Seq=71762 Ack=818 Win=16464 Len=0
在这U情况下Q数据包非常(没有选择下蝲资源文g入css,js,gif{)Q而且你可以看刎ͼ打开4ơ首,只徏立了一个tcpq接?
q时Q你即选择AQ发现数据包的数量量|有变化,因ؓ(f)cache主要q是针对资源文g
2. 选择E(F)
l果Q共获取数据?02个,建立q接2个(U色标识Q,断开q接2个(蓝色标识Q?/p>
No. Time Source Destination Protocol Info 1 0.000000 192.168.1.61 203.81.29.137 TCP 13886 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 2 0.037013 203.81.29.137 192.168.1.61 TCP http > 13886 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 48 0.618117 192.168.1.61 203.81.29.137 TCP 13886 > http [FIN, ACK] Seq=409 Ack=35882 Win=257760 Len=0 49 0.644106 192.168.1.61 203.81.29.137 TCP 13887 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 51 0.651919 203.81.29.137 192.168.1.61 TCP http > 13886 [FIN, ACK] Seq=35882 Ack=410 Win=16872 Len=0 53 0.676377 203.81.29.137 192.168.1.61 TCP http > 13887 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 99 1.310379 192.168.1.61 203.81.29.137 TCP 13887 > http [FIN, ACK] Seq=409 Ack=35882 Win=257760 Len=0 101 1.347949 203.81.29.137 192.168.1.61 TCP http > 13887 [FIN, ACK] Seq=35882 Ack=410 Win=16872 Len=0
在这U情况下Q数据包非常(没有选择下蝲资源文g入css,js,gif{)Q对比第一U情况,你会(x)发现它徏立了两个q接Q这是E的作用,它对于每ơP代都当成一个新的用P需要重新徏立连接?
3. 选择DE(F)
l果Q共获取数据?782个,建立q接6个(U色标识Q,断开q接6个(蓝色标识Q?/p>
No. Time Source Destination Protocol Info 1 0.000000 192.168.1.61 203.81.29.137 TCP 14016 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 2 0.037911 203.81.29.137 192.168.1.61 TCP http > 14016 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 6 0.107432 192.168.1.61 203.81.29.137 TCP 14017 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 9 0.141816 203.81.29.137 192.168.1.61 TCP http > 14017 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 426 3.334889 192.168.1.61 203.81.29.137 TCP 14017 > http [FIN, ACK] Seq=1852 Ack=150284 Win=257484 Len=0 428 3.372253 203.81.29.137 192.168.1.61 TCP http > 14017 [FIN, ACK] Seq=150284 Ack=1853 Win=16998 Len=0 448 4.395488 192.168.1.61 203.81.29.137 TCP 14020 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 457 4.439604 203.81.29.137 192.168.1.61 TCP http > 14020 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 859 7.593610 192.168.1.61 203.81.29.137 TCP 14016 > http [FIN, ACK] Seq=2849 Ack=377404 Win=257484 Len=0 870 7.659680 203.81.29.137 192.168.1.61 TCP http > 14016 [FIN, ACK] Seq=377404 Ack=2850 Win=15935 Len=0 888 8.511308 192.168.1.61 203.81.29.137 TCP 14020 > http [FIN, ACK] Seq=1602 Ack=208150 Win=257760 Len=0 890 8.549451 203.81.29.137 192.168.1.61 TCP http > 14020 [FIN, ACK] Seq=208150 Ack=1603 Win=17280 Len=0 892 8.566246 192.168.1.61 203.81.29.137 TCP 14022 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 893 8.601893 203.81.29.137 192.168.1.61 TCP http > 14022 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 899 8.702628 192.168.1.61 203.81.29.137 TCP 14023 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 904 8.741807 203.81.29.137 192.168.1.61 TCP http > 14023 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 1298 11.809456 192.168.1.61 203.81.29.137 TCP 14022 > http [FIN, ACK] Seq=1550 Ack=159770 Win=257484 Len=0 1310 11.878665 203.81.29.137 192.168.1.61 TCP http > 14022 [FIN, ACK] Seq=159770 Ack=1551 Win=17280 Len=0 1341 12.771707 192.168.1.61 203.81.29.137 TCP 14026 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 1348 12.813950 203.81.29.137 192.168.1.61 TCP http > 14026 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 1759 16.032952 192.168.1.61 203.81.29.137 TCP 14023 > http [FIN, ACK] Seq=3151 Ack=367918 Win=257484 Len=0 1761 16.068296 203.81.29.137 192.168.1.61 TCP http > 14023 [FIN, ACK] Seq=367918 Ack=3152 Win=17280 Len=0 1779 16.983042 192.168.1.61 203.81.29.137 TCP 14026 > http [FIN, ACK] Seq=1602 Ack=208150 Win=257760 Len=0 1781 17.016836 203.81.29.137 192.168.1.61 TCP http > 14026 [FIN, ACK] Seq=208150 Ack=1603 Win=17280 Len=0
在这U情况下Q数据包的数量非常大Q连接也很多Q由于没有cache功能Q每ơ打开面都需要重C载所有的资源文g?
4. 选择ADE
l果Q共获取数据?25个,建立q接3个,断开q接3?不再标识了,syn即ؓ(f)q接hQfin即ؓ(f)断开hQ?/p>
No. Time Source Destination Protocol Info 1 0.000000 192.168.1.61 203.81.29.137 TCP 14189 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 2 0.033657 203.81.29.137 192.168.1.61 TCP http > 14189 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 6 0.100636 192.168.1.61 203.81.29.137 TCP 14190 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 9 0.133703 203.81.29.137 192.168.1.61 TCP http > 14190 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 429 3.383748 192.168.1.61 203.81.29.137 TCP 14190 > http [FIN, ACK] Seq=1852 Ack=150284 Win=257484 Len=0 431 3.418556 203.81.29.137 192.168.1.61 TCP http > 14190 [FIN, ACK] Seq=150284 Ack=1853 Win=16998 Len=0 471 4.352071 192.168.1.61 203.81.29.137 TCP 14189 > http [FIN, ACK] Seq=1504 Ack=235576 Win=257760 Len=0 472 4.380312 192.168.1.61 203.81.29.137 TCP 14192 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 474 4.389778 203.81.29.137 192.168.1.61 TCP http > 14189 [FIN, ACK] Seq=235576 Ack=1505 Win=17280 Len=0 476 4.413220 203.81.29.137 192.168.1.61 TCP http > 14192 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 522 5.078068 192.168.1.61 203.81.29.137 TCP 14192 > http [FIN, ACK] Seq=409 Ack=35882 Win=257760 Len=0 524 5.115099 203.81.29.137 192.168.1.61 TCP http > 14192 [FIN, ACK] Seq=35882 Ack=410 Win=16872 Len=0
在这U情况下Qcache发挥作用Q数据包Ҏ(gu)W三U情况大大减,几乎{于打开一ơ首늚数据量(449个数据包Q,只有W一ơ打开面需要完整下载页面(包括资源文gQ,后面的三ơ打开面都只要下载HTML面Q不包括资源文gQ?
5. 选择ADEF
选择F之后我们看看l果Q共获取数据?42个,建立q接4个,断开q接4?/p>
No. Time Source Destination Protocol Info 1 0.000000 192.168.1.61 203.81.29.137 TCP 14292 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 2 0.034524 203.81.29.137 192.168.1.61 TCP http > 14292 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 6 0.102314 192.168.1.61 203.81.29.137 TCP 14294 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 9 0.139752 203.81.29.137 192.168.1.61 TCP http > 14294 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 426 3.791111 192.168.1.61 203.81.29.137 TCP 14294 > http [FIN, ACK] Seq=1852 Ack=150284 Win=257484 Len=0 428 3.824970 203.81.29.137 192.168.1.61 TCP http > 14294 [FIN, ACK] Seq=150284 Ack=1853 Win=16998 Len=0 468 6.213276 192.168.1.61 203.81.29.137 TCP 14292 > http [FIN, ACK] Seq=1504 Ack=235576 Win=257760 Len=0 469 6.244052 192.168.1.61 203.81.29.137 TCP 14297 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 471 6.249564 203.81.29.137 192.168.1.61 TCP http > 14292 [FIN, ACK] Seq=235576 Ack=1505 Win=17280 Len=0 473 6.279647 203.81.29.137 192.168.1.61 TCP http > 14297 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 479 6.374967 192.168.1.61 203.81.29.137 TCP 14298 > http [SYN] Seq=0 Len=0 MSS=1460 WS=2 484 6.419597 203.81.29.137 192.168.1.61 TCP http > 14298 [SYN, ACK] Seq=0 Ack=1 Win=17280 Len=0 MSS=1440 WS=0 897 9.858493 192.168.1.61 203.81.29.137 TCP 14297 > http [FIN, ACK] Seq=1550 Ack=159770 Win=257484 Len=0 899 9.895188 203.81.29.137 192.168.1.61 TCP http > 14297 [FIN, ACK] Seq=159770 Ack=1551 Win=17280 Len=0 939 12.840029 192.168.1.61 203.81.29.137 TCP 14298 > http [FIN, ACK] Seq=1806 Ack=226090 Win=257760 Len=0 941 12.876120 203.81.29.137 192.168.1.61 TCP http > 14298 [FIN, ACK] Seq=226090 Ack=1807 Win=17076 Len=0
在这U情况下Q由于选择了FQ在q代的时候清除了cacheQ所以每ơP代都需要重C载资源文件。数据包差不多等于第三种情况的一半,U等于打开两次首页的数据量Q?49×2个数据包Q?
6. 关于BC选项
C的解释(Check for newer versions of stored pages every visit to the pageQ?/i>
C比较Ҏ(gu)理解Q类似IE讄中的每次查,如果不设|CQLR对于已经cache的文件就不会(x)重新向服务器hQ如果选择CQ你可以在数据包中发现很多304信息?
B的解释(Cache URLs requiring content(HTMLs)Q?/i>
LR对于资源文g的cacheq不?x)真正cache在内存中或者在盘上,q个选项表示Q对于一些需要用到的兌Q校验,面解析内容真正cache在内存中Q减客L(fng)的重复工作?
当然如果你想把GIF也cache到内存中Q你可以在Advanced中设|,选择Specify URL requiring content in addition to HTML pagesQ加入条目image/gifQƈN。当Vuserq行的时候,你可以对比一下mmdrv.exeq程的内存消耗(内存占用?x)更多)?
四:(x) l论
通过上面的测试分析,我们大概知道了每个选项的真正含义,你需要根据你的测试目的来选择合适的讄Q?
1?对于一个具体的应用试Q对于前端Web Server不可忽略Q缺省设|非常合适,不需要调_(d)有时候需要考虑把C选上Q?
注意Q很多h在录制脚本的时候,?fn)惯把登入操作放到vuser_init中,q时候缺省设|可能会(x)抛错Q徏议把q类的操作都攑օ到action?
2?如果你更x后端应用服务器的性能或者说做一些架构的验证分析Q那你缺省设|对于你来说׃合适了Q你需要选择取消所有的讄V?
当然你也可以Ҏ(gu)自己的具体情况做不同调整Q但是一定要真正理解q些选项的具体含义才能做C犯错?/p>
试一D|间后应用无响应,q接池不能放大,jvm crashQ日志报对象分配p|
问题诊断Q?/p>
W一个阶D|websphere问题
到现Z后,回放脚本试几分钟,应用开始无法响应,后台也没有异常,update jdk之后Q系l能正常响应了,但是发现新的问题Qdb2q接池始l无法放大,最大只能到30Q而且pȝ也会(x)抛OOMQ导致系l异常推出,从系l日志看Q是因ؓ(f)应用中的大对象分配导致的Q?M大小Q?/p>
期间Q关于连接池无法攑֤问题想了很多办法Q包括修改db2 maxappls,maxagentsq些参数Q更新数据库驱动Q而且定不是db2的问题(在创?0之后Q我们依然可以通过其他方式q接到db2Q说明db2的连接限制确实放大了Q,当然我们productdatasourceq个池子大小我已l放大到100了?/p>
中间q发现测试脚本没有正常启动流E,排查后发现是loadrunner的问题,用我机器上的lr录制正常Q错误代码提C是字段长度限制Q莫名其妙)?/p>
关于jvm crach我们也调整了heap讄Q?xms256m,-xmx1536m
但是问题依然存在。后面我们重新安装了应用Q所有的讄采用~省配置Q没有打M补丁Q系l这个时候竟然可以正常跑了,只是响应很慢Q而且旉曲线一直往上抛Q测试一D|间系l无响应Q?/p>
查了一下配|,发现productdatasource的缺省设|竟然就?0Q?strong>q个时候基本判断是之前的websphere的设|修Ҏ(gu)有生?/strong>
重新修改jvm和连接池配置Q这时候系l正常,数据q接也达?3个,然后开始测试大q发?/p>
阶段二就是调整数据库配置
1、第一个是db2 default buffer poolQ缺省配|buffer?mQ这个一定要注意修改
2、第二个是db2的lock数量Q在~省基础上好像放大了100?/p>
3、sort heapQ排序区Q防止排序溢出)
q些调整都要通过db2的状态来调整Q可以通过get snapshot指o(h)来获得数据库状态,buffer不够?x)出现大量的逻辑读,lock不够?x)抛lock溢出(?x)导致锁升Q,sort heap不够?x)提C排序溢出(q时候排序会(x)在硬盘做Q?/p>
回头看看q次支持Q?/p>
1、websphere配置修改不生效,我后面仔l想了想Q这个websphere很多公司用可能大安乱改了一通,另一问题是我们的使用?fn)惯Qwebsphere强烈不徏议用kill直接杀q程方式停服务器Qwebsphere不但是一个javaq程Q还有很多的附属q程Q直接kill也很Ҏ(gu)Dwebsphere不正?/p>
2、jvm crach问题Q这个我大家看看q篇文档http://www-1.ibm.com/support/docview.wss?rs=180&context=SSEQTP&q1=fragmentation
&uid=swg21176363&loc=en_US&cs=utf-8&lang=en
如何d位jvm问题Q首先看nativerr.log日志Q如果出现OOMQ这里会(x)有记录,当发现OOM的时候,可以打开jvm的verbosegcQ分析verbosegc和jvm dump fileQ上面文档里提到一个很重要的东西就是pinned对象Q这也是ibm为啥不徏议设|ms=mx的原因?/p>
db2 "create event monitor SQLCOST for statements write to file '/home/db2inst1'"
再设|事务状态ؓ(f)打开
db2 "set event monitor SQLCOST state=1"
注:(x)1为打开Q?为关闭,攉数据之后Q记得关闭你的监控器Q否则。。?/font> 跑你的测试后Q在你的/home/db2inst1目录下会(x)生成一些evm文g 用下面指令获取诊断信息:(x) db2evmon -db eos51 -evm SQLCOST>sqlcost1.txt 完成之后删除你的监控? db2 "drop event monitor SQLCOST" 生成的采样例子,从下面的例子中,你可以清除的看到SQL执行的时_(d)CPU消耗情况,排序是否溢出QBufferPool的用情况,Ҏ(gu)q些信息QSQL的执行效率一目了Ӟ(x) 26) Statement Event ... Appl Handle: 336 Appl Id: C0A80421.O905.0ABDA5065446 Appl Seq number: 0657 Record is the result of a flush: FALSE ------------------------------------------- Type : Dynamic Operation: Execute Section : 7 Creator : NULLID Package : SYSSN300 Consistency Token : SYSLVL01 Package Version ID : Cursor : SQL_CURSN300C7 Cursor was blocking: FALSE Text : update WFProcessInst set relateData=? where processInstID= ? ------------------------------------------- Start Time: 04/25/2007 14:57:19.402248 Stop Time: 04/25/2007 14:57:19.409622 Exec Time: 0.007374 seconds Number of Agents created: 1 User CPU: 0.000000 seconds System CPU: 0.000000 seconds [licl1] Fetch Count: 0 Total sort time: 0 Sort overflows: 0 [licl2] Rows read: 1 Rows written: 1 Internal rows deleted: 0 Internal rows updated: 0 Internal rows inserted: 0 Bufferpool data logical reads: 9 Bufferpool data physical reads: 0 Bufferpool temporary data logical reads: 0 Bufferpool temporary data physical reads: 0 Bufferpool index logical reads: 3 Bufferpool index physical reads: 0 Bufferpool temporary index logical reads: 0 Bufferpool temporary index physical reads: 0 [licl3] SQLCA: sqlcode: 0 sqlstate: 00000 [licl1]SQL执行旉和CPU消耗情? [licl2]SQL的排序情况,可以看到q个SQL没有排序Q当然也没有排序溢出 [licl3]Bufferpool的用情况,逻辑d物理ȝҎ(gu)
]]>
单介l一下Loadrunner Analysis中的Web Page Diagnostics模块的用,很多人对于测试之后的l果数据分析怸着头脑Q其实loadrunner Analysisl你提供了很好的文档Q大家没事可以多ȝQ多d遍对于性能试你就入门?Q)
Web Page Diagnostics Q以下简UWPDQ,q是LR Analysis中非帔R要的一块,搞清楚这部分的内容会(x)让你走很多弯\Q很多环境问题都可以通过它来定位Q比如客L(fng)Q网l。通过它可以你可以比较好的来定位是环境的问题还是应用本w的问题Q当然更重要的是Web面本n的问题?/p>
WPD包括下面几个图表Q?/p>
Web Page Diagnostics q是张dQ包括下面几张Over Time囄内容
Page Component Breakdown 面中每个元素的q_响应旉占整个页面响应时间的癑ֈ?/p>
Page Component Breakdown(Over Time) 在整个测试过E中QQ意一U内面中每个元素的响应旉Q例如在runtime中设|了browser cacheQ页面中的资源文件就只会(x)在第一ơ下载,后面的页面响应时间也׃包括q些元素的时_(d)q在Page Component Breakdown中是看不出来的,因ؓ(f)Page Component Breakdown是整个测试期间内的^均时间。当Ӟ是否启用了cacheQ通过over time囑ְ能看出来Q?/p>
Page Download Time Breakdown 面中每个元素的响应旉分割图,响应旉被分割ؓ(f)以下几个部分QDNS Resolution,Connection,First Buffer,SSL Handshaking,Receive,FTP Authentication,Client,Error
Page Download Time Breakdown(Over Time) 在整个测试过E中QQ意一U内面中每个元素的响应旉分割?/p>
Time to First Buffer Breakdown First Buffer Time旉分割为Network Time和Server TimeQ客L(fng)httph发送到接收到服务器端的应答包(ACKQؓ(f)Network TimeQ从接收到ACK到完成First Buffer接受为Server Time
Time to First Buffer Breakdown(Over Time) 基本同上QQ意一U内?/p>
Downloaded Component Size(KB) 面中每个元素的大小QKBQ?/p>
介绍了这么多Q具体如何分析呢Q?/p>
首先打开Web Page Diagnostics图,来看看下面一个例子Download Time图:(x)
上图存在两个问题Q?/p>
1、receive旉很长
q个一般是|络问题Q当然如果你认|络不存在问题,那么你就要看看是不是客户端的问题Q客L(fng)也可能会(x)造成Receiveq长Q这个千万要注意Q?/p>
2、页面问?/p>
面上包括了非常多的囄Q而且囄g都没有优化,最大的竟然?63KQ记下来Q这可是|证?Q)
很多时候,你可以根据DNS,Connection,Receive来看出是否存在网l问题,Ҏ(gu)Client来判断是否存在客L(fng)问题?/p>
看看Q挺单的吧! ^_^
换个囄看,Page Component Breakdown(Over Time)
很清楚吧Q页面元素都被cache了,说明场景启用了browser cacheQ页面的响应旉只包括红U和蓝线?/p>
Time to First Buffer Breakdown(Over Time) Q图׃贴了Q这个图非常重要Q也最复杂Q这里的gl对Q当|络状况不好的时候,server time很可能包括网l时_(d)因ؓ(f)很多面元素比较?yu)(?k的样子)Q在First Buffer完成传输,所以一定要注意分析?/p>
唠叨到q里吧,Ƣ迎拍砖
<container-descriptor>
servlet-reload-check-secs
The <servlet-reload-check-secs> element defines whether a WebLogic Server will check to see if a servlet has been modified, and if it has been modified, reloads it.
The value -1 means never check the servlets. This is the default value in a production environment.
The value 0 means always check the servlets.
The value 1 means check the servlets every second. This is the default value in a development environment.
A value specified in the console will always take precedence over a manually specified value.
resource-reload-check-secs
The <resource-reload-check-secs> element is used to perform metadata caching for cached resources that are found in the resource path in the Web application scope. This parameter identifies how often WebLogic Server checks whether a resource has been modified and if so, it reloads it.
The value -1 means metadata is cached but never checked against the disk for changes. In a production environment, this value is recommended for better performance.
The value 0 indicates not to do any metadata caching. Customers who keep changing their files must set this parameter to a value greater than or equal to 0.
The value 1 means reload every second. This is the default value in a development environment.
Values specified for this parameter using the Admin Console are given precedence.
native-io-enabled
To use native I/O while serving static files with weblogic.servlet.FileServlet, which is implicitly registered as the default servlet, set native-io-enabled to true. (The default value is false.) native-io-enabled element applies only on Windows.
<jsp-descriptor>
page-check-seconds
Sets the interval, in seconds, at which WebLogic Server checks to see if JSP files have changed and need recompiling. Dependencies are also checked and recursively reloaded if changed.
The value -1 means never check the pages. This is the default value in a production environment.
The value 0 means always check the pages.
The value 1 means check the pages every second. This is the default value in a development environment.
In a production environment where changes to a JSP are rare, consider changing the value of pageCheckSeconds to 60 or greater, according to your tuning requirements.
讄Initial Capacity{于Maximum Capacity
讄Statement cacheQ注意,对于每个打开的statementQDBMS都会(x)l护一个cursorQ这个D|过大会(x)D java.sql.SQLException: ORA-01000: maximum open cursors exceededcM的错误。当Ӟ你要清楚Qstatement cache的大是指每个连接能cache的statement敎ͼ例如你设|connection pool size = 100 ,讄Statement Cache = 10Q那pȝ最大维持的cursor?00*10Q?/p>
Enable Native IO Q注意,不是java的NIOQ采用Java muxer方式处理q接Q对于大q发的系l媄响巨大,java需要ؓ(f)每个q接h起一个线E来处理Q?/p>
修改Accept BacklogQ当应用服务器出现拒l连接的时?/p>
使用productmode启动weblogic
讄-xms{于-xmx
量使用jrockit
?版本以后Qweblogic用work manager取代了thread queueQ默认情况下Qweblogic有一个default work managerQ采用fair share方式q_׃nU程
一般你不需要自己创建work managerQ除非你有如下需求:(x)
你的应用有优先
你需要满SLA定义的响应时?/p>
需要指定最线E约束来避免服务器死?/p>
1、下?a >Ajax Viewq安装运行,它会(x)监听?888端口
2、打开IE或者FirefoxQ设|代理:(x)localhost:8888
3、打开你的ajax面Q执?/p>
4、另外开一个窗口,打开http://fakeurl.com/?&AJAXVIEWREQUEST=GET=main.html
5、选择左边的链接JS Performance StatisticsQ你可以看到具体的执行旉
延阅读Q?a title="http://www.fasterj.com/articles/javascript.shtml" >Javascript Performance