对于Loadrunner压测时,出现的问题汇总感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍loadrunner压测教程,并为您提供关于45个LoadRunner面试问题(附答案)、Linux
对于Loadrunner压测时,出现的问题汇总感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍loadrunner压测教程,并为您提供关于45 个 LoadRunner 面试问题(附答案)、Linux/UNIX 下安装 loadrunner 的 load generator 负载生成器组件、Linux下安装LoadRunner LoadGenerator、linux下安装loadrunner(LoadGenerator)的有用信息。
本文目录一览:- Loadrunner压测时,出现的问题汇总(loadrunner压测教程)
- 45 个 LoadRunner 面试问题(附答案)
- Linux/UNIX 下安装 loadrunner 的 load generator 负载生成器组件
- Linux下安装LoadRunner LoadGenerator
- linux下安装loadrunner(LoadGenerator)
Loadrunner压测时,出现的问题汇总(loadrunner压测教程)
【问题1】 Error -27728: Step download timeout (120 seconds) has expired
错误分析:对于HTTP协议,默认的超时时间是120秒(可以在Run-time Settings中修改),客户端发送一个请求到端还没有返回结果,则出现超时错误。
解决办法:首先在运行环境中对超时进行设置,默认的超时时间可以设置长一些。
【问题2】Error -27727: Step download timeout (120 seconds) has expired when downloading resource(s).
错误分析:对于HTTP协议,默认的超时时间是120秒(可以在Run-time Settings中修改),客户端发送一个请求到端还没有返回结果,则出现超时错误。
解决办法:Set the "Step Timeout caused by resources is a warning" Run-Time Setting to Yes/No to have this message as a warning/error, respectively
【问题3】 Error -13874: missing newline in C:\Users\Administrator\AppData\Local\Temp\brr_YAR.13\netdir\C\TestingResult\StressTest.2\Script\交强险投保\username.dat
错误分析:The .dat file needs to have an empty line at the bottom of the file. Also, not sure if all your data is on one line,。
解决办法: Put your cursor on it innotepad/whatever you are using to edit your dat files, note that is an empty line at the bottom。
【问题4】Error -10776 Failed to find .cfg file
错误分析:
在loadrunner打开脚本的情况下,运行磁盘清理工具,导致运行打开的脚本时,提示Mdrv error:Failed to find .cfg file MsgId:MERR-10777
解决方法:
从其它文件夹拷贝3个文件到不能正常运行脚本的文件夹下:
default.cfg
default.usp
*.prm(将*的位置改为脚本的名字)
再次运行脚本,可以正常运行
【问题5】Error-26608: HTTP Status-Code=504(Gateway Time-out)
解决办法:
1.在Vuser Generator中的Tools--->Recording Options...--->Recording--->HTTP-based script--->HTML Advanced按钮--->在Script type中选择A script containing explicit URLs only(e.g.web_url,web_submit_data)点击“ok”即可
2.runtime-setting, browser emulation, 取消选择download non-HTML resources即可
【问题6】Error -27796: Failed to connect to server "10.2.9.147:80":
解决办法:
runtime-setting, browser emulation, 将默认勾选的simulate a new vuser on each iteration取消勾选
【问题7】回放时lr报错:Error -26488: Could not obtain informationabout submitted file
解决办法:
录制完脚本后,把要上传的文件放到脚本存放的文件夹里面,重新回放就ok
【问题8】Error -60990 : Two Way Communication Error: Function two_way_comm_post_message / two_way_comm_post_message_ex failed.
【问题8】Error -29724 : Failed to deliver a p2p message from parent to child process, reason - communication error.
【问题11】Error -35061: No match found for the requested parameter "CorrelationParameter_2". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size [MsgId: MERR-35061]
解决办法:可以用web_set_max_html_param_len增加参数长度,我试过到99999999共8位;还有,你可以在web_reg_save_param_ex(
"ParamName=CorrelationParameter_3", "LB=c",
"RB=>\n<table border",
后面 加上 "NotFound=warning", 保存编译下,就不回再提是错误了。 主要是自动关联造成的左右边界定位不精确,需要保存的值大
【问题12】Fatal Error -26000: Not enough memory (12320 bytes) for "new buffer in LrwSrvNetTaskItem::AllocSrvNetBuf". Aborting
问题原因:报错的时候发现任务管理器里mmdrv.exe 内存占用一直增大,最红mmdrv.exe崩溃
解决办法:注意内存的使用,尽量减少变量声明,对于char类型的变量要及时用free:
【问题13】 Error -27791: Server "pcisstage.zsins.com" has shut down the connection prematurely
解决办法:测试中,并发200,300,400人时,LR没报错,在并发500人时,LR报错”Error -27791: Server "172.16.xx.xxx" has shut down the connection prematurely“,同时查看WEB服务器日志:出现这样一条信息:
”INFO: Maximum number of threads (200) created for connector with address null and port 8081“
查看配置文件参数:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
采用的是默认配置,这样在高并发情况下肯定撑不住,所以修改参数配置如下:
<Connector port="8081" protocol="HTTP/1.1"
maxThreads="500" acceptCount="500" connectionTimeout="20000"
redirectPort="8443" />
重新测试,事物全部成功,系统也未报错。
出现”Error -27791: Server "172.16.xx.xxx" has shut down the connection prematurely“的原因即有可能是操作系统网络线程连接资源的原因,也可能是应用软件的原因,当出现问题,随时查看系统日志,能帮助我们更快的定位问题。
45 个 LoadRunner 面试问题(附答案)
- What is load testing? - Load testing is to test that if the application works fine with the loads that result from large number of simultaneous users, transactions and to determine weather it can handle peak usage periods.
- What is Performance testing? - Timing for both read and update transactions should be gathered to determine whether system functions are being performed in an acceptable timeframe. This should be done standalone and then in a multi user environment to determine the effect of multiple transactions on the timing of a single transaction.
- Did u use LoadRunner? What version? - Yes. Version 7.2.
- Explain the Load testing process? -
Step 1: Planning the test. Here, we develop a clearly defined test plan to ensure the test scenarios we develop will accomplish load-testing objectives. Step 2: Creating Vusers. Here, we create Vuser scripts that contain tasks performed by each Vuser, tasks performed by Vusers as a whole, and tasks measured as transactions. Step 3: Creating the scenario. A scenario describes the events that occur during a testing session. It includes a list of machines, scripts, and Vusers that run during the scenario. We create scenarios using LoadRunner Controller. We can create manual scenarios as well as goal-oriented scenarios. In manual scenarios, we define the number of Vusers, the load generator machines, and percentage of Vusers to be assigned to each script. For web tests, we may create a goal-oriented scenario where we define the goal that our test has to achieve. LoadRunner automatically builds a scenario for us. Step 4: Running the scenario.
We emulate load on the server by instructing multiple Vusers to perform tasks simultaneously. Before the testing, we set the scenario configuration and scheduling. We can run the entire scenario, Vuser groups, or individual Vusers. Step 5: Monitoring the scenario.
We monitor scenario execution using the LoadRunner online runtime, transaction, system resource, Web resource, Web server resource, Web application server resource, database server resource, network delay, streaming media resource, firewall server resource, ERP server resource, and Java performance monitors. Step 6: Analyzing test results. During scenario execution, LoadRunner records the performance of the application under different loads. We use LoadRunner’s graphs and reports to analyze the application’s performance. - When do you do load and performance Testing? - We perform load testing once we are done with interface (GUI) testing. Modern system architectures are large and complex. Whereas single user testing primarily on functionality and user interface of a system component, application testing focuses on performance and reliability of an entire system. For example, a typical application-testing scenario might depict 1000 users logging in simultaneously to a system. This gives rise to issues such as what is the response time of the system, does it crash, will it go with different software applications and platforms, can it hold so many hundreds and thousands of users, etc. This is when we set do load and performance testing.
- What are the components of LoadRunner? - The components of LoadRunner are The Virtual User Generator, Controller, and the Agent process, LoadRunner Analysis and Monitoring, LoadRunner Books Online.
- What Component of LoadRunner would you use to record a Script? - The Virtual User Generator (VuGen) component is used to record a script. It enables you to develop Vuser scripts for a variety of application types and communication protocols.
- What Component of LoadRunner would you use to play Back the script in multi user mode? - The Controller component is used to playback the script in multi-user mode. This is done during a scenario run where a vuser script is executed by a number of vusers in a group.
- What is a rendezvous point? - You insert rendezvous points into Vuser scripts to emulate heavy user load on the server. Rendezvous points instruct Vusers to wait during test execution for multiple Vusers to arrive at a certain point, in order that they may simultaneously perform a task. For example, to emulate peak load on the bank server, you can insert a rendezvous point instructing 100 Vusers to deposit cash into their accounts at the same time.
- What is a scenario? - A scenario defines the events that occur during each testing session. For example, a scenario defines and controls the number of users to emulate, the actions to be performed, and the machines on which the virtual users run their emulations.
- Explain the recording mode for web Vuser script? - We use VuGen to develop a Vuser script by recording a user performing typical business processes on a client application. VuGen creates the script by recording the activity between the client and the server. For example, in web based applications, VuGen monitors the client end of the database and traces all the requests sent to, and received from, the database server. We use VuGen to: Monitor the communication between the application and the server; Generate the required function calls; and Insert the generated function calls into a Vuser script.
- Why do you create parameters? - Parameters are like script variables. They are used to vary input to the server and to emulate real users. Different sets of data are sent to the server each time the script is run. Better simulate the usage model for more accurate testing from the Controller; one script can emulate many different users on the system.
- What is correlation? Explain the difference between automatic correlation and manual correlation? - Correlation is used to obtain data which are unique for each run of the script and which are generated by nested queries. Correlation provides the value to avoid errors arising out of duplicate values and also optimizing the code (to avoid nested queries). Automatic correlation is where we set some rules for correlation. It can be application server specific. Here values are replaced by data which are created by these rules. In manual correlation, the value we want to correlate is scanned and create correlation is used to correlate.
- How do you find out where correlation is required? Give few examples from your projects? - Two ways: First we can scan for correlations, and see the list of values which can be correlated. From this we can pick a value to be correlated. Secondly, we can record two scripts and compare them. We can look up the difference file to see for the values which needed to be correlated. In my project, there was a unique id developed for each customer, it was nothing but Insurance Number, it was generated automatically and it was sequential and this value was unique. I had to correlate this value, in order to avoid errors while running my script. I did using scan for correlation.
- Where do you set automatic correlation options? - Automatic correlation from web point of view can be set in recording options and correlation tab. Here we can enable correlation for the entire script and choose either issue online messages or offline actions, where we can define rules for that correlation. Automatic correlation for database can be done using show output window and scan for correlation and picking the correlate query tab and choose which query value we want to correlate. If we know the specific value to be correlated, we just do create correlation for the value and specify how the value to be created.
- What is a function to capture dynamic values in the web Vuser script? - Web_reg_save_param function saves dynamic data information to a parameter.
- When do you disable log in Virtual User Generator, When do you choose standard and extended logs? - Once we debug our script and verify that it is functional, we can enable logging for errors only. When we add a script to a scenario, logging is automatically disabled. Standard Log Option: When you select
Standard log, it creates a standard log of functions and messages sent during script execution to use for debugging. Disable this option for large load testing scenarios. When you copy a script to a scenario, logging is automatically disabled Extended Log Option: Select
extended log to create an extended log, including warnings and other messages. Disable this option for large load testing scenarios. When you copy a script to a scenario, logging is automatically disabled. We can specify which additional information should be added to the extended log using the Extended log options. - How do you debug a LoadRunner script? - VuGen contains two options to help debug Vuser scripts-the Run Step by Step command and breakpoints. The Debug settings in the Options dialog box allow us to determine the extent of the trace to be performed during scenario execution. The debug information is written to the Output window. We can manually set the message class within your script using the lr_set_debug_message function. This is useful if we want to receive debug information about a small section of the script only.
- How do you write user defined functions in LR? Give me few functions you wrote in your previous project? - Before we create the User Defined functions we need to create the external
library (DLL) with the function. We add this library to VuGen bin directory. Once the library is added then we assign user defined function as a parameter. The function should have the following format: __declspec (dllexport) char* <function name>(char*, char*)Examples of user defined functions are as follows:GetVersion, GetCurrentTime, GetPltform are some of the user defined functions used in my earlier project. - What are the changes you can make in run-time settings? - The Run Time Settings that we make are: a) Pacing - It has iteration count. b) Log - Under this we have Disable Logging Standard Log and c) Extended Think Time - In think time we have two options like Ignore think time and Replay think time. d)General - Under general tab we can set the vusers as process or as multithreading and whether each step as a transaction.
- Where do you set Iteration for Vuser testing? - We set Iterations in the Run Time Settings of the VuGen. The navigation for this is Run time settings, Pacing tab, set number of iterations.
- How do you perform functional testing under load? - Functionality under load can be tested by running several Vusers concurrently. By increasing the amount of Vusers, we can determine how much load the server can sustain.
- What is Ramp up? How do you set this? - This option is used to gradually increase the amount of Vusers/load on the server. An initial value is set and a value to wait between intervals can be
specified. To set Ramp Up, go to ‘Scenario Scheduling Options’ - What is the advantage of running the Vuser as thread? - VuGen provides the facility to use multithreading. This enables more Vusers to be run per
generator. If the Vuser is run as a process, the same driver program is loaded into memory for each Vuser, thus taking up a large amount of memory. This limits the number of Vusers that can be run on a single
generator. If the Vuser is run as a thread, only one instance of the driver program is loaded into memory for the given number of
Vusers (say 100). Each thread shares the memory of the parent driver program, thus enabling more Vusers to be run per generator. - If you want to stop the execution of your script on error, how do you do that? - The lr_abort function aborts the execution of a Vuser script. It instructs the Vuser to stop executing the Actions section, execute the vuser_end section and end the execution. This function is useful when you need to manually abort a script execution as a result of a specific error condition. When you end a script using this function, the Vuser is assigned the status "Stopped". For this to take effect, we have to first uncheck the “Continue on error” option in Run-Time Settings.
- What is the relation between Response Time and Throughput? - The Throughput graph shows the amount of data in bytes that the Vusers received from the server in a second. When we compare this with the transaction response time, we will notice that as throughput decreased, the response time also decreased. Similarly, the peak throughput and highest response time would occur approximately at the same time.
- Explain the Configuration of your systems? - The configuration of our systems refers to that of the client machines on which we run the Vusers. The configuration of any client machine includes its hardware settings, memory, operating system, software applications, development tools, etc. This system component configuration should match with the overall system configuration that would include the network infrastructure, the web server, the database server, and any other components that go with this larger system so as to achieve the load testing objectives.
- How do you identify the performance bottlenecks? - Performance Bottlenecks can be detected by using monitors. These monitors might be application server monitors, web server monitors, database server monitors and network monitors. They help in finding out the troubled area in our scenario which causes increased response time. The measurements made are usually performance response time, throughput, hits/sec, network delay graphs, etc.
- If web server, database and Network are all fine where could be the problem? - The problem could be in the system itself or in the application server or in the code written for the application.
- How did you find web server related issues? - Using Web resource monitors we can find the performance of web servers. Using these monitors we can analyze throughput on the web server, number of hits per second that
occurred during scenario, the number of http responses per second, the number of downloaded pages per second. - How did you find database related issues? - By running “Database” monitor and help of “Data Resource Graph” we can find database related issues. E.g. You can specify the resource you want to measure on before running the controller and than you can see database related issues
- Explain all the web recording options?
- What is the difference between Overlay graph and Correlate graph? - Overlay Graph: It overlay the content of two graphs that shares a common x-axis. Left Y-axis on the merged graph show’s the current graph’s value & Right Y-axis show the value of Y-axis of the graph that was merged. Correlate Graph:Plot the Y-axis of two graphs against each other. The active graph’s Y-axis becomes X-axis of merged graph. Y-axis of the graph that was merged becomes merged graph’s Y-axis.
- How did you plan the Load? What are the Criteria? - Load test is planned to decide the number of users, what kind of machines we are going to use and from where they are run. It is based on 2 important documents, Task Distribution Diagram and Transaction profile. Task Distribution Diagram gives us the information on number of users for a particular transaction and the time of the load. The peak usage and off-usage are decided from this Diagram. Transaction profile gives us the information about the transactions name and their priority levels with regard to the scenario we are deciding.
- What does vuser_init action contain? - Vuser_init action contains procedures to login to a server.
- What does vuser_end action contain? - Vuser_end section contains log off procedures.
- What is think time? How do you change the threshold? - Think time is the time that a real user waits between actions. Example: When a user receives data from a server, the user may wait several seconds to review the data before responding. This delay is known as the think time. Changing the Threshold: Threshold level is the level below which the recorded think time will be ignored. The default value is five (5) seconds. We can change the think time threshold in the Recording options of the Vugen.
- What is the difference between standard log and extended log? - The standard log sends a subset of functions and messages sent during script execution to a log. The subset depends on the Vuser type Extended log sends a detailed script execution messages to the output log. This is mainly used during debugging when we want information about: Parameter substitution. Data returned by the server. Advanced trace.
- Explain the following functions: - lr_debug_message - The lr_debug_message function sends a debug message to the output log when the specified message class is set. lr_output_message - The lr_output_message function sends notifications to the Controller Output window and the Vuser log file.lr_error_message - The lr_error_message function sends an error message to the LoadRunner Output window. lrd_stmt - The lrd_stmt function associates a character string (usually a SQL statement) with a cursor. This function sets a SQL statement to be processed. lrd_fetch - The lrd_fetch function fetches the next row from the result set.
- Throughput - If the throughput scales upward as time progresses and the number of Vusers increase, this indicates that the bandwidth is sufficient. If the graph were to remain relatively flat as the number of Vusers increased, it would
be reasonable to conclude that the bandwidth is constraining the volume of
data delivered. - Types of Goals in Goal-Oriented Scenario - Load Runner provides you with five different types of goals in a goal oriented scenario:
- The number of concurrent Vusers
- The number of hits per second
- The number of transactions per second
- The number of pages per minute
- The transaction response time that you want your scenario
- Analysis Scenario (Bottlenecks): In Running Vuser graph correlated with the response time graph you can see that as the number of Vusers increases, the average response time of the check itinerary transaction very gradually increases. In other words, the average response time steadily increases as the load
increases. At 56 Vusers, there is a sudden, sharp increase in the average response
time. We say that the test broke the server. That is the mean time before failure (MTBF). The response time clearly began to degrade when there were more than 56 Vusers running simultaneously. - What is correlation? Explain the difference between automatic correlation and manual correlation? - Correlation is used to obtain data which are unique for each run of the script and which are generated by nested queries. Correlation provides the value to avoid errors arising out of duplicate values and also optimizing the code (to avoid nested queries). Automatic correlation is where we set some rules for correlation. It can be application server specific. Here values are replaced by data which are created by these rules. In manual correlation, the value we want to correlate is scanned and create correlation is used to correlate.
- Where do you set automatic correlation options? - Automatic correlation from web point of view, can be set in recording options and correlation tab. Here we can enable correlation for the entire script and choose either issue online messages or offline actions, where we can define rules for that correlation. Automatic correlation for database, can be done using show output window and scan for correlation and picking the correlate query tab and choose which query value we want to correlate. If we know the specific value to be correlated, we just do create correlation for the value and specify how the value to be created.
- What is a function to capture dynamic values in the web vuser script? - Web_reg_save_param function saves dynamic data information to a parameter.
Linux/UNIX 下安装 loadrunner 的 load generator 负载生成器组件
LoadRunner Generator for Linux 和 Loadrunner 11.0 的安装程序下载地址:
https://pan.baidu.com/s/1mhEFOc4
一、Unix 环境下安装 LoadRunner Generator for Linux
1、从以上的网盘地址中下载 LoadRunner Generator for Linux 安装程序,解压后,拿出对应操作系统的安装程序包(以 IBM AIX 为例,应该使用 IBM 文件夹下的程序),将 IBM 文件夹上传至服务器某路径,如 /tmp。
2、在 unix 服务器上建立用户 loadgen,创建路径 / Load_Gen,使 loadgen 用户对 / Load_Gen 路径下的所有文件及文件夹具有读、写、执行权限。
3、在图形界面中打开一个终端窗口,到 /tmp/IBM/ 路径下,运行命令 install.sh,则会出现图形界面,选择同意 license,点击下一步,选择安装路径为 / Load_Gen,点击下一步,等文件拷贝完成后,loadrunner 在 unix 端的安装就告一段落。
4、接下来编辑三个文件,分别是 loadgen 用户的 profile 文件、.rhost 文件及 hosts 文件,编辑内容分别如下:
①编辑~/.profile 文件,加入如下内容,以定义 load generator 的所需环境变量:
export M_LROOT=/bea/LR/Load_Gen
export LIBPATH=$LIBPATH:$M_LROOT/bin
export PATH=$M_LROOT/bin:$PATH
②新建~/.rhost 文件,加入如下内容:(这里加入的 ip 地址及主机名为 loadrunner controller 的地址)
192.168.1.169 VU-TEST
③用户 root 用户编辑 /etc/hosts 文件,加入以下内容:(这里加入的 ip 地址及主机名为 loadrunner controller 的地址)
192.168.1.169 VU-TEST
5、在终端窗口下运行命令:
export DISPLAY=192.168.1.169:0.0
6、在 $M_LROOT/bin 目录下,运行命令:
./verify_generator
A、如果出现如下文字,说明已经测试验证通过。
$ ./verify_generator
===================================================
HP
Vuser Environment Verification Utility
===================================================
Product: HP LoadRunner 9.10
Version: 9.10.0000
Build: 2407
dcdev1:
verify_generator...OK
verify_generator...OK
verify_generator...OK
Don''t forget to make sure that the name of the controller machine
is also in .rhosts
verify_generator...OK
verify_generator...OK
verify_generator...OK
verify_generator...OK
verify_generator...OK
verify_generator...OK
verify_generator...OK
________
Summary:
________
Vuser Host dcdev1: OK
B、如果出现如下文字,说明未声明 DISPLAY 环境变量,运行命令 export DISPLAY=192.168.1.169:0.0 即可;
$ ./verify_generator
===================================================
HP
Vuser Environment Verification Utility
===================================================
Product: HP LoadRunner 9.10
Version: 9.10.0000
Build: 2407
verify_generator must have a DISPLAY set, please set and rerun
7、在 $M_LROOT/bin 目录下,运行命令
./ m_daemon_setup –install
然后运行 ps -ef|grep m_agent_daemon 命令,检查进程是否正常启动,出现如下信息说明启动成功:
$ ps -ef | grep m_agent_daemon
bea 438368 1 0 20时25分29秒 - 0:00 m_agent_daemon -usr dat/br_lnch_server.usr -launcher_service -launcher_daemon -drv_log_under_temp m_agent_daemon -mdrv_log_type append -drv_log_num_backups 5
bea 540784 557134 0 14时44分17秒 pts/0 0:00 grep m_agent_daemon
8、在 windows 上打开 Controller 端,建立场景,选择要执行的脚本,在 Design 模式下,点击 右边的 Generators, 在弹出的小窗口中点击 Add, 添加新的 Load Generator, 在 name 处填写 AIX 的 IP 地址,在 Platform 处,选择 UNIX, 点击 more,在 Unix Environment 标签下, shell Settings 中的 Don''t use RSH 项, 若勾选此项,则不需要前面第 5 步的域间互信。点击 “OK” 按钮,在 Load Generators 页面中选择在刚添加的 HP-UX 上,点击 “Connect”, 连接成功后,在 Scenario Groups 中修改 Load Generators 的 localhost 为刚添加的 AIX 执行即可
9、运行命令
./ m_daemon_setup –remove
可以停止 load generator 服务。
10、在 $M_LROOT/bin 目录下,运行命令 netstat -na |grep 192.168.1.169,如果运行结果中出现连接信息,则说明所有操作成功。(这里的 192.168.1.169 为所用测试脚本中访问的某个系统的 http 请求地址。
二、Linux 环境下安装 LoadRunner Generator for Linux
http://my.oschina.net/u/2391658/blog/735687
Linux下安装LoadRunner LoadGenerator
LR的负载机安装在linux的理由:
1、windows xp,双核+4G内存,基本上每个vuser会消耗2-5m的内存,单机300-500的虚拟用户时,CPU已经超过90%,此时整个测试系统的瓶颈实际上是负载机,已经无法真实反映系统性能。当然可以通过多负载机的模式来实现,但是这样的测试环境构造起来成本比较高,性价比不高。
2、很多时候,被测试环境是放在机房的,那么在机房丢一台windows机器进去不太现实,即使丢进去了,远程连接的稳定和安全性也不够理想。
因此,在linux服务器上,直接安装LR的负载端程序,从环境和性价比而言,都是一个不错的选择。
linux 负载机的环境:
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.7 (Final)
Release: 5.7
Codename: Final
安装步骤:
1、远程登录到服务器上,切换到root用户下,必须要root账户才行;
2、先安装一个rpm包,compat-libstdc++-33-3.2.3-61.i386.rpm,
很多系统都缺少这个rpm包,先安装上吧,包地址为:http://pan.baidu.com/share/link?shareid=1560421269&uk=339142937
[root@bogon lixin]# rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm
3、开始安装客户端,先解压安装文件
[root@bogon lixin]# unzip linux_fuzai.zip
4、进入Linux文件夹,运行安装程序installer.sh
[root@bogon lixin]# cd Linux
[root@bogon Linux]# sh installer.sh
这个时候会报错,提示一些脚本文件权限不足,为了方便起见,一次更改Linux下所有文件的权限。
[root@bogon Linux]# cd ..
[root@bogon lixin]# chmod 777 -R Linux/
可以看见权限全部被更改过来了
5、再次进入Linux目录,运行安装脚本
这样表示正式开始安装,首先提示你是否需要继续安装,输入''n''
提示你要不要看一看授权文件等等,不用看了,直接Agree吧。
最后让你确认一下是否需要安装,退出之类的,肯定选择‘i’,继续安装了。
安装完成了,问你是否要直接结束,还是看一下Log,懒得看的话,直接''f''结束好了。
到了这一步,基本安装就结束了。
6、增加一个LR 负载端的客户higkoo
[root@bogon Linux]# useradd -g 0 -s /bin/csh higkoo
这个时候已经确认了higkoo这个用户默认使用的shell为csh。
这里多说一下,shell只是linux的一个外壳,每个linux都会有一个默认的shell程序,在centos下,默认shell应该是bash,但是LR使用的csh,这两者本质上没什么区别,但是在接下来的配置里面,会有一点点区别。可以用命令看一下,higkoo这个用户默认使用的是csh。
[root@bogon Linux]# more /etc/passwd
7、修改部分LR的配置。
csh和bash有一个区别,就是在加载不同的shell时,可以加载不同的配置。
csh的默认配置在 /etc/csh.cshrc 下,bash的默认配置在 /etc/profile 。在这两个配置文件中,
可以加载一些shell的环境变量。
LR默认给出了一个环境变量的配置文件,文件在 /opt/HP/HP_LoadGenerator/env.csh 。可以看见,*.csh这样的配置文件其实是csh的配置文件的格式,默认的文件内容应该是:
env.csh 这个配置目前还没有引入到csh的默认配置里面,我们手工修改一下,让它默认加入环境变量,这样就非常方便了。
[root@bogon HP_LoadGenerator]# vi /etc/csh.cshrc
在文件的最后一行加上 source /opt/HP/HP_LoadGenerator/env.csh ,这样就可以将lr的配置导入csh的默认配置。
8、切换到higkoo用户,验证一下程序是否安装成功。
[root@bogon HP_LoadGenerator]# su higkoo
[higkoo@bogon HP_LoadGenerator]$ env
验证一下程序安装的情况,验证程序为 /opt/HP/HP_LoadGenerator/bin/verify_generator
[higkoo@bogon bin]$ cd /opt/HP/HP_LoadGenerator/bin
[higkoo@bogon bin]$ ./verify_generator
此时出现提示页面如下:
要求我们设置一个DISPLAY 变量,我们直接修改env.csh文件来解决。
先切换到root用户下,因为两个原因:
1、env.csh文件对higkoo用户是只读的,无法修改
2、修改env.csh用户,相当于修改csh的配置,这个时候需要重新进入一下csh,才能生效
所以我们先退回到root下,修改env.csh 文件。
[root@bogon HP_LoadGenerator]# vi /opt/HP/HP_LoadGenerator/env.csh
直接在文件最后方加上 setenv DISPLAY 0.0
切换到higkoo用户,再次运行验证程序。
[root@bogon HP_LoadGenerator]# su higkoo
[higkoo@bogon HP_LoadGenerator]$ cd /opt/HP/HP_LoadGenerator/bin
[higkoo@bogon bin]$ ./verify_generator
非常顺利,全部通过。
9、启动LR 负载端。
[higkoo@bogon bin]$ cd /opt/HP/HP_LoadGenerator/bin
[higkoo@bogon bin]$ ./m_daemon_setup start
正常情况下,这个时候应该可以启动,但是我安装到这里的时候报错了,见截图。
检查一下log,log在/tmp 路径下,有一个错误日志,检查之后发现,可能是一个根据主机名称获取主机ip的程序有问题,无法根据主机名称获取到ip。
27/08/2013 00:10:25 Error: Communication error: Failed to get the server host IP by calling the gethostbyname function
看一下当前shell下的环境变量,发现主机名称是bogon,再ping 一下bogon,无法连接上。
切换到root下,更改hosts配置,把bogon指向127.0.0.1 .
再次切换到higkoo,重新运行启动程序,正常启动。
[root@bogon HP_LoadGenerator]# su higkoo
[higkoo@bogon HP_LoadGenerator]$ cd /opt/HP/HP_LoadGenerator/bin
[higkoo@bogon bin]$ ./m_daemon_setup start
m_agent_daemon ( 26299 ),
[higkoo@bogon bin]$ ps aux | grep m_agent_daemon
至此,LR的linux负载端安装全部完成。
附录:
本次安装是在csh下安装完成的,如果想在bash下安装,可以在HP_LoadGenerator 下建立一个 env.sh文件,文件内容如下,再将该文件 引入到 /etc/profile 的最后一行,最后修改 /etc/passwd中的higkoo配置为bash,即可使用bash来安装程序。其余步骤一样。
#/bin/bash
export PRODUCT_DIR=/opt/HP/HP_LoadGenerator
export M_LROOT=$PRODUCT_DIR
export LD_LIBRARY_PATH=$M_LROOT/bin:$M_LROOT/lib:/usr/lib
export DISPLAY=''0.0''
export PATH=$PATH:$M_LROOT/bin
linux下安装loadrunner(LoadGenerator)
1. 在HP的官方网站上下载LoadRunner9.5 的Linux安装程序[T7177-15009.iso],安装文档[hp_man_LRIG9.50_01_pdf.pdf];
安装程序包括Hp、Ibm、Linux、Solaris系统的支持(LR9.0对应安装文件为[TLRNUX900WC_00.zip])。
2. 安装包的处理:
1. ZIP解压:unzip TLRNUX900WC_00.zip
2. 挂载ISO:mkdir /mnt/LoadRunner ; mount -t iso9660 -o loop T7177-15009.iso /mnt/LoadRunner
3. 开始安装,以LR9.5为例:
/mnt/LoadRunner/Linux/installer.sh
按提示操作,直接Next到完成。
4. 添加用户和环境变量:
useradd -g 0 -s /bin/csh higkoo
cat /opt/HP/HP_LoadGenerator/env.csh > /etc/.login
cat /opt/HP/HP_LoadGenerator/env.csh >~higkoo/.cshrc
touch ~root/.rhosts ~higkoo/.rhosts
5. 检查运行环境(在本机或使用VNC执行):
su - higkoo
cd /opt/HP/HP_LoadGenerator/bin/
./verify_generator
6. 启动服务(用新增的用户higkoo):
cd /opt/HP/HP_LoadGenerator/bin/
./m_daemon_setup start
7. 检查是否启动:
ps aux | grep m_agent_daemon
netstat -naop | grep 54345
8. 注意事项:
开启端口54345或关闭防火墙(service iptables stop)
正确设置后用verify_generator的检测结果是:
./verify_generator =================================================== HP Vuser Environment Verification Utility ===================================================
Product: HP LoadRunner 9.50 Version: 09.50.0000 Build: 3378 higkoolincn100ce5:
verify_generator...OK verify_generator...OK verify_generator...OK Don''t forget to make sure that the name of the controller machine is also in .rhosts verify_generator...OK verify_generator...OK verify_generator...OK verify_generator...OK verify_generator...OK verify_generator...OK verify_generator...OK _______________________________________________
Summary: ________ Vuser Host higkoolincn100ce5: OK |
使用Controller连接,在“UNIX Environment Tab”下选择“Don''t use RSH ”即可连接Linux负载机。
若使用RSH连接,则负载机必须安装RSH并正确配置,正如检测过程中描述的“Don''t forget to make sure that the name of the controller machine”。
补充,Linux下似乎只支持Web/Http协议的脚本。譬如WinSock协议,从名称上都知道只适合Windows:
“Error (-81024): LR_VUG: The ''WinSock'' type is not supported on ''LINUX'' platforms .”
另外试了Java协议,确实不行,报错如下:
Error (-81024): LR_VUG: The ''General-Java'' type is not supported on ''LINUX'' platforms .
依赖库:yum -y --disablerepo=\* --enablerepo=AutoInstaller --nogpgcheck --skip-broken localinstall /mnt/CentOS_Final/CentOS/compat-libstdc++-33-3.2.3-61.i386.rpm
否则会报:m_agent_daemon: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
注意hosts文件的配置,如果机器名和hosts里配置不一致也会导致LoadRunner启动失败,
譬如:Error: Communication error: Failed to get the server host IP by calling the gethostbyname function.。
附上给LoadRunner定制的系统服务脚本(/etc/init.d/loadrunner):
# /etc/init.d/loadrunner
# Loadrunner负载生成器服务
DAEMON = m_daemon_setup
ARGV = "$@"
DIR = /opt/HP/HP_LoadGenerator/bin/
USER = higkoo
UBIT="su - $USER -c "
$UBIT "cd $DIR && ./$DAEMON $ARGV"运行服务:
service loadrunner start
m_agent_daemon ( 1808 ),
我们今天的关于Loadrunner压测时,出现的问题汇总和loadrunner压测教程的分享已经告一段落,感谢您的关注,如果您想了解更多关于45 个 LoadRunner 面试问题(附答案)、Linux/UNIX 下安装 loadrunner 的 load generator 负载生成器组件、Linux下安装LoadRunner LoadGenerator、linux下安装loadrunner(LoadGenerator)的相关信息,请在本站查询。
本文标签: