When DiscuzNT Loadrunner met (a) (rpm) when DiscuzNT Loadrunner met (a)

When DiscuzNT met Loadrunner (on)

 

      DiscuzNT3 official version has been released for some time, little more than the past six months to write technical articles about this product, first, time, and second, limited energy. However, after the official version released, but added with some effort, we are a commercial customer after upgrading from version 2.6 to version 3.0 official, out of an episode, I had to lead back to version 2.6. Because the forum visited the customer and posted to larger than usual number of online 5000, posting daily volume of about 2-3 million. Therefore, a number of performance problems, at high concurrency, server response timeout, and the more unstable at the peak. Before I used the in-house tinyget do some simple stress tests, found some problems, but the reasons are not clear, so the company meeting, someone asked about the use loadruner do stress tests to see if the performance of the product fell 3.0 how the end, what is causing the user's server instability. So there is today in this article.

      Of course, I write this article is intended primarily to make a memo . The reason is very simple, it is more than three years ago had used LR some time, I thought the test would be hundreds of times, can not wanted, even the most simple of concurrent users forget where to set up, so the view of this, only a sense of take notes of 'necessity'. So the content of this paper and notes and practical in one, huh, huh. Well, then the less cost, let's go!

     First of all, I want to set up a local test environment, test environment and this is a small internal network, including a 1u server, a switch and a TPLINK lr machine is installed. And why do the simple reason that, if the company LAN, we must first be limited and limiting the impact of the software within the network traffic, if we have one or two colleagues to open what is 'mine' Yeah, 'donkey' Yeah, 'm' Yeah downloader, it is more lively, it is difficult and ultimately put pressure network traffic simulation up, so I got this directly through the network three devices, has become a 100m to the internal network, this can to ensure that the number of concurrent (v_user) 1000 user fundamentally.

     Here to declare that, by itself, is loadruner8.0, and the cracked version. Oh, you're not wrong, because I am poor, no money to buy this lisence genuine, so we can only here 'that' a. Meanwhile, in order to ensure the normal operation of the installation lr, I directly mounted on window2003 + ie6 platform, which is relatively standard lr system operating environment. After installation is complete and lisence registration, here's a look at its use processes.

     The first step: record a script

     Here is a recording of the script:

     Because the test is WEB application, so I chose to create the http protocol in the project window.

     loadrunner_rec_1

     loadrunner_rec_2

       Then fill in the address http then link the program to be tested in the following window and then click OK. Before then lr starts ie6 our press web site set up to access the application.

      loadrunner_rec_3

      Here we can see the following events in the continuous accumulation of these events we can be seen as one http request processing operations (such as downloading js, css, images, etc.).

loadrunner_rec_4

 

      Then we click on the recording tools "new action" icon to create a new action, the purpose of doing so is to test us every step of the process are defined, in order to be able to glance at the time of the follow-up analysis of the stress test results, huh, huh.

      We are in the new action, is defined as "showforum" (ie information display section), and then we went to a forum just click on the link below:

     loadrunner_rec_5

 

      Note: I used to be defined as the action of the name of the linked page name, this is more intuitive.

loadrunner_rec_6 

 

      Here we see the cumulative number of events and changes. Then we'll create an action, to record the theme of development operations here because our products support 3.0 features a pop, so we recorded the action as "pop_posttopic", then we click on a page of the current showforum " new post "button, so posting page was pop up, as shown below:

 loadrunner_rec_7

    

      Here we see it, even ajax pop, lr will be recorded 'faithful' of.

      这里我们简单的输入一些信息,然后在创建一个新的action叫‘posttopic’,也就是提交主题,接着我们点击发布按钮,这样就将提交主题流程也记录下来了。

      大家会发现当发布成功后,页面会跳转到showtopic。换句话说'posttopic’这个action中包含提交跳转两个操作,不过没关系,等测试报告出来时,我们可以看到这一个action中的两个操作分别的执行时间,页面体积等信息。

      按一般人浏览论坛的习惯,就是其会在不同的版块和话题之间‘翻来覆去’的‘折腾’,所以我们就再创建一action,叫'showforum_2’,以代表其跳转版块的行为,然后点击导航链接上的按钮,如下图:

 loadrunner_rec_8

 

      当页面跳到showforum页面下时,我们再创建一个action,叫showtopic_2,以代表用户又打开了一个新主题。然后我们就随便点一个主题帖。这样就基本上完成了一个主要的操作流程。最后我们在录制工具的下拉框中找到“vuser_end”这个action,以此作为最后一个action的操作,平时我把‘注销(退出登陆)’操作做为这个action的内容,而今天我以‘跳转回首页’作为了“vuser_end”这个action的内容了。

    loadrunner_rec_9

  

     这样,录制工具就完成了,我们点击录制工具条上的那个方块图标,来结束录制,如下图:

   loadrunner_rec_10

 

    下面我们来看一下lr给我们生成的相关脚本。如下图:

   loadrunner_rec_11

 

      直接从脚本上来看,基本上就是每个action所访问页面内容中的链接,脚本及相关文件的链接信息。lr就是借助这些信息来依次执行相关操作的。

 

      下面我们可以接着设置一下我们刚才录制脚本时所做的‘一系列操作’的‘重复次数’,我们可以通过点击lr上的工具栏图标来进行设置,如下图:

 loadrunner_rec_12

  

      在弹出窗口中,我们可以设置重复次数,图中的设置是重复这些操作5次

 

      当然我们还可以设置每个action执行完之后的间隔时间,这一点我们可以理解成为:当我们看一个帖子时,不会一打开页面就跳转或关闭,肯定会看完相应内容之后才执行‘后续操作’。不过为了最大限度的给服务器和数据库‘制造压力’,这里用的是默认设置,即一个action操作完后马上执行下一个action,如下图:

