Commit 32643254 authored by liyuanhong's avatar liyuanhong

优化了压力测试脚本

parent d975ac0c
...@@ -47,11 +47,10 @@ def getPressTestObj(): ...@@ -47,11 +47,10 @@ def getPressTestObj():
def flvFilePushTest(): def flvFilePushTest():
isLoop = 1 # 是否循环压力测试 0: 不循环 1:循环 isLoop = 1 # 是否循环压力测试 0: 不循环 1:循环
loopTime = 1 * 60 * 60 # 循环压力测试的时长 loopTime = 1 * 60 * 60 # 循环压力测试的时长
test = getPressTestObj() test = getPressTestObj()
logger.info("-----------------------------启动新一轮压力测试-----------------------------")
threadInfo = test.getThreadInfo() threadInfo = test.getThreadInfo()
threadInfoPull = test.getThreadInfoPull() threadInfoPull = test.getThreadInfoPull()
logger.info("剩余推流线程:" + str(len(threadInfo["threadObj"]))) logger.info("剩余推流线程:" + str(len(threadInfo["threadObj"])))
logger.info("剩余拉流线程:" + str(len(threadInfoPull["threadObj"]))) logger.info("剩余拉流线程:" + str(len(threadInfoPull["threadObj"])))
if isLoop == 0: if isLoop == 0:
...@@ -62,10 +61,9 @@ def flvFilePushTest(): ...@@ -62,10 +61,9 @@ def flvFilePushTest():
threadInfo = test.getThreadInfo() threadInfo = test.getThreadInfo()
threadInfoPull = test.getThreadInfoPull() threadInfoPull = test.getThreadInfoPull()
else: else:
time.sleep(10) time.sleep(30)
if len(threadInfo["threadObj"]) == 0 and len(threadInfoPull["threadObj"]) == 0: if len(threadInfo["threadObj"]) == 0 and len(threadInfoPull["threadObj"]) == 0:
test = getPressTestObj() test = getPressTestObj()
logger.info("-----------------------------启动新一轮压力测试-----------------------------")
threadInfo = test.getThreadInfo() threadInfo = test.getThreadInfo()
threadInfoPull = test.getThreadInfoPull() threadInfoPull = test.getThreadInfoPull()
while len(threadInfo["threadObj"]) != 0 and len(threadInfoPull["threadObj"]) != 0: while len(threadInfo["threadObj"]) != 0 and len(threadInfoPull["threadObj"]) != 0:
...@@ -76,7 +74,7 @@ def flvFilePushTest(): ...@@ -76,7 +74,7 @@ def flvFilePushTest():
threadInfoPull = test.getThreadInfoPull() threadInfoPull = test.getThreadInfoPull()
flvFilePushTest() flvFilePushTest()
logger.info("压力测试结束") logger.info("压力测试结束!!!!!!")
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment