Skip to content

Commit

Permalink
Threads: Support multiple threads with locks, ossrs#2188. 5.0.2
Browse files Browse the repository at this point in the history
1. Threads-Log: Use thread to write and reopen logs.
2. Threads-SRTP: Support decrypt RTP by async SRTP.
3. Threads-RECV: Support dedicate thread to recv UDP packets.
4. Threads: Support cpu affinity for threads.
5. Threads-RECV: Drop received packet if exceed max queue size.
6. Threads: Use coroutine to consume recv/srtp packets.
7. Threads: Support Circuit-Breaker to work in storms.
8. Threads-SRTP: Support async decrypt RTCP
9. Threads-SEND: Support async send UDP packets
10. Threads-SRTP: Use async encrypt SRTP packet
11. Threads-SEND/RECV: Bind handler to listener to support multiple ports.
12. Threads-RECV: Support tunnel for recv-srtp.
13. Threads-SEND: Support tunnel for srtp-send.
14. Threads: Support circuit-breaker dying threshold
  • Loading branch information
winlinvip committed Apr 26, 2021
1 parent 8cf7ead commit b11f958
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 39 deletions.
55 changes: 17 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ Other documents:

## V5 changes

* v5.0, 2021-03-31, Threads: Support multiple threads with locks, [#2188](https://github.com/ossrs/srs/issues/2188). 5.0.2
* v5.0, 2021-03-17, Live: Refine edge to follow client and HTTP/302. 5.0.1
* v5.0, 2021-03-15, Init SRS/5. 5.0.0

Expand Down Expand Up @@ -1114,60 +1115,38 @@ The data for playing HTTP FLV was benchmarked by [SB][srs-bench]:
The RTC benchmark data, by [srs-bench](https://github.com/ossrs/srs-bench/tree/feature/rtc#usage):


| Update | SRS | Clients | Type | CPU | Memory | Threads |
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------- |
| 2021-03-31 | 4.0.87 | 550 | publishers | ~86% | 1.3GB | 1 |
| 2021-03-31 | 4.0.87 | 800 | players | ~94% | 444MB | 1 |
| Update | Server | Clients | Type | CPU | Memory | Threads | Commit |
| ------------- | --------- | ------------- | ------------- | --------- | -------- | -------- | --------- |
| 2021-03-31 | SRS/4.0.87 | 550 | publishers | ~86% | 1.3GB | 1 | |
| 2021-03-31 | SRS/4.0.87 | 800 | players | ~94% | 444MB | 1 | |
| 2021-03-31 | SRS/5.0.2 | 1400 | publishers | ~90% | 3.1GB | 6 | [#2188](https://github.com/ossrs/srs/issues/2188) |
| 2021-03-31 | SRS/5.0.2 | 1400 | players | ~93% | 1.0GB | 6 | [#2188](https://github.com/ossrs/srs/issues/2188) |
| 2021-03-31 | Janus/0.10.10 | 700 | publishers | ~320% | 142MB | 720 | |
| 2021-03-31 | Janus/0.10.10 | 700 | players | ~325% | 283MB | 720 | |

> Note: CentOS7, 500Kbps, 4CPU, 2.5 GHz Intel Xeon Platinum 8163/8269CY.
> Note: The benchmark tool for Janus is [srs-bench](https://github.com/ossrs/srs-bench/tree/feature/rtc#janus), and startup script by [janus-docker](https://github.com/winlinvip/janus-docker#usage).
<a name="latency-benchmark"></a>
**Latency benchmark**

The latency between encoder and player with realtime config([CN][v3_CN_LowLatency], [EN][v3_EN_LowLatency]):
|

| Update | SRS | VP6 | H.264 | VP6+MP3 | H.264+MP3 |
| ------------- | --------- | --------- | --------- | --------- | -------- |
| 2014-12-16 | 2.0.72 | 0.1s | 0.4s |[0.8s][p15]|[0.6s][p16]|
| 2014-12-12 | 2.0.70 |[0.1s][p13]|[0.4s][p14]| 1.0s | 0.9s |
| 2014-12-03 | 1.0.10 | 0.4s | 0.4s | 0.9s | 1.2s |
| Update | SRS | Protocol | VP6 | H.264 | VP6+MP3 | H.264+MP3 |
| ------------- | --------- | --------- | --------- | --------- | --------- | -------- |
| 2014-12-16 | 2.0.72 | RTMP | 0.1s | 0.4s |[0.8s][p15]|[0.6s][p16]|
| 2014-12-12 | 2.0.70 | RTMP |[0.1s][p13]|[0.4s][p14]| 1.0s | 0.9s |
| 2014-12-03 | 1.0.10 | RTMP | 0.4s | 0.4s | 0.9s | 1.2s |
| 2021-04-02 | 4.0.87 | WebRTC | x | 80ms | x | x |

> 2018-08-05, [c45f72e](https://github.com/ossrs/srs/commit/c45f72ef7bac9c7cf85b9125fc9e3aafd53f396f), Refine HTTP-FLV latency, support realtime mode. 2.0.252
We used FMLE as encoder for benchmark. The latency of server was 0.1s+,
and the bottleneck was the encoder. For more information, read
[bug #257][bug #257-c0].

<a name="hls-overhead"></a>
**HLS overhead**

About the overhead of HLS overhead, we compared FFMPEG and SRS.

| Bitrate | Duration | FLV(KB) | HLS(KB) | Overhead |
| ------- | -------- | ------- | -------- | --------- |
| 275kbps | 600s | 11144 | 12756 | 14.46% |
| 260kbps | 1860s | 59344 | 68004 | 14.59% |
| 697kbps | 60s | 5116 | 5476 | 7.03% |
| 565kbps | 453s | 31316 | 33544 | 7.11% |
| 565kbps | 1813s | 125224 | 134140 | 7.12% |
| 861kbps | 497s | 52316 | 54924 | 4.98% |
| 857kbps | 1862s | 195008 | 204768 | 5.00% |
| 1301kbps | 505s | 80320 | 83676 | 4.17% |
| 1312kbps | 1915s | 306920 | 319680 | 4.15% |
| 2707kbps | 600s | 198356 | 204560 | 3.12% |
| 2814kbps | 1800s | 618456 | 637660 | 3.10% |
| 2828kbps | 60s | 20716 | 21356 | 3.08% |
| 2599kbps | 307s | 97580 | 100672 | 3.16% |
| 2640kbps | 1283s | 413880 | 426912 | 3.14% |
| 5254kbps | 71s | 45832 | 47056 | 2.67% |
| 5147kbps | 370s | 195040 | 200280 | 2.68% |
| 5158kbps | 1327s | 835664 | 858092 | 2.68% |

The HLS overhead is calc by: (HLS - FLV) / FLV * 100%.

The overhead should be larger than this benchmark(48kbps audio is best overhead), for we fix the [#512][bug #512].

## Architecture

SRS always use the simplest architecture to solve complex domain problems.
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@

#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 1
#define VERSION_REVISION 2

#endif

0 comments on commit b11f958

Please sign in to comment.