Visual Studio 负载测试虚拟用户模拟
我目前正在编写一个负载测试应用程序,该应用程序利用 Visual Studio 2010 的负载测试。负载测试将在同一台计算机上模拟 20 个用户,并且我需要在所有模拟用户之间在内存中共享一些数据。
我很惊讶我找不到回答以下问题的文档:
是什么将每个虚拟用户的运行上下文与另一个虚拟用户的运行上下文分开?每个虚拟用户是否在自己的进程中运行测试?也许在它自己的应用程序域中?或者只是在它自己的线程上?我需要知道,因为如果每个用户都在自己的进程中运行测试,那么所有内存缓存都不会共享,而是为每个用户创建,而不是为所有用户创建一次,这对我来说很糟糕。
I'm currently working on writing a load testing application that takes advantage of Load Test using Visual Studio 2010. The load test will simulate 20 users on the same machine, and I need some data to be shared in-memory between all simulated users.
I was suprised I couldn't find documentation answering the following question:
What seperates each virtual user's running context from the other? Does each virtual user runs the tests in its own process? Maybe in its own app domain? Or just on its own thread? I need to know because if each user is running tests in its own process then all the in-memory cache isn't shared and is created for each user instead of one time for all of them, which is bad for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Process Explorer (http://technet.microsoft.com/en-us/sysinternals /bb896653 它是任务管理器的高级版本)来获取答案。
运行 Visual Studio 负载测试并打开 Process Explorer。检查是否正在创建新进程。然后找到Visual Studio进程并双击。然后选择 .NET Performance 选项卡,它应该显示进程中所有 AppDomain 的列表。
顺便说一句,今天我们发布了一个用于负载测试的 Fiddler 扩展,名为 StresStimulus - http://stresstimulus.stimulustechnology.com。我们将所有虚拟用户保留在同一进程的不同线程上。
You can use Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653 it’s an advanced version of Task Manager) to get the answer.
Run a Visual Studio Load test and open Process Explorer. Check for new processes are being created. Then find the Visual Studio process and double-click. Then select the .NET Performance tab and it should show the list of all AppDomains in the process.
Incidentally, today we released a Fiddler Extension for load testing called StresStimulus - http://stresstimulus.stimulustechnology.com. Where we keep all virtual users on different threads in the same process.
这是迄今为止我找到的最接近答案的。
http://blogs.msdn.com/b/billbar/archive/2007/06/13/coded-web-tests-and-web-test-plug-ins-should -not-block-the-thread.aspx
答案是每台机器有一个进程进行负载测试,使用多个线程,但虚拟用户被“优化”为每个线程工作多个线程。
关于您想要做什么,使用静态构造函数创建静态类将在所有虚拟用户之间获得共享内存块。需要注意的是,这是一个多线程环境,应该对您的代码采取适当的谨慎态度。
This is the closest to an answer that I have found so far.
http://blogs.msdn.com/b/billbar/archive/2007/06/13/coded-web-tests-and-web-test-plug-ins-should-not-block-the-thread.aspx
The answer being that there is a single process per machine doing the load tests, multiple threads are used, but the virtual users are "optimised" to work many per thread.
With regards to what you are wanting to do, creating a static class with a static constructor will get a shared block of memory between all virtual users. The caveat being that this is a multithreaded environment and the appropriate caution should be taken with your code.