connectedhomeip icon indicating copy to clipboard operation
connectedhomeip copied to clipboard

[1.3] Linux platform, OTA speed is very slow, how to get better speed

Open GnarFang opened this issue 1 year ago • 3 comments

Reproduction steps

The OTA-provider sample can work fine, And using the wifi/Ethernet to transmit data. but the speed of it is sadly slow, I have a 77mb *.ota file, and it made alomst 3 hours how can I resolve this situation, thank you guys very much!!

My platform is Linux platform. OTA Provider and request are running on different Linux platform (Soc i.MX93 or i.MX8MM)

#provider chip-ota-provider-app --discriminator 22 --secured-device-port 5565 --KVS /tmp/chip_kvs_provider --filepath /home/root/thermostat-app.ota &

#request chip-ota-requestor-app --discriminator 18 --secured-device-port 5560 --KVS /tmp/chip_kvs_requestor --periodicQueryTimeout 60 --otaDownloadPath /home/root/download.bin

Even if I add -P 5 to decrease the polling time, but the speed didn't improve. chip-ota-provider-app --discriminator 22 --secured-device-port 5565 --KVS /tmp/chip_kvs_provider --filepath /home/root/thermostat-app.ota -P 5&

[1713415243.648261][1468:1468] CHIP:ATM: ReceiveInit [1713415243.648271][1468:1468] CHIP:ATM: Proposed Transfer Control: 0x20 [1713415243.648281][1468:1468] CHIP:ATM: Range Control: 0x0 [1713415243.648291][1468:1468] CHIP:ATM: Proposed Max Block Size: 10240 [1713415243.648301][1468:1468] CHIP:ATM: Start Offset: 0x0000000000000000 [1713415243.648311][1468:1468] CHIP:ATM: Proposed Max Length: 0x0000000000000000 [1713415243.648321][1468:1468] CHIP:ATM: File Designator Length: 29 [1713415243.648331][1468:1468] CHIP:ATM: File Designator: /home/root/thermostat-app.ota [1713415243.650419][1468:1468] CHIP:BDX: OutputEvent type: InitReceived [1713415243.650440][1468:1468] CHIP:ATM: Sending BDX Message [1713415243.650451][1468:1468] CHIP:ATM: ReceiveAccept [1713415243.650460][1468:1468] CHIP:ATM: Transfer Control: 0x20 [1713415243.650470][1468:1468] CHIP:ATM: Range Control: 0x0 [1713415243.982741][1468:1468] CHIP:ATM: Max Block Size: 1024 [1713415243.982754][1468:1468] CHIP:ATM: Length: 0x0000000000000000

The Max Block Size is limited to 1024. only 10KB data can be transferred in one second.

Bug prevalence

Whenvever I do this.

GitHub hash of the SDK that was being used

1.2 /1.3

Platform

IMX8

Platform Version(s)

No response

Type

Core SDK Performance Improvement

Anything else?

No response

GnarFang avatar Apr 18 '24 05:04 GnarFang

I have the same problem. I use efr32mg24.

KEEPHEADU avatar Aug 28 '24 07:08 KEEPHEADU

I also have same problem to transfer chip-ota-requestor-app-v2.ota(94M) that I made via ota_image_tool.py for testing TC-SU-3.2 as a OTA Provider/Controller DUT. It takes long time almost 3hours to download now.

And also why ~/apps/chip-ota-requestor-app(94M) on Test Harness is so big compared to chip-ota-requestor-app(8.6M) built on Mac Book?

And also, I tried optimizing options like below in examples/ota-requestor-app/linux/args.gni

# Change true to false to disable tracing support
matter_enable_tracing_support = false

# Add to disable ble
chip_config_network_layer_ble=false

# Add optimizing options for -Os
is_debug=false
optimize_for_size=true 

But the result size is 47M and it still takes 1 and half ours to download.

How to reduce the size of chip-ota-requestor-app more on Ubuntu? How can I reduce downloading time?

@bzbarsky-apple, Advise me if you have any solution plz.

Trishia avatar Oct 11 '24 06:10 Trishia

No idea for Linux, sorry. You could try using nm and the like to try to investigate why the binary is as big as it is....

bzbarsky-apple avatar Oct 15 '24 00:10 bzbarsky-apple

This is a large binary and we probably go over UDP ... I am not sure we are optimized for speed there.

Was the binary stripped? Is the performance better on other platforms?

andy31415 avatar Oct 21 '24 14:10 andy31415

@Trishia , @GnarFang for the large binary size, could you confirm if you ran strip on it?

I ran a short test on my machine and the size went from 95MB to 4.5MB for otarequestor (although that is probably not the image that should be OTAed)

image

andy31415 avatar Oct 21 '24 14:10 andy31415

Added NXP tag due to usage of ota_image_tool.py. @doru91

andy31415 avatar Oct 21 '24 14:10 andy31415

The original bug seems to be for iMX ... so assuming this is general NXP rather than linux?

andy31415 avatar Oct 21 '24 14:10 andy31415

@Trishia , @GnarFang for the large binary size, could you confirm if you ran strip on it?

I ran a short test on my machine and the size went from 95MB to 4.5MB for otarequestor (although that is probably not the image that should be OTAed)

image

Thanks!!! @andy31415

I didn't know about strip before. As a result, I could reduce the size of chip-ota-requestor-app to 1.5M with Optimization options that I mentioned above (https://github.com/project-chip/connectedhomeip/issues/33039#issuecomment-2406611066).

ubuntu@raspberrypi:~/connectedhomeip/out$ ls -alh
total 4.3M
drwxrwxr-x  3 ubuntu ubuntu 4.0K Oct 14 16:21 .
drwxrwxr-x 21 ubuntu ubuntu 4.0K Oct 11 15:16 ..
-rwxrwxr-x  1 ubuntu ubuntu 1.5M Oct 14 16:03 chip-ota-requestor-app-v2
-rw-rw-r--  1 ubuntu ubuntu 1.5M Oct 14 16:16 chip-ota-requestor-th-v2.ota

Trishia avatar Nov 06 '24 06:11 Trishia