From 47a4665b87ddd17b32b5405855a4883a92865e75 Mon Sep 17 00:00:00 2001 From: Alberto Soutullo Date: Fri, 26 Sep 2025 15:41:14 +0200 Subject: [PATCH] Isolated traffic chat messages 1 (#18) * Add isolated_traffic_chat_messages_1 * Add isolated_traffic_chat_messages_2 * Remove unnecessary logout * Update src/benchmark_scenarios/communities.py Co-authored-by: PearsonWhite * Update src/benchmark_scenarios/communities.py Co-authored-by: PearsonWhite * Stop correct nodes --------- Co-authored-by: PearsonWhite --- src/benchmark_scenarios/communities.py | 61 ++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/benchmark_scenarios/communities.py b/src/benchmark_scenarios/communities.py index c79987b..6c6c7db 100644 --- a/src/benchmark_scenarios/communities.py +++ b/src/benchmark_scenarios/communities.py @@ -185,3 +185,64 @@ async def request_to_join_community_mix(): logger.info("Shutting down node connections") await asyncio.gather(*[node.shutdown() for node in relay_nodes.values()]) logger.info("Finished store_performance") + + +async def isolated_traffic_chat_messages_1(): + # 1 community owner + # 500 user nodes + # 250 in community + # Community members send 1 message every 10s, measure volume + # Measure non-joined nodes have minimal traffic not correlated to community traffic in 1 and 2 + kube_utils.setup_kubernetes_client() + backend_relay_pods = kube_utils.get_pods("status-backend-relay", "status-go-test") + relay_nodes = await setup_status.initialize_nodes_application(backend_relay_pods) + + name = f"test_community_{''.join(random.choices(string.ascii_letters, k=10))}" + logger.info(f"Creating community {name}") + response = await relay_nodes["status-backend-relay-0"].wakuext_service.create_community(name) + community_id = response.get("result", {}).get("communities", [{}])[0].get("id") + logger.info(f"Community {name} created with ID {community_id}") + + owner = relay_nodes["status-backend-relay-0"] + nodes = [key for key in relay_nodes.keys() if key != "status-backend-relay-0"] + nodes_250 = nodes[:250] + join_ids = await request_join_nodes_to_community(relay_nodes, nodes_250, community_id) + chat_id = await accept_community_requests(owner, join_ids) + + await inject_messages(owner, 10, community_id+chat_id, 30) + await asyncio.sleep(10) + + logger.info("Shutting down node connections") + await asyncio.gather(*[node.shutdown() for node in relay_nodes.values()]) + logger.info("Finished store_performance") + + +async def isolated_traffic_chat_messages_2(): + # 1 community owner + # 500 user nodes + # 250 in community + # Stopping members shouldn't impact non-members traffic. + # Measure non-joined nodes have minimal traffic not correlated to community traffic in 1 and 2 + kube_utils.setup_kubernetes_client() + backend_relay_pods = kube_utils.get_pods("status-backend-relay", "status-go-test") + relay_nodes = await setup_status.initialize_nodes_application(backend_relay_pods) + + name = f"test_community_{''.join(random.choices(string.ascii_letters, k=10))}" + logger.info(f"Creating community {name}") + response = await relay_nodes["status-backend-relay-0"].wakuext_service.create_community(name) + community_id = response.get("result", {}).get("communities", [{}])[0].get("id") + logger.info(f"Community {name} created with ID {community_id}") + + owner = relay_nodes["status-backend-relay-0"] + nodes = [key for key in relay_nodes.keys() if key != "status-backend-relay-0"] + nodes_250 = nodes[:250] + join_ids = await request_join_nodes_to_community(relay_nodes, nodes_250, community_id) + chat_id = await accept_community_requests(owner, join_ids) + + await asyncio.sleep(10) + await asyncio.gather(*[relay_nodes[node].logout() for node in nodes_250]) + await asyncio.sleep(10) + + logger.info("Shutting down node connections") + await asyncio.gather(*[node.shutdown() for node in relay_nodes.values()]) + logger.info("Finished store_performance")