淘宝商城(天猫)高级技术专家.3年研发+3年性能测试调优/系统测试+4年团队管理与测试架构、研发系统实践. 新舞台新气象, 深化测试基础架构及研发架构,希望能在某个技术领域成为真正的技术大牛。欢迎荐才http://bbs.51testing.com/viewthread.php?tid=120496&extra=&page=1 .邮件: jianzhao.liangjz@alibaba-inc.com,MSN:liangjianzhao@163.com.微博:http://t.sina.com.cn/1674816524

发布新日志

  • 性能测试高端发展方向

    2008-02-20 22:28:55

    业界认为性能测试ROLE划分为 性能测试工程师(偏重编写性能测试脚本、性能测试执行) 和性能测试分析师 (偏重性能分析、系统调优,也需要更加广、深)的知识。

     根据个人的理解,性能测试高端发展有如下一些方向: 性能调优,架构评估,性能监控,容量规划,应用性能管理。

      性能调优偏重系统级调优、代码级调优,需要非常熟悉系统架构、profile工具(如jprof, gprof ) 。有开发背景的最合适往这个走。

      架构评估偏重参与项目前期,根据以前的性能测试经验以及教训判断架构合理性。以后进一步发展成系统架构师。

     性能监控就是充分应用现有的工具(如 rpc.rstatd, openview, sitesope,cacti等)以及扩展工具满足详细指标,并图形化展现 容量规划则根据现有系统能力开展what if分析(如增加cpu,更换吞吐率,甚至机型),推算if之后系统性能表现,需要很强的数学功底以及建模能力。目前比较好的工具有teamquest。国内广东电信研究院评测中心和上海电信都在用。

      应用性能管理,可以参考Mercury 的BAC产品,如何抢在用户之前主动发现网站或者业务瓶颈。 可以利用QTP/loadrunner的脚本结合sitescope 主动监控。 目前浙江移动已经实施。

  • 性能测试碰到的主要问题

    2008-01-10 14:15:56

    性能测试碰到的主要问题:

    1) 性能测试需求不够精细。对于新系统,缺乏一个相对科学的估算方法; 对运营系统,现有系统日志分析的PV 与 更关注的业务笔数不完全相等,开发工程师应该在访问日志中加入新的统计方法并且和数据仓库平台整合。
    2) 生产环境数据库多为 IBM P系列小型机以及IO能力强劲的存储设备。 测试环境在db、存储以及数据量方面的能力相差很大,硬件模拟成为一个瓶颈。对于新系统,如何构造相对合理的模拟数据也成为需要解决的问题。
    3) Loadrunner 无jboss ,jvm ,os 内存/网络、队列长度等更精细的监控指标,为了减少手工合并监控结果,需要统一集成如上指标到Loadrunner。
    4) 大型系统定位性能瓶颈耗时长,为了缩短定位瓶颈、性能调整的周期,建议在应用中加入代码探针,达到代码级别的监控。
    5) 网站查询系统已经涵盖os大部分性能指标,但尚缺少部分指标。
    6) 寻求服务器瓶颈资源临界点,需要多次试探适合的压力。为了减少手工干预,需要编程实现产生自适应压力,以及执行服务器的准备、清理等工作。
    7) 为了提升容量规划的准确度,需要寻求合适的方法论、建模工具以及长期的积累、修正。目前比较成熟的商业工具有teamquest ,开源工具java  model tool 具备初步的模拟、分析能力,但没有集成硬件能力参数库。如何整合、扩展各开源工具,将成为一个难点。

     

  • ipc 资源清理工具 c++ 实现

    2008-01-10 13:48:27

    #include <sys/shm.h>
    #include <stdlib.h>
    #include  <stdio.h>
    int main(int argc,char** argv)
    {
            if ( argc  < 1 )
            {
                printf("%s  十进制的keyid\r\n",argv[0]);
                return  -1;
            }
            key_t key = atol(argv[1]);
            int shmid;
           
            for(int i=0;i<100;i++) {
                    shmid=shmget(key,1024,0666);
                    shmctl(shmid,IPC_RMID,0);
                    key++;
            }
           return 0;
    }

     

  • ipc资源清理工具

    2008-01-10 13:46:26

    在linux 上测试程序,经常遇上没有正常退出程序,造成大量进程间资源未释放的情况。 下面的linux  shell 可以清除 ipc 资源。

    执行之后,可用ipcs 检查。

     

    #!/bin/sh
    #
    # $PostgreSQL: pgsql/src/bin/ipcclean/ipcclean.sh,v 1.15 2003/11/29 19:52:04 pgsql Exp $
    #

    CMDNAME=`basename $0`

    if [ "$1" = '-?' -o "$1" = "--help" ]; then
        echo "$CMDNAME cleans up shared memory and semaphores from aborted PostgreSQL"
        echo "backends."
        echo
        echo "Usage:"
        echo "  $CMDNAME"
        echo
        echo "Note: Since the utilities underlying this scrīpt are very different"
        echo "from platform to platform, chances are that it might not work on"
        echo "yours. If that is the case, please write to <pgsql-bugs@postgresql.org>"
        echo "so that your platform can be supported in the future."
        exit 0
    fi

    if [ "$USER" = 'root' -o "$LOGNAME" = 'root' ]
    then
      (
        echo "$CMDNAME: cannot be run as root" 1>&2
        echo "Please log in (using, e.g., \"su\") as the (unprivileged) user that" 1>&2
        echo "owned the server process." 1>&2
      ) 1>&2
        exit 1
    fi

    EffectiveUser=`id -n -u 2>/dev/null || whoami 2>/dev/null`

    #-----------------------------------
    # List of platform-specific hacks
    # Feel free to add yours here.
    #-----------------------------------
    #
    # This is QNX 4.25
    #
    if [ `uname` = 'QNX' ]; then
        if ps -eA  | grep -s '[p]ostmaster' >/dev/null 2>&1 ; then
            echo "$CMDNAME: a postmaster is still running" 1>&2
            exit 1
        fi
        rm -f /dev/shmem/PgS*
        exit $?
    fi
    #
    # This is based on RedHat 5.2.
    #
    if [ `uname` = 'Linux' ]; then
        did_anything=

        if ps x | grep -s '[p]ostmaster' >/dev/null 2>&1 ; then
            echo "$CMDNAME: a postmaster is still running" 1>&2
            exit 1
        fi

        # shared memory
        for val in `ipcs -m -p | grep '^[0-9]' | awk '{printf "%s:%s:%s\n", $1, $3, $4}'`
        do
            save_IFS=$IFS
            IFS=:
            set X $val
            shift
            IFS=$save_IFS
            ipcs_shmid=$1
            ipcs_cpid=$2
            ipcs_lpid=$3

            # Note: We can do -n here, because we know the platform.
            echo -n "Shared memory $ipcs_shmid ... "

            # Don't do anything if process still running.
            # (This check is conceptually phony, but it's
            # useful anyway in practice.)
            ps hj $ipcs_cpid $ipcs_lpid >/dev/null 2>&1
            if [ "$?" -eq 0 ]; then
                echo "skipped; process still exists (pid $ipcs_cpid or $ipcs_lpid)."
                continue
            fi

            # try remove
            ipcrm shm $ipcs_shmid
            if [ "$?" -eq 0 ]; then
                did_anything=t
            else
                exit
            fi
        done

        # semaphores
        for val in `ipcs -s -c | grep '^[0-9]' | awk '{printf "%s\n", $1}'`; do
            echo -n "Semaphore $val ... "
            # try remove
            ipcrm sem $val
            if [ "$?" -eq 0 ]; then
                did_anything=t
            else
                exit
            fi
        done

        [ -z "$did_anything" ] && echo "$CMDNAME: nothing removed" && exit 1
        exit 0
    fi # end Linux


    # This is the original implementation. It seems to work
    # on FreeBSD, SunOS/Solaris, HP-UX, IRIX, and probably
    # some others.

    ipcs | egrep '^m .*|^s .*' | egrep "$EffectiveUser" | \
    awk '{printf "ipcrm -%s %s\n", $1, $2}' '-' | sh

     

     

     

  • 性能测试执行检查列表

    2007-08-12 21:22:15

     1  性能测试执行检查概览

    从各个层面考虑。

    • 1) 需求、方案内容以及形式检查
    • 2) 系统各个组件检查
    • 3) Loadrunner场景设置、脚本、监控指标、负载生成机的核对

    •2         核对《性能测试需求》

    •2.1       用例选取

    至少包含关键业务、最常用的用例,用例步骤为用户常用访问路径

    建议用例包含部分用户放弃或者失败的操作步骤

    确认负载建模数据来源

    •2.2       并发用户数需求

    并发用户数一般为在线活跃用户的15~25%间。

    用户归类是否合理、访问路径是否典型等work load

    •2.3       响应时间需求

    结合web 8 minute rule对比

    •2.4       服务器资源利用率需求

    应低于业界同行认可的资源阀值。

    •2.4.1    Unix

    Load:  < 5* cpu颗数

    Cpu%: <80%

    内存:swap-in/out =0

    网络%: collision rate =0

    •2.4.2    Windows

    网络:

       网络利用率阀值没有统一。  <30% or 80%?

    冲突率: <1%

    Packets Received Errors < 1%

    I/O:

    Disk Time %  <90%

    Avg. Disk Bytes/Read +  Avg. Disk Bytes/Write <20K

    Avg. Disk sec/Transfer <0.3 sec

    队列长度:Queue Length <2

      Avg. Disk sec/Transfer <18 milliseconds

    内存:

    Available Mbytes  >25%

        page in+out  <20 次

    pool Nonpaged Bytes =0

    处理器:

    利用率 <85%

    每个CPU队列长度 <2

    Context Switches/sec <5000次 或者<5% of total threads

    •2.4.3    应用特有指标

    •3         核对《性能测试方案》

    •3.1       测试策略

    • 1) 场景与用例应有针对性地攻击系统性能薄弱环节,条件允许的话建议定位出负荷过大的临界点
    • 2) 测试实现手段成本效益分析,确认技术与时间可行性。对于加解密、随机码等技术环节,应尽早技术试验确认测试可行性。
    • 3) 总吞吐率确保至少高于现网生产环境负载或者未来运营负载,充分考虑未来3年负荷增长
    • 4) 至少一个运行长于8小时的峰值场景甚至overload场景,以便挖掘内存泄露
    • 5) 分析测试环境与生产环境(硬件、参数、数据量)差异,确认测试方案的能力与缺陷。尽量往生产环境靠拢(缩放或者mirror)。如果测试环境与生产环境差异太大,则必须分析性能测试风险,同时在性能测试报告中注明该限制
    • 6) 针对不同的应用,测试重心应略有侧重。 如EAI 侧重数据交换,数据仓库侧重SQL查询语句等
    • 7) 建议有一个大量vuser的场景,确认无connections限制及模拟现实的离散访问。
    • 8) 需求以及方案经过项目经理与开发工程师确认

    •4         核对操作系统

    Alibaba目前大部分系统采用linux os,少数数据库部署在aix上。

    •4.1       硬件配置

    Linux:

    处理器:Cat  /proc/cpuinfo

    内存:Cat  /proc/meminfo

           网络:mii-tool -v

        硬盘: mount 确认 -> scsi/sda -> /proc目录下找到硬盘厂家 ->查到读写能力指标

    •4.2       版本号

    Uname -a

    Cat  /etc/ redhat-release

    •4.3       系统参数

    Sysctl -a

    Ulimit  -a

    建议测试时ulimit  -c unlimited启动core dump生成选项

    •4.4       进程

    确认portmap、rpc.rstatd进程存活

    应关闭无关的应用进程,以免干扰资源利用率数据

    •4.5       端口

    开放111端口

    •4.6          分区硬盘空间

    Df  -m 确认增长最快的分区有足够的余量。

    •5         核对数据库

    Alibaba应用大部分部署在oracle上。目前最流行的版本有oracle 9i与oracle 10g。一般情况下,由系统管理员负责监控数据与性能变化。

    •5.1       版本号

    •5.2       部署模式

    确认部署模式为 dedicated or  share

    •5.3       配置参数

    InitSID.ora 或者动态配置的文件参数,确认日志归档模式、SQL跟踪等。

    •5.4       基础数据与测试数据尺寸

    利用SQL 语句统计基础数据,同时确认测试数据准备情况

    对于测试后产生大量中间数据的场景,每次测试完毕应清除中间数据

    •6         核对应用服务器

    •6.1       Jboss

    •6.1.1    版本号

    •6.1.2    部署模式

    •6.1.3    配置参数

    •6.2       Weblogic

    流行版本weblogic8.1 ,weblogic9

    •6.2.1    版本号

    http://IP:7001/console查看

    •6.2.2    部署模式

    采用开发模式 or 部署模式

    是否采用集群

    •6.2.3    配置参数

    分析启动配置文件startWebLogic.sh以及关联的配置文件setEnv.sh、config.xml,重点关注线程数、backlog长度、是否采用native io等。

    •6.3       Resin

    •6.3.1    版本号

    •6.3.2    部署模式

    •6.3.3    配置参数

    •7         核对web 服务器

    •7.1       apache

    •7.1.1    版本以及编译模式、模块

    版本:httpd -v

    编译模式:httpd -V

    模块:httpd -l

    •7.1.2    配置参数

    主要配置文件为:Httpd.conf。

    主要确认进程模型、 maxclient、timeout、是否采用SSL协议等等。

    •7.1.3    DSO模块版本

    察看loadModule 配置项核对 DSO。

    •7.1.4    日志级别及文件

    一般, 错误日志: logs/error_log,访问日志:access_log

    注意清理日志,防止过度膨胀。

    •7.1.5    是否采用Cache模块

    前端是否采用 squid或者其他cache服务。

    •7.1.6    内容

    是否包含图片,javascrīpt,applet等non-html资源。

    •7.2       tomcat

    •8         核对应用系统

    •8.1.1    版本号

    •8.1.2    核心功能可用性

    •9         审查性能测试工具

    •9.1       审查LoadRunner组件

    •9.1.1    场景设置

    • 1) 场景模式面向目标/手工是否与方案相符合
    • 2) Pacing
    • 3) Think-time (是否有必要忽略)
    • 4) Download non-html resource (视应用是否应当下载)
    • 5) Simulate a new user on each iteration(登录录制于action.c时应selected)
    • 6) Continue on error
    • 7) 存放测试结果目录所在磁盘空间是否足够

    •9.1.2    Web协议脚本

      脚本流程与用户访问路径一致

    • 1) 关键业务事务须有检查点(如web_reg_find)
    • 2) 参数化数据及设置与业务需求预期 (随机、unique)
    • 3) 必要的地方增加关联 (web_reg_save_param)
    • 4) 必要的地方增加http header (web_add_auto_header)
    • 5) 必要的地方增加超时设置 ( web_set_timeout)
    • 6) 必要的地方增加随机数 (srand,rand)

    •9.1.3    Socket协议脚本

    贸易通客户端与服务器交互采用socket协议录制。

    • 1) 脚本行为与用户访问路径一致
    • 2) 确保可以正确收发网络包

    •9.1.4    监控指标

    各个服务器以及负载生成机都应该监控。至少包含cpu,mem,io,network资源指标。

    •9.1.4.1       unix

    建议监控指标至少包含

    • 1) Average load
    • 2) Collision rate
    • 3) Cpu utilization
    • 4) Disk traffic
    • 5) Incoming packets error rate
    • 6) outcoming packets error rate
    • 7) page in rate
    • 8) page out rate
    • 9) swap in rate
    • 10) swap out rate

    若如上指标还无法满足定位瓶颈需求,则弃用loadrunner monitor监控,而采用sitescope监控更多指标( ssh+ linux command) 。一般额外监控的有

    可用内存、Iowait%。

                  对于对比性能测试,确保服务器资源有一定余量以满足Utilization Law定律。

    •9.1.4.2       windows

    建议监控指标至少包含

    • 1) Process time%( process_total)
    • 2) Process queue length(system)

    • 3) Available mbytes( memory)
    • 4) Pool nopaged bytes (memory)
    • 5) Pages sec (memory)
    • 6) Pool nonpaged failures(system)

    • 7) Disk time% (physicaldisk _total)
    • 8) Avg. disk queue length (physical _total)

    • 9) Bytes total/sec (network interface)

    •9.1.5    负载生成机

    • 1) Loadrunner结果存放临时目录: temporary storage location 所在分区空间足够大
    • 2) 确保测试执行过程中各项资源充足,可发出足够的请求压力
    • 3) 建议关闭防火墙、反病毒等软件
    • 4) 确保开放端口 54345以及另一个动态端口
    • 5) 确保进程 (m)mdrv.exe,lr_bridge,magentproc.exe(作为进程)/magentservice(作为服务),r_host_balancer.exe等进程存活
    • 6) 若安装loadrunner时选择:Manual log in to the Load Generator
    • 7) 时间与服务器同步。若要求严格同步,则建议安装ntp服务。

    目前alibaba仅采用windows平台作为load generator。

    •9.2       审查自主研发测试工具

    •9.2.1    评估架构与能力、缺陷

    评估压力生成方式、限制条件、负载确认手段、结果收集与统计能力等

    •9.2.2    审查源码

    开发工程师应提供测试工具源码,性能测试工程师检查变量上限,如socket数,线程数等是否超过OS限制。

    •10    分析预测试性能测试结果合理性

    •10.1  Loadrunner测试结果

    分析测试结果是否符合排队网络、概率分布等核心原理

    负载生成机资源是否有余量

    output windows是否有connection refused、timeout等错误

    尽量确保测试结果是可重现的

    •10.2  OS系统操作错误

    察看系统日志是否存在错误,一般在 /var/log/messages

    •10.3  数据库错误

    Alert*.log是否有ora-X 等错误

    是否检测到死锁

    •10.4  应用服务器以及web服务器错误

    检查是否存在core dump

    检查日志是否存在 Exception ,Error,Warning等

  • web性能测试常用的调试、嗅探工具

    2007-08-12 21:09:58

    loadrunner 对16进制的数据展现不够友好,而且录制方式基于proxy的。

        在一些复杂的情况下,可能需要用sniffer方式录制脚本。

        本文汇总一些瑞士军刀。

    http  debugger  / proxy

    Monitor HTTP, Trace HTTP, Debug HTTP, Capture HTTP, Track HTTP and Analyze HTTP/HTTPS

    http://www.17testing.com/bbs/viewthread.php?tid=5675&extra=page%3D3

    一个梦寐以求的工具,终于找到了

    charles好像只能监控到本机ie进程有关的请求,而httplook可以看到本机所有的http请求。
    为什么这样说是我用测试工具测试时,httplook可以看到http的请求,而在charles上看不了。

    httplook和Charles的工作原理不同,一个是sniffer方式,一个是proxy方式,所以httplook可以监控本机所有的http请求,而Charles只能监控指定进程的请求。
    我找这个工具的主要目的是觉得LoadRunner在调试一些复杂的http脚本的时候,提供的功能不够强大。譬如,LR中的VuGen没有提供16进制观察通讯包的方式,而是\xFD\x5A等形式。如果一些字节合并在一起是一个汉字,则出现乱七八糟的汉字堆集的现象。Charles是一个非常直观,上手很快,且功能强大的观察http请求包的程序。 找了很久,看来这个工具最强大。
    因为我要用一个工具帮助我调试性能测试脚本,所以我倾向于用proxy方式的Charles,而不是Sniffer方式的httplook。如果用httplook,其它进程发送的http请求包和你要观察的进程发送的http请求包搅和在一起,反而干扰了你的工作。
    有一个和httplook相似的工具http monitor,也是SoftX公司开发的。


    SoftX公司两个软件, Http Debugger <---------> Charles       Proxy方式捕获通讯包
                                   Http Monitor <----------> Http Look      Sniffer方式捕获通讯包。

    ethereal

    tcp/ip格式。 对于http协议不够直观!直接混杂模式截取子网里面的数据包。

    可以保存截获的网络报为明文 。

    charles web debugging proxy

    Charles is an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP traffic between their machine and the Internet.

    基于嗅探。可以回放脚本!!!可以解压缩deflate! 部分确认可以支持rpm 测试!

    http://www.xk72.com/charles/download.php 下载免费版。

    Micorosoft  fiddler

    http://www.fiddlertool.com/fiddler/

    很友好的展现

    YATT

    http://www.pocketsoap.com/

    http://www.dbanotes.net/web/yatt_webservice_debug.html

    基于wincap3.X 或者ms  raw sockets capture。 可以抓取loadrunner controller与主机之间的通信。

    SoftX HTTP Debugger

    http://www.filedudes.com/SoftX_HTTP_Debugger-download-43572.html

    HTTPLook - Test and debug communication over HTTP.

    http://www.ieinspector.com/httpanalyzer/

    IEInspector HTTP Analyzer is such a handy tool that allows you to monitor, trace, debug and analyze HTTP/HTTPS traffic in real-time. It is used by industry-leading companies including Microsoft, Cisco, AOL and Google.

    可以作为ie 的插件安装


  • 容量规划就这么高不可攀?

    2007-08-12 21:02:27

    最近在多个项目都碰到相当棘手的容量规划的问题,故投以更多的眼光关注。

    目前据我所知有 mercury  ,teamquest,bmc 等厂家有对应的产品,采用的多为复杂的数学模型,如排队网络,模拟,MVAP均值计算等实现。呵呵,是否我们可以用简陋的matlab数学建模替代呢?

    在网络上也看到一些open source 容量规划工具,如The Queueing ToolPak (QTP),Java Modelling Tools (JMT) ,但需要手工计算出规划工具所需的参数(如queue长度),以及缺少硬件参数库,这一点与teamquest相差甚远。

  • java大型网站系统调优

    2007-08-12 20:52:54

    架构核心:

     jboss4_05 + apache2.059+ mod_jk (1.4) + oracle 9i。 其中jboss采用自带的连接池,而非dbcp。

    调优分为多个层面

    1 apache 采用worker PMP模型

      httpd.conf

      Timeout 50
    KeepAlive On
    MaxKeepAliveRequests 30
    KeepAliveTimeout 25

    StartServers         2
    ServerLimit          500
    MaxClients           1500
    MinSpareThreads      50
    MaxSpareThreads      1500
    ThreadsPerChild      50
    MaxRequestsPerChild  10000

    适当放大ServerLimit  ,MaxClients . MaxClients有效取值范围<=ServerLimit  

    2 jboss server.xml

        <Connector port="8009" address="${jboss.bind.address}"
             emptySessionPath="true" enableLookups="false" redirectPort="8443"
             maxThreads="250" maxProcessors="350" minSpareThreads="30" backlog="400"
             connectionTimeout="600000" protocol="AJP/1.3"/>

     3 jvm参数

     -server -Xms1536m -Xmx1536m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=96m -XX:MaxPermSize=96m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Djboss.platform.mbeanserver

     4 workers.properties


    worker.localnode.connection_pool_size=50
    worker.localnode.connection_pool_minsize=25
    worker.localnode.connection_pool_timeout=600

    # Load-balancing behaviour

     

      5 oracle-ds.xml

        <connection-property name="SetBigStringTryClob">true</connection-property>
        <connection-property name="defaultRowPrefetch">50</connection-property>
        <driver-class>com.alibaba.jdbc.AlibabaDriver</driver-class>

        <min-pool-size>2</min-pool-size>
        <max-pool-size>125</max-pool-size>
        <blocking-timeout-millis>5000</blocking-timeout-millis>
        <idle-timeout-minutes>1</idle-timeout-minutes>
        <max-idle-timeout>3</max-idle-timeout>
        <prepared-statement-cache-size>50</prepared-statement-cache-size>
        <metadata><type-mapping>Oracle9i</type-mapping></metadata>
        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

     

      6 oracle 放大open cursor以及process数目。当然SQL tuning是性能调整重中之中。

     

     

  • loadrunner监控apache2.X

    2007-03-29 13:45:53

    loadrunner监控apache

    安装apache

    linux上安装apache.  /bin/apachectl –v

    Server version: Apache/2.0.54.

    修改conf/httpd.conf

    ExtendedStatus On

    <Location /server-status>
    SetHandler server-status

    Order Deny,Allow
    #
    Deny from all
    Allow from all
    </Location>

    测试:

    http://10.0.4.81:2068/server-status?auto&refresh=Y成功。

    Loadrunner加入监控

    端口:2688,url: /server-status?auto

    错误:

    Monitor name :Apache. Parsing error, cannot find token: BusyServers. Measurement: BusyServers|10.0.4.81. Hints: 1) Such a measurement does not exist, or the html page may be different from the supported one. 2) Try to replace the Apache.cfg with appropriate Apache_<version>.cfg file in <Installation>\dat\monitors and rerun the application (entry point: CApacheMeasurement::NewData).   [MsgId: MMSG-47479]

    解决

    因为<Installation>\dat\monitors\apache.cfg针对apache 1.xstatus指标,与apache 2.0度量指标失配。

    故采用apache_2.0.x.cf 更名apache.cfg

  • Loadrunner监控weblogic

    2007-03-29 13:43:12

    下载

    http://commerce.bea.com/showproduct.jsp?family=WLS&major=9.2&minor=0

    选择windows平台。

    输入注册名与密码。

    安装

    点击server920_win32.exe,默认全部安装。

     

    配置domain

    Tools->configuration wizards->create a new weblogic domain,默认,输入weblogic管理员的用户名与密码  weblogic/weblogic

     

    参考http://dev2dev.bea.com.cn/techdoc/200306517.html。但与此有区别!

    启动domain

    User project s-> mydomain-> start 

    日志:bea\user_projects\domains\mydomain\servers\AdminServer\logs

    测试

    http://localhost:7001/console

    此为weblogic性能监控页面。

     

    选择JMX监控

     

    LoadRunner 7.x and 8.x does not support monitoring against WebLogic8.x out of the box.  In order to Monitor WebLogic8.x:

    1.      Go to <LoadRunner>\classes and rename the file jmxri.jar to something else.

    2.      Go to <LoadRunner>\dat\monitors and edit the weblogicmon.ini:

    a.             Set the JVM to point to JDK1.4

    b.            Comment out the JavaVersion entry if there is a complain about JDK versions

    c.             DO NOT comment out the reference to jmxri.jar in this file It must remain as shown below:

    JVM_CLASSES1=jmxri.jar

    3.      Copy the weblogic.jar from the server to the <LoadRunner>\classes directory.

    4.      In WebLogic 8.x server console, do not setup administration port on SSL.

     

    配置weblogic9.2 + jdk1.5 (失败)

    配置weblogicmon.ini

    Jvm= JVM=D:\Sun\AppServer\jdk\bin\java.exe

     

    Add measument 10.0.72.30:7001 之后弹出用户名/密码框,输入weblogic/weblogic,之后console显示:

    Starting http server...

    Loading webserver.properties[C:\Program Files\Mercury Interactive\Mercury LoadRu

    nner\classes\weblogicmon.jar(com\mercuryinteractive\monitors\xmlsource\webserver

    .properties)...

     

    Web Server started...

    Listening on port: 1112

    八月/22/2006 22:38:13: hostInit(4396:10.0.72.30)

    八月/22/2006 22:38:13: Weblogic classes found in CLASSPATH. Will not use CLASSPA

    TH servlet. However, monitor is limited to a single Weblogic version: 9.2.0.0

    八月/22/2006 22:38:16: getMetricList(10.0.72.30:7001)

    八月/22/2006 22:38:17: Found 0 counters in 1 objects in 1 seconds

     

     

     没有获取到度量数据!

     

     

    跟踪user_projects\domains\mydomain\servers\AdminServer\logs\access.log:

     

    10.0.68.48 - - [22/八月/2006:22:47:18 +0800] "HEAD /classes/jndi.properties HTTP/1.1" 404 0

    10.0.68.48 - - [22/八月/2006:22:47:18 +0800] "GET /classes/weblogic/factories/t3/t3EnvironmentFactory.class HTTP/1.1" 404 0

     

    telnet  10.0.72.30 7001

    GET /classes/weblogic/factories/t3/t3EnvironmentFactory.class HTTP/1.1

     

    当不启动 weblogic服务时,

     

    暂时没有办法监控weblogic9!

    采用jdk1.4+weblogic8.jar?

          Jdk1.5+ weblogic8.jar?

         Jdk1.4+ weblogic9.jar?

    Weblogic8.1+jdk1.4

     

    Jdk1.4:

    https://sdlc6d.sun.com/ECom/EComActionServlet;jsessionid=48CF8834C4B52334C76970B6401FA62F下载 j2sdk-1_4_2_12-windows-i586-p.exe

     

    weblogic:8.1

    http://commerce.bea.com/showallversions.jsp?family=WLS,选择windows 奔腾

    WebLogic Platform Net Installer (what's this?)

    OS Platform

    WebLogic Server/Express 8.1 with SP6

      全安装,默认。

       Configuration wizard -> create new domain -> basic weblogic domain -> mydomain

     

    5.      Go to <LoadRunner>\classes and rename the file jmxri.jar to something else.

    6.      Go to <LoadRunner>\dat\monitors and edit the weblogicmon.ini:

    a.             Set the JVM to point to JDK1.4

    b.            Comment out the JavaVersion entry if there is a complain about JDK versions

    c.             DO NOT comment out the reference to jmxri.jar in this file It must remain as shown below:

    JVM_CLASSES1=jmxri.jar

    7.      Copy the weblogic.jar from the server to the <LoadRunner>\classes directory.

     

     

     

     

     

     

  • loadrunner controller 传递参数的一个方法: lr_get_attrib_string

    2007-03-29 13:39:07

    lang  =    lr_get_attrib_string("lang"); 

     

       if (lang==NULL || (strcmp(lang,"chs")  && strcmp(lang,"en"))  )

          {

                 lr_error_message("lang argument error!!!!");

                 return  -1;

          }

     

       Controller run-time setting addition上增加一个name  =lang value=X 的参数传递入脚本。

  • 诊断 CPU、内存或磁盘瓶颈的流程图(zt)

    2007-03-29 13:31:34

     

    从步骤 1 开始,首先查看 CPU 使用情况,按照诊断 CPU、内存或磁盘瓶颈的指导进行操作。对于下面的每个步骤,查找一端时间内的趋势,从中收集系统运行性能较差时的数据。另外,只有将这些数据与系统正常运行时收集的数据进行比较时才能进行准确的诊断。

    步骤 1

    # sar -u [interval] [iterations]
    (
    示例
    : sar -u 5 30)
    %idle
    是否很低? 这是 CPU 未在运行任何进程的时间百分比。在一端时间内 %idle 为零可能是 CPU 瓶颈的第一个指示。

    不是 -> 系统未发生 CPU 瓶颈。转至步骤 3
    -> 系统可能发生了 CPU、内存或 I/O 瓶颈。转至步骤 2

    步骤 2

    %usr 是否较高? 很多系统正常情况下花费 80% CPU 时间用于用户, 20% 用于系统。其他系统通常会使用 80% 左右的用户时间。

    不是 -> 系统可能遇到 CPU、内存或 I/O 瓶颈。转至步骤 3
    -> 系统可能由于用户进程遇到 CPU 瓶颈。转至部分 3,部分 A, 调整系统的 CPU 瓶颈。

    步骤 3

    %wio 的值是否大于 15?

    -> 以后记住这个值。它可能表示磁盘或磁带瓶颈。转至步骤 4
    不是 -> 转至步骤 4

    步骤 4

    # sar -d [interval] [iterations]
    用于任何磁盘的 %busy 是否都大于 50? (请记住,50% 指示一个大概的 指南,它可能远远高于您系统的正常值。在某些系统上,甚至 %busy 值为 20 可能就表示发生了磁盘瓶颈,而其他系统正常情况下可能就为 50% busy)对于同一个磁盘上,avwait 是否大于 avserv?

    不是 -> 很可能不是磁盘瓶颈,转至步骤 6
    -> 此设备上好像发生了 IO 瓶颈。
    转至步骤 5

    步骤 5

    系统上存在磁盘瓶颈,发生瓶颈的磁盘上有哪些内容?

    原始分区,
    文件系统 -> 转至部分 3,部分 B,调整发生磁盘 IO 瓶颈的系统。
    Swap ->
    可能是由于内存瓶颈导致的。
    转至步骤 6

    步骤 6

    # vmstat [interval] [iterations]
    在很长的一端时间内,po 是否总是大于 0
    ?
    对于一个 s800 系统 (free * 4k) 是否小于 2 MB

    (
    对于 s700 系统 free * 4k 是否小于 1 MB)?
    (
    2 MB 1 MB 指示大概的指南,真正的 LOTSFREE 值,即系统开始发生 paging 的值是在系统引导时计算的,它是基于系统内存的大小的。)

    不是 -> 如果步骤 1 中的 %idle 较低,系统则很可能发生了 CPU 瓶颈。
    转至部分 3,部分 A,调整发生了 CPU 瓶颈的系统。
    如果 %idle 不是很低,则可能不是 CPU、磁盘 IO或者内存瓶颈。
    请转至部分 4,其他瓶颈。
    -> 系统上存在内存瓶颈,转至部分 3 部分 C,调整发生内存瓶颈的系统。

  • loadrunner odbc并发用户时错误

    2007-03-16 21:25:18

       loadrunner ODBC协议的脚本在单个用户下运行不会出现错误, 在并发用户下出现 lrdb_exec:  "SQLExecute", return-code=-1, native-error-code=1461, SQLState=S1000, SQLError=[Oracle][ODBC][Ora]ORA-01461: can bind a LONG value only for insert into a LONG column

     论坛结论:

     

      Oracle ODBC Driver Thread Safety:I'm getting ora-01461 and ora-01460 errors when I turn multi-threading on for a pc app that makes oracle odbc connections. When using only a single thread, I never see these errors. I found a posting on the internet that led me to believe that the oracle odbc driver might be the problem.

      详见:http://forums.oracle.com/forums/thread.jsp?forum=61&thread=258096&message=&tstart=0&trange=15768373

     

     解决办法:在下载的Oracle ODBC v9.2.0.6.3 包内的说明 ODBCRelnotesUS.htm 找到相关修复的bug

      Fixed problem of ODBC failing with an ORA-1461 in a muli-threaded environment.  (Bug2403919, 2383556)

     安装Oracle ODBC v9.2.0.6.3 过程:

        http://metalink.oracle.com 下载patchno:3501955 oracle patchsets.要求有高于某个版本的安装工具,则下载p3501955_9205_winnt.rar,再安装或者下载

        oracle 10g的启动器。

        (Oracle ODBC Driver 9.2.0.6.3,ora92063.exe,http://www.oracle.com/technology/software/tech/windows/odbc/htdocs/utilsoft.html)

     

  • loadrunner 错误"Two Way Communication Error"解决办法

    2007-03-16 21:22:16

    Error: Two Way Communication Error: Function two_way_comm_post_message / two_way_comm_post_message_ex failed.  [MsgId: MERR-60990]

    MERR-60990LOADRUNNER错误的内部编号。KB网站无详细说明。

    注意观测controllerload generatorCPU/MEM/IO,防止过载。MEM过低会导致load generator出现虚拟内存过低的告警。

    建议load generator一般采用PC Server。一个odbc  Vuser大致消耗2500M/110=22M内存。

    mi公司建议打CPT 12533补丁(controller crash)

     

  • 编写apache module程序

    2007-03-16 21:18:59

    参考 http://threebit.net/tutorials/

    编译apache要求指定?

    ./configure --prefix=$INSTALLPATH/apache --enable-so

     

    (1) aclocal, autoconf, automake.生成所用的path,lib路径

    [liangjz@serch-dev-2 modules]$  cd /home/liangjz/apache/modules

    # import automake m4 macros.

    [liangjz@serch-dev-2 modules]$aclocal

    # create configure based on configure.in
    [liangjz@serch-dev-2 modules]$ autoconf

    # create Makefile.in based on Makefile.am and configure.in

    [liangjz@serch-dev-2 modules]$ automake -a


    (2) configure
    Now we can run configure to prepare the module's Makefile.
    # The ubiquitous configure scrīpt

    [liangjz@serch-dev-2 modules]$./configure --with-apache=/home/liangjz/apache

    (3) make
    And now we can run make to compile the module. Note: don't run make install. We'll handle the module installation later.

    [liangjz@serch-dev-2 modules]$ make
    source='mod_tut1.c' ōbject='mod_tut1.lo' libtool=yes \
    depfile='.deps/mod_tut1.Plo' tmpdepfile='.deps/mod_tut1.TPlo' \
    depmode=gcc3 /bin/sh ./depcomp \
    /bin/sh ./libtool --mode=compile gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"mod_tut1\" -DVERSION=\"1.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1  -I. -I. -I/home/liangjz/apache//include     -g -O2 -c -o mod_tut1.lo `test -f 'mod_tut1.c' || echo './'`mod_tut1.c
    ./libtool: ./libtool: 没有那个文件或目录
    make: *** [mod_tut1.lo] Error 127


    确认是由于libtool路径不对!修正Makefile
    #LIBTOOL = $(SHELL) $(top_builddir)/libtool
    LIBTOOL =/home/liangjz/apache/build/libtool

    (4) apxs
    ** DO NOT RUN make install ** Ordinarially you would, but the install step for an Apache module is different. Instead, apxs is used to register the module in httpd.conf and move the shared object into the apache lib directory.

    [liangjz@serch-dev-2 modules]$/home/liangjz/apache/bin/apxs -i -a -n tut1 libmodtut1.la
    apxs also addes the following line to httpd.conf:

    LoadModule tut1_module        modules/libmodtut1.so

    或者手工编辑

    LoadModule tut1_module        modules/libmodtut1.so
    <Location /bin/moduletest>
            SetHandler mod_tut1_method_handler     
    </Location>
    ?????????????????没有起到过滤作用!!!!

     

    <Location /bin/moduletest>
            SetHandler mod_tut2_method_handler     
    </Location>

    要求在程序内加入
    static int mod_tut2_method_handler (request_rec *r)
    {
            // Get the module configuration
      
     
            char buf[1024]={0};
            conn_rec  * p_conn_rec =NULL;
            modtut2_config *s_cfg = ap_get_module_config(r->server->module_config, &tut2_module);
            if (strcmp(r->handler, "mod_tut2_method_handler"))     //即不匹配/bin/moduletest拒绝服务
                    return DECLINED;

            // Send a message to the log file.
            fprintf(stderr,s_cfg->string);
            fprintf(stderr,"\n");

            // We need to flush the stream so that the message appears right away.
            // Performing an fflush() in a production system is not good for
            // performance - don't do this for real.
            fflush(stderr);

            // Return DECLINED so that the Apache core will keep looking for
            // other modules to handle this request.  This effectively makes
            // this module completely transparent.
            p_conn_rec=r->connection;
           
            sprintf(buf,"server=%s,client_ip=%s,method=%s,filename=%s,hander=%s\n",r->hostname,r->connection->remote_ip,r->method,r->filename,r->handler);
            //解析客户端并响应给浏览器
            ap_rputs(buf,r);
            return 0;
    }

    url: http:host:port/bin/moduletest/ 。 内部转发请求给

    (5)Run Apache
    Now we are ready to run Apache and test the module.
    # Change to the apache directory

    # Start Apache
    [liangjz@serch-dev-2 apache]$bin/apachectl start

    (6)ie浏览器发起http请求

    # hit the web server.

    http://10.0.4.81:2688/

    (7)检查输出
    # Look for the module's message in the error log

    [liangjz@serch-dev-2 apache$cat logs/error_log | grep tut1

    apache2_mod_tut1: A request was made.

     

    A下一步,弄清楚 path,lib,so之间关系!!!
    B 修正location的过滤作用!
    C 调试

     

    /usr/local/apache2/bin/apxs  -i -a  -c  mod_tut2.c

    [liangjz@serch-dev-2 modules]$ /home/liangjz/apache/bin/apxs  -i -a  -c  mod_tut2.c
    /home/liangjz/apache/build/libtool --silent --mode=compile gcc -prefer-pic  -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -g -O2 -pthread -I/home/liangjz/apache/include  -I/home/liangjz/apache/include   -I/home/liangjz/apache/include   -c -o mod_tut2.lo mod_tut2.c && touch mod_tut2.slo
    /home/liangjz/apache/build/libtool --silent --mode=link gcc -o mod_tut2.la  -rpath /home/liangjz/apache/modules -module -avoid-version    mod_tut2.lo
    /home/liangjz/apache/build/instdso.sh SH_LIBTOOL='/home/liangjz/apache/build/libtool' mod_tut2.la /home/liangjz/apache/modules
    /home/liangjz/apache/build/libtool --mode=install cp mod_tut2.la /home/liangjz/apache/modules/
    cp .libs/mod_tut2.so /home/liangjz/apache/modules/mod_tut2.so
    cp .libs/mod_tut2.lai /home/liangjz/apache/modules/mod_tut2.la
    cp .libs/mod_tut2.a /home/liangjz/apache/modules/mod_tut2.a
    ranlib /home/liangjz/apache/modules/mod_tut2.a
    chmod 644 /home/liangjz/apache/modules/mod_tut2.a
    PATH="$PATH:/sbin" ldconfig -n /home/liangjz/apache/modules
    ----------------------------------------------------------------------
    Libraries have been installed in:
       /home/liangjz/apache/modules

    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the `-LLIBDIR'
    flag during linking and do at least one of the following:
       - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
         during execution
       - add LIBDIR to the `LD_RUN_PATH' environment variable
         during linking
       - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
       - have your system administrator add LIBDIR to `/etc/ld.so.conf'

    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so(8) manual pages.
    ----------------------------------------------------------------------
    chmod 755 /home/liangjz/apache/modules/mod_tut2.so
    [activating module `tut2' in /home/liangjz/apache/conf/httpd.conf]
    [liangjz@serch-dev-2 modules]$ ls mod_tut2.so
    mod_tut2.so

    可以成功运行!

     

    或者


    [liangjz@serch-dev-2 modules]$ gcc  -c -O3 -I/home/liangjz/apache/include  -fPIC  -DLINUX=2 -DUSE_HSREGEX -DUSE_EXPAT -fPIC -DSHARED_MODULE  -o  mod_tut2.mod  mod_tut2.c  
    [liangjz@serch-dev-2 modules]$ gcc  -shared -L.  -L /home/liangjz/apache/lib/ -o libmodtut2.so  mod_tut2.mod
    [liangjz@serch-dev-2 modules]$ ls
    libmodtut2.so  mod_tut2.c  mod_tut2.mod


    或者
    gcc -fpic -DSHARED_MODULE -I/home/liangjz/apache/include -g -c mod_tut2.c
    ld -Bshareable -g -o libmodtut2.so  mod_tut2.o

    http://www.evance.name/tools/Apache-Chs/programs/apxs.html

     

     

     

     

     

     

     

     

     

    用gdb调试apache
    当前工作目录是 /home/jeson/apache2。 先apachectl stop关闭apache服务。


    1. gdb bin/httpd
    2. b ap_process_request        (设置断点)

    3. r -X -d /home/jeson/apache2/(指httpd.conf配置文件的上级目录conf的路径)   
     启动apache.
     
    4. 启动客户端,发送请求
     从ie发起http请求。

    5. 设置断点在指定的文件中  b  file:class:function

     

    实践:
    liangjz@serch-dev-2 modules]$ gcc -fpic -DSHARED_MODULE -I/home/liangjz/apache/include -g -c mod_tut2.c
    liangjz@serch-dev-2 modules]$ld -Bshareable -g -o libmodtut2.so  mod_tut2.o
    [liangjz@serch-dev-2 apache]$ pwd
    /home/liangjz/apache
    [liangjz@serch-dev-2 apache]$ gdb   bin/httpd
    GNU gdb Red Hat Linux (6.3.0.0-1.62rh)
    Copyright 2004 Free Software Foundation, Inc.
    GDB is free software, covered by the GNU General Public License, and you are
    welcome to change it and/or distribute copies of it under certain conditions.
    Type "show copying" to see the conditions.
    There is absolutely no warranty for GDB.  Type "show warranty" for details.
    This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

    (gdb) b
    No default breakpoint address now.
    (gdb) b ap_process_request
    Breakpoint 1 at 0x806eea7: file http_request.c, line 243.
    (gdb) r -X -d  /home/liangjz/apache
    Starting program: /home/liangjz/apache/bin/httpd -X -d  /home/liangjz/apache
    [Thread debugging using libthread_db enabled]
    [New Thread -1218543488 (LWP 16009)]
    [Switching to Thread -1218543488 (LWP 16009)]

    Breakpoint 1, ap_process_request (r=0x97efe20) at http_request.c:243
    243         if (ap_extended_status)
    (gdb) b /home/liangjz/apache/modules/mod_tut2.c:mod_tut2_method_handler
    Breakpoint 2 at 0xac34f2: file mod_tut2.c, line 55.
    (gdb) c
    Continuing.

    Breakpoint 2, mod_tut2_method_handler (r=0x97efe20) at mod_tut2.c:55
    55              modtut2_config *s_cfg = ap_get_module_config(r->server->module_config, &tut2_module);
    (gdb) n
    58              fprintf(stderr,s_cfg->string);

    (gdb) print  tut2_module
    $2 = {version = 20020903, minor_version = 9, module_index = 21, name = 0xac36e6 "mod_tut2.c",
      dynamic_load_handle = 0x9787b98, next = 0x80b55c0, magic = 1095774768, rewrite_args = 0,
      create_dir_config = 0, merge_dir_config = 0, create_server_config = 0xac35e1 <create_modtut2_config>,
      merge_server_config = 0, cmds = 0xac4700, register_hooks = 0xac355f <mod_tut2_register_hooks>}
    (gdb) detach
    Detaching from program: /home/liangjz/apache/bin/httpd, process 16009

    可以让httpd继续保持!!

  • eclipse java性能分析工具tptp应用

    2007-03-16 21:14:00

    Tptp使用指南

    1.   参考

    http://www.eclipseworld.org/bbs/read.php?tid=3111&page=e

     

    2.   下载

    http://www.eclipse.org/downloads/index_project.php

     

    eclipse-SDK-3.2M6-win32.zip http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.2-200606291905/eclipse-SDK-3.2-win32.zip

           xsd-runtime-2.2.0.zip

           emf-sdo-runtime-2.2.0.zip

           uml2-M200607270400.zip

           tptp.runtime-TPTP-4.2.0.1.zip    runtime libhttp://www.eclipse.org/downloads/download.php?file=/tptp/4.2.0.2/TPTP-4.2.0.2-200608021100/tptp.runtime-TPTP-4.2.0.2.zip

      tptpdc.win_ia32-TPTP-4.0.1-200510031151.zip   Agent controllerhttp://www.eclipse.org/downloads/download.php?file=/tptp/4.2.0.2/TPTP-4.2.0.2-200608021100/agntctrl.win_ia32-TPTP-4.2.0.2.zip

    3.   安装

        先安装好jdk1.5,eclipse。并且配置好JAVA_HOME,CLASSPATH=rt.jar

           再解压缩

    xsd-runtime-2.2.0.zip

           emf-sdo-runtime-2.2.0.zip

           uml2-M200607270400.zip

           tptp.runtime-TPTP-4.2.0.1.zipeclipse目录。 关键是子目录与eclipse目录一致! 

           解压tptpdc.win_ia32-TPTP-4.0.1-200510031151.zipD:\tptpdc.win_ia32-TPTP-4.0.1

     

    \bin\SetConfig.bat生成config\serviceconfig.xml文件。

    <?xml version="1.0" encoding="UTF-8"?>

    <AgentControllerConfiguration activeConfiguration="default" filePort="10005" isDataMultiplexed="false" jvm="D:\Sun\AppServer\jdk\jre\bin\server\jvm.dll" loggingDetail="LOW" loggingLevel="INFORMATION" port="10002" processPolling="true" securedPort="10003" version="4.0.0">

        <AgentControllerEnvironment configuration="default">

               <Variable name="JAVA_PATH" position="replace" value="d:\sun\appserver\jdk\jre\bin\java.exe"/>

               <Variable name="RASERVER_HOME" position="replace" value="D:\tptpdc.win_ia32-TPTP-4.0.1"/>

               <Variable name="PLUGINS_HOME" position="replace" value="%RASERVER_HOME%\plugins"/>

               <Variable name="PATH" position="prepend" value="%RASERVER_HOME%\bin"/>

               <Variable name="SYS_TEMP_DIR" position="replace" value="C:\DOCUME~1\JIANZH~1.LIA\LOCALS~1\Temp"/>

               <Variable name="LOCAL_AGENT_TEMP_DIR" position="replace" value="%SYS_TEMP_DIR%"/>

               <Variable name="CLASSPATH_ORG_APACHE_JAKARTA_COMMONS_LOGGING" position="append" value="%PLUGINS_HOME%\org.apache.jakarta_commons_logging_1.0.3\commons-logging.jar"/>

               <Variable name="CLASSPATH_ORG_ECLIPSE_CORE_RUNTIME" position="append" value="%PLUGINS_HOME%\org.eclipse.core.runtime_3.1.1.jar"/>

               <Variable name="CLASSPATH_ORG_ECLIPSE_EMF_COMMON" position="append" value="%PLUGINS_HOME%\org.eclipse.emf.common_2.1.0.jar"/>

               <Variable name="CLASSPATH_ORG_ECLIPSE_EMF_ECORE" position="append" value="%PLUGINS_HOME%\org.eclipse.emf.ecore_2.1.0.jar"/>

               <Variable name="CLASSPATH_ORG_ECLIPSE_EMF_ECORE_XMI" position="append" value="%PLUGINS_HOME%\org.eclipse.emf.ecore.xmi_2.1.0.jar"/>

               <Variable name="CLASSPATH_ORG_ECLIPSE_TPTP_PLATFORM_MODELS" position="append" value="%PLUGINS_HOME%\org.eclipse.tptp.platform.models_4.0.0\tptp-models.jar"/>

               <Variable name="CLASSPATH_ORG_ECLIPSE_TPTP_PLATFORM_MODELS" position="append" value="%PLUGINS_HOME%\org.eclipse.tptp.platform.models.nl1_4.0.0\org.eclipse.tptp.platform.models.nl1.jar"/>

               <Variable name="CLASSPATH_ORG_JUNIT" position="append" value="%PLUGINS_HOME%\org.junit_3.8.1\junit.jar"/>

               <Variable name="CLASSPATH" position="append" value="%CLASSPATH_ORG_ECLIPSE_CORE_RUNTIME%"/>

        </AgentControllerEnvironment>

        <Application configuration="default" executable="java.exe" location="%SYS_TEMP_DIR%" path="%JAVA_PATH%"/>

        <Hosts configuration="default">

               <Allow host="LOCAL"/>

        </Hosts>

        <Plugin path="%PLUGINS_HOME%"/>

    </AgentControllerConfiguration>

     

    环境变量:RASERVER_HOME=D:\tptpdc.win_ia32-TPTP-4.0.1。另外,环境变量path加入d:\tptpdc.win_ia32-tptp-4.0.1\bin

     

    点击RAServer.exe启动。

    4.   监控java应用

     

    5.   监控tomcat应用

    下载apache-tomcat-5.5.17

     

    http://tomcat.apache.org/download-55.cgi#5.5.17点击Windows Executable

     

    修改catalina.batjava参数加入-XrunpiAgent:server=enabled

     

    if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity

    echo "not  securiyt"

    %_EXECJAVA% -XrunpiAgent:server=enabled %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION% 

     

    激活startup.bat

     

    Elipse建立 profile

    加入agent.

     

    加入monitor

     

    点击profile.

     

    点击start monitoring !

     

    详细图

     

     

    浏览器ie:

    http://localhost:8080/servlets-examples/servlet/RequestParamExample发起请求

     

    然后右键点击pause monitoring暂停。而disattach from agent则强行停止tomcat服务。

    然后双击内存,时间,代码覆盖打开详细的图

  • rpcinfo Connection refused 错误解决办法

    2007-03-16 21:11:35

     

    尝试用  rpcinfo -p 检查linux  rpc.rstatd的版本,

     

    系统报告错误:rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused。 深究下去,发现rpc.rstad以来的portmap服务未启动。启动指令如后:

    #chkconfig portmap on   
          #/etc/init.d/portmap start
  • web_convert_param 函数在baidu.com搜索测试上的使用

    2007-03-16 21:07:35

    html方式录制baidu.com,比如查询”linux技巧”,则在runtime-viewer看到查询关键词并非”linux技巧

    改用url 模式录制,代码如后:

    web_url("s",            "URL=http://www.baidu.com/s?wd=linux%BC%BC%C7%C9&cl=3",

                 "Resource=0",

                 "RecContentType=text/html",

                 "Referer=http://www.baidu.com/",

                 "Snapshot=t4.inf",

                 "Mode=HTTP",

                 LAST);

     web_url("c.gif",

                 "URL=http://c.baidu.com/c.gif?t=0&q=linux%BC%BC%C7%C9",

                 "Resource=0",

                 "RecContentType=text/html",            "Referer=http://www.baidu.com/s?wd=linux%BC%BC%C7%C9&cl=3",

                 "Mode=HTTP",

                 LAST);

     

    回放出错,经ethreal截包,确有:http 204错误。

     

    Action.c(28): Error -26563: Non-empty response body is invalid with HTTP Status Code 204 (No Content) for "http://c.baidu.com/c.gif?t=0&q=linux%BC%BC%C7%C9"     [MsgId: MERR-26563]

    Action.c(28): t=1560ms: 1-byte response body for "http://c.baidu.com/c.gif?t=0&q=linux%BC%BC%C7%C9" (RelFrameId=1)

    Action.c(28):     \x00

    Action.c(28): Warning -26652: Response body length (1) does not match the Content-Length header specification (0) for "http://c.baidu.com/c.gif?t=0&q=linux%BC%BC%C7%C9"       [MsgId: MWAR-26652]

    Action.c(28): web_url("c.gif") highest severity level was "ERROR", 1 body bytes, 112 header bytes         [MsgId: MMSG-26388]

     

    为了参数化以及更正错误,正确的代码如后:

    web_convert_param("encoderesult", "SourceString={keyword}","SourceEncoding=HTML",

            "TargetEncoding=URL", LAST);

          lr_log_message("encode=%s",lr_eval_string("{encoderesult}"));

          web_url("s",

                 "URL=http://www.baidu.com/s?wd={encoderesult}&cl=3",

                 "Resource=0",

                 "RecContentType=text/html",

                 "Referer=http://www.baidu.com/",

                 "Snapshot=t4.inf",

                 "Mode=HTTP",

                 LAST);        

          lr_continue_on_error(LR_ON_ERROR_CONTINUE );

          web_url("c.gif",

                 "URL=http://c.baidu.com/c.gif?t=0&q=linux%BC%BC%C7%C9",

                 "Resource=0",

                 "RecContentType=text/html",            "Referer=http://www.baidu.com/s?wd=linux%BC%BC%C7%C9&cl=3",

                 "Mode=HTTP",

                 LAST);

  • web性能测试总结

    2007-03-16 21:03:25

    环境检查

    (1)    hosts绑定

    (2)    采用的dns,网关

    (3)    IE 设置:每次重新下载,安全站点

    (4)    网页有无采用ssl, 随机验证码,applet,加解密

    录制

    可选Uml,html模式。一般html脚本阅读性强,但控制力差。Uml控性强,可以对付复杂的关联。

    另外:

    scrīpt type:  contain explicit urls only

    Support charset: utf-8

    调试

    打开extended  log

    检索error ,http响应码

    简化客户端下载,uncheck  download non-html resources

    多尝试不同的选项, winnet replay

    借助ethreal

    借助 apache,weblogic,以及其他观测连接。确保vuser与真实用户一致性为

    结果分析

    参考

    http://blog.51testing.com/html/98/92598_itemid_4718.html

    从我自己的经验,关键区分是loadrunner/客户端/网络/服务器的错误。

  • unix 计数器disk traffic含义

    2007-03-16 20:56:39

    controller->tools->options

    可知如下为每3秒采样一次。

     

    等价

    iostat –d  3  n 输出的tps

    或者iostat –x  3 中的 r/s+w/s

    源码分析

    http://nchc.dl.sourceforge.net/sourceforge/rstatd/rpc.rstatd-4.0.1.tar.gz下载

    getdata.c ->函数getdata_setup,划分不同的版本如get_disk24

     

    unsigned long long   rio;

      unsigned long long wio;

      char line[1024];

      char device[128];

      int    diskno;

      /* open the /proc/partitions file */

      partitions = fopen("/proc/partitions", "r");

      if (NULL == partitions) {

             return;

      }

      /* skip two lines */

      fgets(buffer, sizeof(buffer), partitions);       /* 1. line */

      fgets(buffer, sizeof(buffer), partitions);       /* 2. line */

     

      /* accumulate all the io statistics */

      diskno = 0;

      while ((diskno < 4) && (line == fgets(line, sizeof(line), partitions))) {

             sscanf(line, " %*d %*d %*d %s "

                    "%lld %*d %*d %*d "

                    "%lld %*d %*d %*d "

                    "%*d %*d %*d\n",

                    device, &rio, &wio);

             if (isdisk(device)) {

                    s->dk_xfer[diskno++] = rio + wio;

             }

      }

     

    输出如:major minor  #blocks  name     rio rmerge rsect ruse wio wmerge wsect wuse running use aveq

     

       8     0  143114240 sda 20157282 76396662 781266460 1674746 51521287 557414054 576721790 18033503 0 16683724 23108039

       8     1     104391 sda1 420 989 2818 1640 412 387 1598 22310 0 20060 23950

       8     2    4192965 sda2 1693441 294 13549472 5620720 1368359 1659202 24230064 28566661 0 9972060 34221911

       8     3  138809632 sda3 18463289 76394995 767713138 39002769 50152516 555754465 552490128 32396225 0 7951734 31784871

     

    device, &rio, &wio分别取

    name     rio   wio。这些值都是read io/write operations since boot以来的值。To compute the io statistics for a disk, use the rio and wio operations,

    as they are closest to what we used to know as unix io operations. Use

    the wsect and rsect numbers to report block reads/writes.

     

    rio完成的读 I/O 设备总次数。指真正向 I/O 设备发起并完成的读操作数目,
    也就是那些放到 I/O 队列中的读请求。注意很多进程发起的读操作
    (read())
    很可能会和其他的操作进行 merge,不一定每个 read() 调用
    都引起一个 I/O 请求。

1618/9<123456789>
Open Toolbar