当私有化部署 jitsi-meet
后,需要对它进行压力测试来评估其性能,通过官方提供的 jitsi/jitsi-meet-torture
工具来进行测试评估。
在 windows docker 环境下,未能成功部署测试。最后使用 python 通过
selenium
来模拟多个用户实现了测试。
代码
python 实现代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| from selenium import webdriver from selenium.webdriver.common.by import By import time from selenium.webdriver.edge.service import Service
class CacheStore: service = None driver = None
def get_edge_driver(): """ 获取 Edge 浏览器驱动 :return: """ if CacheStore.driver is not None: return CacheStore.driver
if CacheStore.service is None: CacheStore.service = Service(service_args=["--verbose"])
options = webdriver.EdgeOptions() options.set_capability("ms:inPrivate", True) options.add_argument("--headless")
driver = webdriver.Edge(service=CacheStore.service, options=options) driver.set_window_size(1920, 1080) return driver
def join_participants(room_instance_url): driver = get_edge_driver() driver.get(room_instance_url)
username_input = driver.find_element( By.CSS_SELECTOR, ".css-1m7m6m3-fieldContainer input" ) user_name = str(int(time.time())) username_input.send_keys(user_name) join_button = driver.find_element(By.CSS_SELECTOR, ".css-1hbmoh1-actionButton") join_button.click() time.sleep(0.5) try: video_button = driver.find_element(By.CSS_SELECTOR, ".display-video .jss29") print("user: {} join meeting and show screen".format(user_name)) video_button.click() except Exception as e: print("user: {} join meeting with no screen".format(user_name)) pass
if __name__ == "__main__": for i in range(100): join_participants("https://meeting.cn/test")
time.sleep(600)
|
参考
Load
Testing Jitsi Meet - Meetrix.IO
Jitsi-Meet
Torture/Load Test with Docker and JWT
jitsi/jitsi-meet-torture
(github.com)