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

Communication has a big latency #19

Open
astatio opened this issue May 19, 2022 · 1 comment
Open

Communication has a big latency #19

astatio opened this issue May 19, 2022 · 1 comment

Comments

@astatio
Copy link

astatio commented May 19, 2022

Waiting for a server's response seems to normally take around ~5000ms.

How to reproduce:

I have tested this with the following scenario:

Client side (Kotlin(JVM)):

import co.gongzh.procbridge.Client

val procClient = Client(
    "0.0.0.0",
    8000
)

    val start = System.currentTimeMillis()
    procClient.request("ping", null)
    println("Latency : ${System.currentTimeMillis() - start}ms")

Server side (Python):

import procbridge as pb


def handler(method, args):
    if method == "initialtest1":
        return "Initial test 1 triggered"
    if method == "initialtest2":
        return "Initial test 2 triggered"
    if method == "echo":
        return args
    if method == "ping":
        return "pong"


if __name__ == '__main__':
    port = 8000 
    s = pb.Server('0.0.0.0', port, handler)
    s.start(daemon=False)
    print("Procbridge server is on {}...".format(port))

Run it several time or put it in a loop.
You should get a similar result:

Latency : 5020ms
Latency : 1ms
Latency : 5001ms
Latency : 5009ms
Latency : 5003ms
Latency : 5004ms
Latency : 5004ms
Latency : 5003ms
Latency : 5004ms
Latency : 3ms
Latency : 2ms
Latency : 5008ms
Latency : 1ms
Latency : 5ms
Latency : 5008ms
Latency : 1ms
Latency : 1ms
Latency : 2ms
Latency : 5010ms
Latency : 5004ms
Latency : 5003ms
Latency : 5004ms
Latency : 5006ms
Latency : 5002ms
@gongzhang
Copy link
Owner

Hi, @astatio, thanks for the detailed description.

I took a quick look and it appears that something blocked and timed out at the 5 second mark. But I don't have a development environment at hand right now, can you help to confirm whether the blocking occurs on the server side or the client side? For example, you can set a breakpoint at procbridge/__init__.py#L126 and procbridge/__init__.py#L135 in the Python server-side program. The former is the location where the client request is received, and the latter is the location where the response data is sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants