有人知道如何对Apollo服务器进行负载测试吗?
class UserBehavior(TaskSet):
def on_start(self):
self.login()
@task
def login(self):
headers = {"content-type": "application/json"}
self.client.post("/", data=json.dumps({
"query": "mutation { login(username:\"9849999983\", password: \"123456\") { token User { id fullName "
"email phoneNumber } } } "
},
headers=headers))
class ApolloSample(HttpLocust):
host = "https://sampleurl.com/api"
min_wait = 20000
max_wait = 50000
task_set = UserBehavior
这个问题在于,
self.client.post("/")
方法没有特定的终点。由于Graphql基本上由查询和变更组成。