转自:http://loadrunner.wetpaint.com/page/Abnormal+termination,+caused+by+mdrv+process+termination
- The Host machine ( Load generator) is running too many Vusers as a result of which it system resources are being maximized. ( i.e. Consistent over 90% CPU and Memory utilization). The mdrv process does not get enough resources to process the request as a result it fails
- If you have Custom C coding, there is a possibility of allocated memory not being freed or memory violation errors which can lead to 'mdrv process termination'.
- Replay the script with think time.
- Turn off extended log when running the script in the controller.
- Do not use the controller itself as the loadgenerator. i.e. have a remote LoadGenerator.
- Introduce iteration pacing, if running more than one iteration each vuser.
- Open the file C:\WinNT\wlrun7.ini in a text editor, modify the entry from: AgentMaxThreadsPerDriver=50 to AgentMaxThreadsPerDriver=20 or 10
- Run Agent as process instead of service Launch command prompt and navigate to C:\Program Files\Mercury\Loadrunner\Launch_service\bin and run the command magentserive -remove. This will remove the agent. Now run the command magentproc -install This will install the agent as a process.
- Run vusers as process instead of threads.Please go to Runtime Settings > Miscellaneous > Multithreading > RunVuser as a process.
另外,注意下负载机的连接数是否过高,往往测试TPS较高的应用或是Client本身导致连接来不及释放会引起mmdrv进程Crash。当然加入Thinktime或者Pacing Time是种办法,一般最小可设置0.1~1s,但毕竟指标不治本,需要更多的用户来测试系统最大处理能力。
-------------------------
问题,LR对webservice的某个接口执行少量并发数的场景时,controller出现Abnormal termination, caused by mdrv process termination.大量错误,导致线程终止了请求,但服务器和负载机的资源都属正常。
解决方法和思路:为了解决此问题,查阅了网上较多资料和官网解释,大同小异,也进行一一尝试,最终无果,但意外发现资料中,除了一些参数设置修改以外,其中有条非常特别解释:“The Host machine ( Load generator) is running too many Vusers as a result of which it system resources are being maximized. ( i.e. Consistent over 90% CPU and Memory utilization). The mdrv process does not get enough resources to process the request as a result it fails”(这里大概的意思是:负载机的资源已经达到瓶颈,且无法接收响应回来的数据,导致process终止),于是萌生猜想,是不是服务器中数据库和tomcat之间出现了什么异常,导致数据无法响应给客户端,但按照常理,如果此两者出现异常,应该也是会相应http状态码返回客户端的,但非常异常的是controller只出现大量线程终止错误,为了验证此时的矛盾,于是请求开发协助,并在此接口的可能出现问题的地方加上相应日志,运行后,不出意料,结果正如我们的猜想,可能是数据库由于负载压力过大,导致了数据库与tomcat之间连接异常,tomcat却将异常信息返回给客户端,而客户端却无法识别响应,导致了controller出现线程终止的情况,为了解决此问题,开发修改了程序,将成功的请求就返回一个整型1,失败或异常请求就返回一个整型0,经过多次实践验证运行,都未出现上述线程终止的问题了。
---------------------------
修改了
LR
中的
D:\Program
Files\Mercury\LoadRunner\dat\protocols
中的
http.lrp
信息,
在
[Vugen]
下面新加一条
MaxThreadPerProcess=
要设置的
vuser
数量
。