loadrunner_rec_13

 

    我们可以用lr上的操作图标,来看一下我们脚本的执行情况(注:按F10为单步执行)

loadrunner_rec_14

 

     注:检查脚本的执行情况主要是为了后续工作考虑,因为有些脚本录制的内容可能不正确或不是我们想要的,我们可以酌情修改

 

      好了,今天的内容就先到这里了,在后续的文章中,将会介绍如果设置并发用户,以及生成保存测试结果,以及如果分析测试报告,因为一切工作都是为了生成一份尽可能准确客观的‘报告’,从而能快速帮助我们找出‘系统瓶颈’,从而重点加以优化。

      原文链接:http://www.cnblogs.com/daizhj/archive/2009/09/25/1573926.html

      作者: daizhj, 代震军

      Tags: loadrunner,压力测试,discuznt

      网址: http://daizhj.cnblogs.com/

 

      DiscuzNT3正式版发布已经有一段时间了,最近半年多来很少再写关于这个产品的技术文章了,一是时间,二是精力有限。不过在正式版发表之后,倒是有了些功夫,同时我们的一个商业客户在从2.6版本升级到3.0正式版之后,出了一个小插曲,导致不得不退回到2.6版本。因为这个客户的论坛访问量和发帖量比较大,平时在线人数5000,日发帖量在2-3万左右。所以出了一些性能上的问题,在大并发情况下,服务器响应超时,且在峰值时越发不稳定。之前我在公司内部用了tinyget做了一些简单的压力测试,发现了一些问题,但原因尚不明显,所以在公司会议上就有人提出使用loadruner来做一下压力测试,看看3.0产品的性能倒底如何,是什么造成用户的服务器不稳定。所以就有了今天的这篇文章。

      当然,我写这篇文章的目的主要是做一份备忘录。原因很简单,就是三年多以前曾用过一段时间的LR,本以为这次测试会轻车熟路,可不曾想,连最简单的并发用户数都忘在哪里设置了,所以鉴于此,才有感做记录的‘必要性’。所以本文的内容兼笔记和实战于一身,呵呵。好了,费话少说,let’s go!

     首先,我要在本地搭建一个测试环境,而这个测试环境是一个小型的内部网络,包括一台1u的服务器,一台TPLINK交换机和一台安装了lr的机器。而为什么要这样做,原因很简单,如果使用公司局域网,首先就要受到网络内部流量的影响以及限流软件的限制,如果再有一两个同事开个什么‘雷’呀,‘驴’呀,‘米’呀的下载器,那就更热闹了,很难最终把压力和网络流量模拟上来,所以我就直接通过网管找来了这三台设备,给成了一个100m的内部网络,这样能够从根本上确保1000 的并发用户数(v_user)。

     这里要声明的是,本身用的是loadruner8.0,且是破解版。呵呵,你没看错,因为我很穷,没这份财力去购买正版的lisence,所以这里就只能‘那个’了。同时,为了确保安装的lr正常运行,我直接将其安装在了window2003+ie6的平台上,这是lr比较标准的系统运行环境。在完成安装和lisence注册后,下面就来看一下其使用流程。

     第一步:录制脚本

     下面就是一个录制脚本的过程:

     因为测试的是WEB应用,所以在创建项目窗口中选择http协议。

     loadrunner_rec_1

     loadrunner_rec_2

       然后紧接着在下面窗口中填入要测试程序的http链接地址,然后点击确定。这时lr就会启动ie6并按之前我们设置的网址访问该应用。

      loadrunner_rec_3

      这里我们可以看到下面的events在不断的累加,这些events我们可以看成是一个个http请求处理操作(比如下载js,css,图片等)。

