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

RTT time is incorrect while using multithreading #18

Open
s1042992 opened this issue Sep 5, 2021 · 1 comment
Open

RTT time is incorrect while using multithreading #18

s1042992 opened this issue Sep 5, 2021 · 1 comment

Comments

@s1042992
Copy link

s1042992 commented Sep 5, 2021

In python, I created a thread list and append the 40 times ping works measure_latency(host, port) into the list, then the result was like:

CH. 3 =  15.075 ms
CH. 17 =  20.111 ms
CH. 16 =  20.111 ms
CH. 4 =  20.593 ms
CH. 9 =  20.111 ms
CH. 14 =  21.094 ms
CH. 6 =  20.595 ms
CH. 8 =  20.595 ms
CH. 7 =  24.604 ms
CH. 11 =  20.111 ms
CH. 13 =  24.606 ms
CH. 10 =  25.609 ms
CH. 12 =  20.094 ms
CH. 2 =  25.104 ms
CH. 15 =  25.107 ms
CH. 35 =  25.105 ms
CH. 32 =  29.118 ms
CH. 1 =  25.104 ms
CH. 29 =  29.117 ms
CH. 24 =  33.128 ms
CH. 5 =  35.132 ms
CH. 31 =  29.117 ms
CH. 20 =  34.632 ms
CH. 21 =  35.633 ms
CH. 22 =  33.628 ms
CH. 36 =  34.129 ms
CH. 30 =  38.139 ms
CH. 26 =  38.641 ms
CH. 18 =  38.641 ms
CH. 25 =  39.142 ms
CH. 33 =  36.134 ms
CH. 28 =  38.641 ms
CH. 40 =  43.153 ms
CH. 34 =  35.132 ms
CH. 37 =  44.158 ms
CH. 23 =  25.607 ms
CH. 38 =  42.652 ms
CH. 39 =  44.158 ms
CH. 19 =  34.632 ms
CH. 27 =  39.142 ms

The RTT time above somehow progressively increases.

But without multithreaded, the result will be like:

CH. 1 =  22.148 ms
CH. 2 =  10.528 ms
CH. 3 =  11.267 ms
CH. 4 =  20.77 ms
CH. 5 =  22.03 ms
CH. 6 =  20.608 ms
CH. 7 =  22.036 ms
CH. 8 =  21.07 ms
CH. 9 =  11.059 ms
CH. 10 =  10.388 ms
CH. 11 =  11.491 ms
CH. 12 =  21.23 ms
CH. 13 =  21.141 ms
CH. 14 =  10.883 ms
CH. 15 =  21.39 ms
CH. 16 =  10.012 ms
CH. 17 =  11.529 ms
CH. 18 =  22.938 ms
CH. 19 =  21.064 ms
CH. 20 =  10.528 ms
CH. 21 =  20.711 ms
CH. 22 =  21.616 ms
CH. 23 =  21.658 ms
CH. 24 =  20.516 ms
CH. 25 =  21.279 ms
CH. 26 =  10.48 ms
CH. 27 =  22.067 ms
CH. 28 =  21.048 ms
CH. 29 =  10.035 ms
CH. 30 =  21.028 ms
CH. 31 =  11.028 ms
CH. 32 =  21.891 ms
CH. 33 =  21.369 ms
CH. 34 =  10.487 ms
CH. 35 =  21.774 ms
CH. 36 =  20.57 ms
CH. 37 =  11.006 ms
CH. 38 =  10.755 ms
CH. 39 =  21.569 ms
CH. 40 =  10.053 ms

It seems very normal without multithreaded.
I don't know why the result is incorrect in multithread, any help would be appreciated!

@ATolkachev
Copy link
Contributor

@s1042992 it could be caused by GIL. Better to use multiprocessing instead of multithreading.

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