[Bug]: Performance Comparison With Kinesis Video Streams
[Bug]: Performance Comparison with Kinesis Video Streams
In this article, we will be discussing a performance comparison between Kinesis Video Streams and Kinesis WebRTC. The comparison is made using the unmodified sample application, and the results show a significant difference in CPU performance between the two. We will be using the latest versions of the SDKs, which are v3.4.2 for Kinesis Video Streams and v1.12.0 for Kinesis WebRTC.
Kinesis Video Streams is a fully managed service offered by AWS that allows users to capture, process, and store video streams from a variety of sources. It provides a scalable and secure way to handle video data, making it an ideal choice for applications that require real-time video processing.
Kinesis WebRTC, on the other hand, is a WebRTC-based solution that allows users to stream video and audio in real-time. It provides a more flexible and customizable solution compared to Kinesis Video Streams, but it also requires more resources to run.
The bug was discovered when comparing the CPU performance of Kinesis Video Streams and Kinesis WebRTC using the unmodified sample application. The results showed that Kinesis WebRTC was significantly heavier compared to Kinesis Video Streams.
The SDK versions used for the comparison are:
- Kinesis Video Streams: v3.4.2
- Kinesis WebRTC: v1.12.0
The commands used to start the processes are:
- Kinesis Video Streams:
gst-launch-1.0 rtspsrc location=${RTSP_SOURCE} ! rtph264depay ! h264parse ! kvssink log-config=/usr/lib/kinesis-vs/kvs_log_configuration stream-name=${AWS_IOT_CORE_THING_NAME} storage-size=128 aws-region=${AWS_DEFAULT_REGION} iot-certificate=iot-certificate,endpoint=${AWS_IOT_CORE_CREDENTIAL_ENDPOINT},cert-path=${AWS_IOT_CORE_CERT},key-path=${AWS_IOT_CORE_PRIVATE_KEY},ca-path=${AWS_KVS_CACERT_PATH},role-aliases=${AWS_IOT_CORE_ROLE_ALIAS},iot-thing-name=${AWS_IOT_CORE_THING_NAME}
- Kinesis WebRTC:
kvsWebrtcClientMasterGstSample $AWS_IOT_CORE_THING_NAME video-only rtspsrc $RTSP_SOURCE
The results of the comparison are shown in the following table:
Process | Tasks | %CPU | Memory |
---|---|---|---|
Kinesis Video Streams | 18 | 1.5 | 24.2M |
Kinesis WebRTC | 36 | 119.8 | 75.6M |
As can be seen from the table, Kinesis WebRTC is significantly heavier compared to Kinesis Video Streams, with a %CPU usage of 119.8 compared to 1.5 for Kinesis Video Streams.
The expected behavior is that Kinesis WebRTC should have a similar performance to Kinesis Video Streams, unless it is doing transcoding.
The current behavior is that Kinesis WebRTC has a low performance compared to Kinesis Video Streams.
To reproduce the bug, follow these steps:
- Clone the latest versions of the SDKs from the following repositories:
- Kinesis Video Streams:
https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp/archive/refs/tags/v3.4.2.tar.gz
- Kinesis WebRTC:
https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/archive/refs/tags/v1.12.0.tar.gz
- Kinesis Video Streams:
- Build the SDKs using the following commands:
- Kinesis Video Streams:
tar -xvf v3.4.2.tar.gz
- Kinesis WebRTC:
tar -xvf v1.12.0.tar.gz
- Kinesis Video Streams:
- Start the processes using the following commands:
- Kinesis Video Streams:
gst-launch-1.0 rtspsrc location=${RTSP_SOURCE} ! rtph264depay ! h264parse ! kvssink log-config=/usr/lib/kinesis-vs/kvs_log_configuration stream-name=${AWS_IOT_CORE_THING_NAME} storage-size=128 aws-region=${AWS_DEFAULT_REGION} iot-certificate=iot-certificate,endpoint=${AWS_IOT_CORE_CREDENTIAL_ENDPOINT},cert-path=${AWS_IOT_CORE_CERT},key-path=${AWS_IOT_CORE_PRIVATE_KEY},ca-path=${AWS_KVS_CACERT_PATH},role-aliases=${AWS_IOT_CORE_ROLE_ALIAS},iot-thing-name=${AWS_IOT_CORE_THING_NAME}
- Kinesis WebRTC:
kvsWebrtcClientMasterGstSample $AWS_IOT_CORE_THING_NAME video-only rtspsrc $RTSP_SOURCE
- Kinesis Video Streams:
- Monitor the CPU usage of the system using the following command:
top
In conclusion, the performance comparison between Kinesis Video Streams and Kinesis WebRTC shows that Kinesis WebRTC is significantly heavier compared to Kinesis Video Streams. This is likely due to the fact that Kinesis WebRTC is doing more processing and transcoding compared to Kinesis Video Streams.
Based on the results of the comparison, we recommend the following:
- Use Kinesis Video Streams for applications that require real-time video processing and do not require transcoding.
- Use Kinesis WebRTC for applications that require more flexible and customizable video streaming capabilities, but be aware that it may require more resources to run.
In the future, we plan to investigate the performance of Kinesis WebRTC further and identify the root cause of the low performance. We also plan to provide more detailed instructions on how to use Kinesis WebRTC and optimize its performance.
The following are the AWS console viewer statistics for both streams:
Q&A: Performance Comparison with Kinesis Video Streams
In our previous article, we discussed the performance comparison between Kinesis Video Streams and Kinesis WebRTC. We showed that Kinesis WebRTC is significantly heavier compared to Kinesis Video Streams, with a %CPU usage of 119.8 compared to 1.5 for Kinesis Video Streams. In this article, we will answer some frequently asked questions (FAQs) related to the performance comparison.
A: The main reason for the performance difference is that Kinesis WebRTC is doing more processing and transcoding compared to Kinesis Video Streams. Kinesis WebRTC is a more flexible and customizable solution, but it requires more resources to run.
A: Yes, you can use Kinesis WebRTC for real-time video processing applications, but be aware that it may require more resources to run. You should also consider the performance implications of using Kinesis WebRTC for real-time video processing.
A: There are several ways to optimize the performance of Kinesis WebRTC, including:
- Using a more efficient encoding scheme
- Reducing the bitrate of the video stream
- Using a more powerful processor or hardware accelerator
- Optimizing the software implementation of Kinesis WebRTC
A: Yes, you can use Kinesis Video Streams for applications that require more flexible and customizable video streaming capabilities. However, you may need to use additional tools or services to achieve the desired level of customization.
A: The benefits of using Kinesis Video Streams compared to Kinesis WebRTC include:
- Lower CPU usage and power consumption
- Lower latency and higher throughput
- Easier to use and configure
- More scalable and fault-tolerant
A: Yes, you can use both Kinesis Video Streams and Kinesis WebRTC in the same application. However, you will need to carefully consider the performance implications of using both services together.
A: The system requirements for running Kinesis Video Streams and Kinesis WebRTC include:
- A compatible processor or hardware accelerator
- Sufficient memory and storage
- A stable and secure network connection
- A compatible operating system and software environment
In conclusion, the performance comparison between Kinesis Video Streams and Kinesis WebRTC shows that Kinesis WebRTC is significantly heavier compared to Kinesis Video Streams. However, Kinesis WebRTC offers more flexible and customizable video streaming capabilities, making it a good choice for applications that require these. We hope that this Q&A article has provided you with a better understanding of the performance comparison between Kinesis Video Streams and Kinesis WebRTC.
Based on the results of the performance comparison, we recommend the following:
- Use Kinesis Video Streams for applications that require real-time video processing and do not require transcoding.
- Use Kinesis WebRTC for applications that require more flexible and customizable video streaming capabilities, but be aware that it may require more resources to run.
In the future, we plan to investigate the performance of Kinesis WebRTC further and identify the root cause of the low performance. We also plan to provide more detailed instructions on how to use Kinesis WebRTC and optimize its performance.
The following are some additional resources that may be helpful in understanding the performance comparison between Kinesis Video Streams and Kinesis WebRTC: