所以我想使用funkload来对API进行压力测试。我在测试中有一组urls
问题是身份验证是通过querystring在每个请求上发送的(不涉及cookie)。
因此,/abc?auth=token1是一个用户,而/abc?auth=token2是另一个用户
我有类似如下的代码:
class Simple(FunkLoadTestCase):
def setUp(self):
# fetch urls from a file ... ending up with something like
urlList = ['http://localhost/abc?auth=1', 'http://localhost/def?auth=1']
self.urlList = urlList
def test_simple(self):
for url in self.urlList:
self.get(url, description='Get url')问题是服务器在很大程度上依赖memcached,所以同时运行同一个用户x次只会在第一个请求时给服务器带来适当的负载。
我正在寻找一种方法来识别我作为哪个并发用户运行,以便我可以修改每个并发用户的身份验证令牌。
有什么想法吗?
发布于 2012-06-29 22:52:03
对于任何遇到类似问题的人。我知道如何使用凭证服务器来做这件事。在passwords.txt中,我使用的不是username:password,而是name:authkey。
另一种方法,但不能扩展到运行多个负载生成服务器,您可以访问self.thread_id,这样您就可以知道您作为哪个线程/用户运行。
https://stackoverflow.com/questions/11212695
复制相似问题