loadrunner_rec_4

 

      接着我们点击该录制工具的“new action”图标来新建一个action,这样做的目的就是将我们测试流程中的每一个环节分别定义,以便在后续分析压力测试结果时能够一目了然,呵呵。

      我们在新的action中,定义为“showforum”(即显示版块信息),然后我们就去点击一个论坛版块链接,如下:

     loadrunner_rec_5

 

      注:我习惯于将action的名称定义为链接页面名称,这样比较直观。

loadrunner_rec_6 

 

      这里我们看到events累加数又在变化。这时我们再创建一个action,以记录发主题的操作,这里因为我们的产品在3.0中支持了弹窗功能,所以我们就将该action记录为"pop_posttopic”, 然后我们点击一个当前showforum页面的“新帖”按钮,这样发帖页面就被弹出来了,如下图:

 loadrunner_rec_7

    

      这里大家看到了吧,即使是ajax弹窗,lr也会‘忠实’的加以记录。

      这里我们简单的输入一些信息,然后在创建一个新的action叫‘posttopic’,也就是提交主题,接着我们点击发布按钮,这样就将提交主题流程也记录下来了。

      大家会发现当发布成功后,页面会跳转到showtopic。换句话说'posttopic’这个action中包含提交跳转两个操作,不过没关系,等测试报告出来时,我们可以看到这一个action中的两个操作分别的执行时间,页面体积等信息。

      按一般人浏览论坛的习惯,就是其会在不同的版块和话题之间‘翻来覆去’的‘折腾’,所以我们就再创建一action,叫'showforum_2’,以代表其跳转版块的行为,然后点击导航链接上的按钮,如下图:

 loadrunner_rec_8

 

      当页面跳到showforum页面下时,我们再创建一个action,叫showtopic_2,以代表用户又打开了一个新主题。然后我们就随便点一个主题帖。这样就基本上完成了一个主要的操作流程。最后我们在录制工具的下拉框中找到“vuser_end”这个action,以此作为最后一个action的操作,平时我把‘注销(退出登陆)’操作做为这个action的内容,而今天我以‘跳转回首页’作为了“vuser_end”这个action的内容了。

    loadrunner_rec_9

  

     这样,录制工具就完成了,我们点击录制工具条上的那个方块图标,来结束录制,如下图:

   loadrunner_rec_10

 

    下面我们来看一下lr给我们生成的相关脚本。如下图:

   loadrunner_rec_11

 

      直接从脚本上来看,基本上就是每个action所访问页面内容中的链接,脚本及相关文件的链接信息。lr就是借助这些信息来依次执行相关操作的。

 

      下面我们可以接着设置一下我们刚才录制脚本时所做的‘一系列操作’的‘重复次数’,我们可以通过点击lr上的工具栏图标来进行设置,如下图:

 loadrunner_rec_12

  

      在弹出窗口中,我们可以设置重复次数,图中的设置是重复这些操作5次

 

      当然我们还可以设置每个action执行完之后的间隔时间,这一点我们可以理解成为:当我们看一个帖子时,不会一打开页面就跳转或关闭,肯定会看完相应内容之后才执行‘后续操作’。不过为了最大限度的给服务器和数据库‘制造压力’,这里用的是默认设置,即一个action操作完后马上执行下一个action,如下图:

loadrunner_rec_13

 

    我们可以用lr上的操作图标,来看一下我们脚本的执行情况(注:按F10为单步执行)

loadrunner_rec_14

 

     Note: The implementation of check script is mainly to consider the follow-up, because some of the contents of the script may not be recorded properly or not what we want, we can modify as appropriate .

 

      Well, today's content on the first here, and in a subsequent article will be introduced if the set of concurrent users, and creating and storing test results, and if the test analysis report, because all the work is to generate a possible accurately , the objective of the 'report', which can help us to quickly identify 'bottlenecks', which focus to be optimized.

      Original link: http://www.cnblogs.com/daizhj/archive/2009/09/25/1573926.html

      Author: daizhj, on behalf of the shock troops

      Tags: loadrunner, stress testing, discuznt

      URL:  http://daizhj.cnblogs.com/

Guess you like

Origin www.cnblogs.com/LiZhongZhongY/p/10954524.html