Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How much performance degradation does using Edgemesh cause? #546

Open
571072717 opened this issue Feb 18, 2024 · 0 comments
Open

How much performance degradation does using Edgemesh cause? #546

571072717 opened this issue Feb 18, 2024 · 0 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@571072717
Copy link

What happened and what you expected to happen:
I have written a WebSocket program in Python and used it to test the latency increase caused by using Edgemesh. Experiment one involved directly running the Python program between two hosts to test the transmission latency. Experiment two involved packaging the program into a container image and running it in a KubeEdge environment with Edgemesh deployed, again to test transmission latency. The test data is as follows: there was a noticeable increase in latency when using Edgemesh. I would like to inquire about the specific reasons for this latency increase and whether there are ways to reduce it.

图片

How to reproduce it (as minimally and precisely as possible):

server.py

import socket
import numpy as np
import json
import numbers
import sys

def is_number(var):
    return isinstance(var, numbers.Number)
#创建 socket 对象
socket_server = socket.socket()
socket_server.bind(("0.0.0.0", 8888))
socket_server.listen(1)

print("等待客户端连接...")
sys.stdout.flush()
conn, address = socket_server.accept()
print(f"接收到的客户端连接信息为{address}")

while True:
    #接收维度信息
    dim_info = conn.recv(1024).decode()
    if not dim_info:
        print("No dimension info received")
        continue
    #print(type(dim_info))
    dimensions = json.loads(dim_info)
    expected_size = np.prod(dimensions) * 4  # float32 占 4 字节

    #发送确认信号
    conn.send(b"ACK")

    #接收数据
    received_data = bytearray()
    while len(received_data) < expected_size:
        packet = conn.recv(expected_size - len(received_data))
        if not packet:
            break
        received_data.extend(packet)

    #转换数据
    np_array = np.frombuffer(received_data, dtype=np.float32).reshape(*dimensions)
    print(f"接收到的 numpy 数组: {np_array.shape}")
    
    #计算数据大小并回复
    data_size_mb = len(received_data) / (1024 * 1024)
    response = f"Received data size: {data_size_mb:.2f} MB"
    conn.send(response.encode())
    sys.stdout.flush()
    
#关闭连接
conn.close()
socket_server.close()

client.py

import socket
import numpy as np
import json
import time
#创建 socket 对象
socket_client = socket.socket()
socket_client.connect(("10.107.198.254", 8888))

while True:
    #用户输入第一维度大小
    first_dim = int(input("Enter the size of the first dimension of the array: "))

    #定义数组维度并生成数组
    dimensions = (first_dim, 56, 56)
    np_array = np.random.rand(*dimensions).astype(np.float32)

    #发送数组维度信息
    dim_info = json.dumps(dimensions)
    socket_client.send(dim_info.encode())

    #等待确认
    ack = socket_client.recv(1024)
    if ack.decode() != "ACK":
        print("No ACK received")
        break

    #发送数组数据
    time_start = time.time()
    binary_data = np_array.tobytes()
    socket_client.sendall(binary_data)

    #接收响应
    data = socket_client.recv(1024).decode("UTF-8")
    print(f"服务器回复的消息为:{data}")
    time_end = time.time()-time_start
    print('所用时间为:',time_end)
#关闭连接
socket_client.close()

Anything else we need to know?:
I conducted several sets of experiments, and the latency with Edgemesh was three to five times higher than the baseline experiment. Moreover, in high-bandwidth networks, Edgemesh showed even worse performance. Surprisingly, it demonstrated more ideal performance in complex network environments across different LANs.

Environment:

  • Kubernetes version (use kubectl version): 1.23.7
  • KubeEdge version(e.g. cloudcore --version and edgecore --version): v1.23.17 & v1.22.6-kubeedge-v1.12.1
  • Edgemesh version: v1.12.1
@571072717 571072717 added the kind/feature Categorizes issue or PR as related to a new feature. label Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant