# Go ran-routing performance ## Методика Отдельный клиент `loadsink.py` подключается к upstream по WebSocket, и ждёт трафик. С другой стороны запускается генератор `loadgen.py`, который формирует аплинки, эмулируя гейтвей, и пишет их в redis. В каждый аплинк (в lora frm-payload) передаётся timestamp момента, когда мы создали этот аплинк (непосредственно перед отправкой). Клиент получает uplink, решает mic-challenge и извлекает frm-payload. Значение timestamp из frm-payload учитывается как начало отсчёта, а момент получения этого самого сообщения из ran-routing учитывается как конец отсчёта для одного аплинка. Весь трафик передаётся через 1 WS-подключение, в БД только 1 клиент и 1 устройство. ### Окружение - go version go1.20.3 linux/amd64 - Docker - Docker version 23.0.4, build f480fb1e37 - Docker Compose version 2.17.3 - Dependencies (all default config) - (redis:7.0.11-alpine) Redis version=7.0.11 - (postgres:15.2-alpine) PostgreSQL 15.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r4) 12.2.1 20220924, 64-bit - Hardware: i9-13900K / 32597140 kB memory ## Результаты ### Sequentual upstream Generating 100000 sequential uplinks without delay ``` $ python loadgen.py flat -n 100000 Generating 100000 sequential uplinks: Firing test! Completed: [================================================================================] 100% Done! $ python loadsink.py -p 10000 Using pool size: 10000 Connecting to: 'ws://0.0.0.0:8080/'... Connected, waiting for load... Test end marker received. Terminating test!... Waiting tasks to finish... Test finished! Summary: RPS (tottime): 8018.38781 Total req: 100000 Total time: 12.47133 secs Total bytes: 9.2MiB Average bytes: 96.26615B Throughput: 753.8KiB Slowest: 0.19318 secs Fastest: 0.00013 secs Average: 0.00792 secs Response time histogram: 0.00013 [1] | 0.01943 [92952] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.03874 [752] | 0.05804 [720] | 0.07735 [824] | 0.09665 [740] | 0.11596 [696] | 0.13527 [900] | 0.15457 [785] | 0.17388 [793] | 0.19318 [837] | Latency distribution: 10% in 0.00014 secs 25% in 0.00014 secs 50% in 0.00016 secs 75% in 0.00022 secs 90% in 0.00099 secs 95% in 0.07231 secs 99% in 0.16873 secs ``` Generating 100000 sequential uplinks without delay. Trust reduction disabled, ack's on client disabled. ``` $ python loadgen.py flat -n 100000 Generating 100000 sequential uplinks: Firing test! Completed: [================================================================================] 100% Done! $ python loadsink.py --no-ack -p 10000 [WARN] Ack's will be not sent (--no-ack flag) Using pool size: 10000 Connecting to: 'ws://0.0.0.0:8080/'... Connected, waiting for load... Test end marker received. Terminating test!... Waiting tasks to finish... Test finished! Summary: RPS (tottime): 8130.53222 Total req: 100000 Total time: 12.29932 secs Total bytes: 9.2MiB Average bytes: 96.0B Throughput: 762.2KiB Slowest: 0.00956 secs Fastest: 0.00012 secs Average: 0.00022 secs Response time histogram: 0.00012 [1] | 0.00107 [97524] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.00201 [800] | 0.00295 [568] | 0.00390 [404] | 0.00484 [265] | 0.00578 [181] | 0.00673 [151] | 0.00767 [37] | 0.00861 [43] | 0.00956 [26] | Latency distribution: 10% in 0.00013 secs 25% in 0.00013 secs 50% in 0.00014 secs 75% in 0.00014 secs 90% in 0.00016 secs 95% in 0.00025 secs 99% in 0.00318 secs ``` ### Batched upstream **NB:** В случае с батчами разброс latency скорее всего связан с особенностью измерения (фактически, моментом отправки считается момент создания upstream-сообщения, а не момент реального добавления в redis) Generating 100000 requests in 10 batches of 10000 uplinks each with 1.0s delays between batches. ``` $ python loadgen.py batch -b 10 -n 10000 -d 1.0 Generating 100000 requests in 10 batches of 10000 uplinks each with 1.0s delays between batches. Firing test! Completed: [================================================================================] 100% Done! $ python loadsink.py -p 10000 Using pool size: 10000 Connecting to: 'ws://0.0.0.0:8080/'... Connected, waiting for load... Test end marker received. Terminating test!... Waiting tasks to finish... Test finished! Summary: RPS (tottime): 4093.40009 Total req: 100000 Total time: 24.42957 secs Total bytes: 9.2MiB Average bytes: 96.44342B Throughput: 385.5KiB Slowest: 0.84257 secs Fastest: 0.23974 secs Average: 0.40602 secs Response time histogram: 0.23974 [1] | 0.30002 [17609] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.36030 [18631] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.42059 [20413] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.48087 [21856] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.54115 [16662] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.60144 [378] |■ 0.66172 [972] |■■ 0.72200 [1278] |■■ 0.78228 [913] |■■ 0.84257 [1287] |■■ Latency distribution: 10% in 0.27552 secs 25% in 0.32312 secs 50% in 0.40132 secs 75% in 0.47123 secs 90% in 0.50981 secs 95% in 0.52837 secs 99% in 0.79577 secs ``` Generating 100000 requests in 10 batches of 10000 uplinks each with 1.0s delays between batches. Trust reduction disabled, ack's on client disabled. ``` $ python loadgen.py batch -b 10 -n 10000 -d 1.0 Generating 100000 requests in 10 batches of 10000 uplinks each with 1.0s delays between batches. Firing test! Completed: [================================================================================] 100% Done! $ python loadsink.py --no-ack -p 10000 [WARN] Ack's will be not sent (--no-ack flag) Using pool size: 10000 Connecting to: 'ws://0.0.0.0:8080/'... Connected, waiting for load... Test end marker received. Terminating test!... Waiting tasks to finish... Test finished! Summary: RPS (tottime): 4125.52145 Total req: 100000 Total time: 24.23936 secs Total bytes: 9.2MiB Average bytes: 96.0B Throughput: 386.8KiB Slowest: 0.47821 secs Fastest: 0.23134 secs Average: 0.35739 secs Response time histogram: 0.23134 [1] | 0.25602 [9038] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.28071 [9965] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.30540 [9727] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.33009 [9183] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.35477 [9225] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.37946 [10159] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.40415 [11406] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.42883 [10970] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.45352 [12188] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.47821 [8138] |■■■■■■■■■■■■■■■■■■■■■■■■■■■ Latency distribution: 10% in 0.25833 secs 25% in 0.29652 secs 50% in 0.36122 secs 75% in 0.41985 secs 90% in 0.45003 secs 95% in 0.45922 secs 99% in 0.46755 secs