What is causing the latency in my Moku:Lab measurement when using APIs?
Discussion of latency due to network connections : Python, MATLAB and LabVIEW
When using the various APIs, there are various sources that can contribute to latency collection from a Moku:Lab, such as network condition, data packet size, and local host computer processing environment.
As Moku:Labs are network connected, data collection is strongly dependent on the network condition. The same data package will take longer to be sent from the Moku:Lab to the computer in slow network speed environment. For applications that require high speed data transmission, we recommend using wired connection methods over wireless connection. The data transfer latency is dependent on the connection method. Based on our test, Wi-Fi connection generates a data transfer latency of ~100 ms. Wired ethernet connection generates a latency of ~6 ms. USB connection generates a latency of ~1 ms. Check out our articles on how to connect your Moku:Lab via Ethernet cable to an existing network or directly to the computer.
The size of the data packet can also effect the collection latency. The "get_data" command will download the full resolution data from the device, whereas the "get_realtime_data" command will get downsampled data from the device with a lower latency.
The computer system condition can also cause latency, even after the data package has already reached the computer. Once the data package is downloaded, it will still need to be interpreted by the Moku APIs and the speed of this process is dependent on the computer, e.g. what processes are running and how powerful the CPU is. In a heavily loaded computer, the latency will therefore also increase.