Skip to content

Commit fc99547

Browse files
committed
for #405, improve the HTTP FLV delivery 1k to 2.3k. 2.0.168
1 parent 069ee0a commit fc99547

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ Remark:
326326
* 2014-04-28, [Release v1.0-mainline2](https://github.com/simple-rtmp-server/srs/releases/tag/1.0.mainline2), support [dvr](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_DVR), android, [edge](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Edge). 35255 lines.<br/>
327327
* 2014-04-07, [Release v1.0-mainline](https://github.com/simple-rtmp-server/srs/releases/tag/1.0.mainline), support [arm](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SrsLinuxArm), [init.d](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_LinuxService), http [server](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_HTTPServer)/[api](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_HTTPApi), [ingest](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SampleIngest). 30000 lines.<br/>
328328
* 2013-12-25, [Release v0.9](https://github.com/simple-rtmp-server/srs/releases/tag/0.9), support bandwidth test, player/encoder/chat [demos](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SampleDemo). 20926 lines.<br/>
329-
* 2013-12-08, [Release v0.8](https://github.com/simple-rtmp-server/srs/releases/tag/0.8), support [http hooks callback](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_HTTPCallback), update [st_load](https://github.com/winlinvip/st-load). 19186 lines.<br/>
329+
* 2013-12-08, [Release v0.8](https://github.com/simple-rtmp-server/srs/releases/tag/0.8), support [http hooks callback](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_HTTPCallback), update [SB](https://github.com/simple-rtmp-server/srs-bench). 19186 lines.<br/>
330330
* 2013-12-03, [Release v0.7](https://github.com/simple-rtmp-server/srs/releases/tag/0.7), support [live stream transcoding](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_FFMPEG). 17605 lines.<br/>
331331
* 2013-11-29, [Release v0.6](https://github.com/simple-rtmp-server/srs/releases/tag/0.6), support [forward](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Forward) stream to origin/edge. 16094 lines.<br/>
332332
* 2013-11-26, [Release v0.5](https://github.com/simple-rtmp-server/srs/releases/tag/0.5), support [HLS(m3u8)](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_DeliveryHLS), fragment and window. 14449 lines.<br/>
@@ -521,7 +521,7 @@ Remark:
521521
* v1.0, 2014-06-27, SRS online 30days with RTMP/HLS.
522522
* v1.0, 2014-06-25, fix [#108](https://github.com/simple-rtmp-server/srs/issues/108), support config time jitter for encoder non-monotonical stream. 0.9.133
523523
* v1.0, 2014-06-23, support report summaries in heartbeat. 0.9.132
524-
* v1.0, 2014-06-22, performance refine, support [3k+](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Performance#%E6%80%A7%E8%83%BD%E4%BE%8B%E8%A1%8C%E6%8A%A5%E5%91%8A4k) connections(270kbps). 0.9.130
524+
* v1.0, 2014-06-22, performance refine, support [3k+](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Performance#performancereport4k) connections(270kbps). 0.9.130
525525
* v1.0, 2014-06-21, support edge [token traverse](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_DRM#tokentraverse), fix [#104](https://github.com/simple-rtmp-server/srs/issues/104). 0.9.129
526526
* v1.0, 2014-06-19, add connections count to api summaries. 0.9.127
527527
* v1.0, 2014-06-19, add srs bytes and kbps to api summaries. 0.9.126
@@ -614,7 +614,7 @@ Remark:
614614
* v0.8, 2013-12-08, support multiple http hooks for a event.
615615
* v0.8, 2013-12-07, support http callback hooks, on_connect.
616616
* v0.8, 2013-12-07, support network based cli and json result, add CherryPy 3.2.4.
617-
* v0.8, 2013-12-07, update http/hls/rtmp load test tool [st_load](https://github.com/winlinvip/st-load), use SRS rtmp sdk.
617+
* v0.8, 2013-12-07, update http/hls/rtmp load test tool [SB](https://github.com/simple-rtmp-server/srs-bench), use SRS rtmp sdk.
618618
* v0.8, 2013-12-06, support max_connections, drop if exceed.
619619
* v0.8, 2013-12-05, support log_dir, write ffmpeg log to file.
620620
* v0.8, 2013-12-05, fix the forward/hls/encoder bug.
@@ -672,9 +672,9 @@ Performance benchmark history, on virtual box.
672672
* See also: [Performance for x86/x64 Test Guide](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_Performance)
673673
* See also: [Performance for RaspberryPi](https://github.com/simple-rtmp-server/srs/wiki/v1_CN_RaspberryPi)
674674

675-
### Play benchmark
675+
### Play RTMP benchmark
676676

677-
The play benchmark by [st-load](https://github.com/winlinvip/st-load):
677+
The play RTMP benchmark by [SB](https://github.com/simple-rtmp-server/srs-bench):
678678

679679

680680
| Update | SRS | Clients | Type | CPU | Memory | Commit |
@@ -692,9 +692,9 @@ The play benchmark by [st-load](https://github.com/winlinvip/st-load):
692692
| 2014-12-05 | 2.0.57 | 9.0k(9000) | players | 90% | 468MB | [code][p11] |
693693
| 2014-12-07 | 2.0.67 | 10k(10000) | players | 95% | 656MB | [code][p12] |
694694

695-
### Publish benchmark
695+
### Publish RTMP benchmark
696696

697-
The publish benchmark by [st-load](https://github.com/winlinvip/st-load):
697+
The publish RTMP benchmark by [SB](https://github.com/simple-rtmp-server/srs-bench):
698698

699699
| Update | SRS | Clients | Type | CPU | Memory | Commit |
700700
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------------ |
@@ -708,6 +708,16 @@ The publish benchmark by [st-load](https://github.com/winlinvip/st-load):
708708
| 2014-12-04 | 2.0.51 | 2.5k(2500) | publishers | 91% | 259MB | [code][p4] |
709709
| 2014-12-04 | 2.0.52 | 4.0k(4000) | publishers | 80% | 331MB | [code][p5] |
710710

711+
### Play HTTP FLV benchmark
712+
713+
The play HTTP FLV benchmark by [SB](https://github.com/simple-rtmp-server/srs-bench):
714+
715+
716+
| Update | SRS | Clients | Type | CPU | Memory | Commit |
717+
| ------------- | --------- | ------------- | ------------- | --------- | -------- | ------------ |
718+
| 2014-05-24 | 2.0.167 | 1.0k(1000) | players | 82% | 86MB | - |
719+
| 2014-05-24 | 2.0.168 | 2.3k(2300) | players | 92% | 276MB | - |
720+
711721
### Latency benchmark
712722

713723
The latency between encoder and player with realtime config(

trunk/src/app/srs_app_http_conn.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,20 @@ int SrsHttpResponseWriter::write(char* data, int size)
123123
}
124124

125125
// send in chunked encoding.
126-
std::stringstream ss;
127-
ss << hex << size << SRS_HTTP_CRLF;
128-
std::string ch = ss.str();
129-
if ((ret = skt->write((void*)ch.data(), (int)ch.length(), NULL)) != ERROR_SUCCESS) {
130-
return ret;
131-
}
132-
if ((ret = skt->write((void*)data, size, NULL)) != ERROR_SUCCESS) {
133-
return ret;
134-
}
135-
if ((ret = skt->write((void*)SRS_HTTP_CRLF, 2, NULL)) != ERROR_SUCCESS) {
126+
int nb_size = snprintf(header_cache, SRS_HTTP_HEADER_CACHE_SIZE, "%x", size);
127+
128+
iovec iovs[4];
129+
iovs[0].iov_base = (char*)header_cache;
130+
iovs[0].iov_len = (int)nb_size;
131+
iovs[1].iov_base = (char*)SRS_HTTP_CRLF;
132+
iovs[1].iov_len = 2;
133+
iovs[2].iov_base = (char*)data;
134+
iovs[2].iov_len = size;
135+
iovs[3].iov_base = (char*)SRS_HTTP_CRLF;
136+
iovs[3].iov_len = 2;
137+
138+
ssize_t nwrite;
139+
if ((ret = skt->writev(iovs, 4, &nwrite)) != ERROR_SUCCESS) {
136140
return ret;
137141
}
138142

trunk/src/app/srs_app_http_conn.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class SrsHttpMessage;
7171

7272
#ifdef SRS_AUTO_HTTP_PARSER
7373

74+
#define SRS_HTTP_HEADER_CACHE_SIZE 16
75+
7476
/**
7577
* response writer use st socket
7678
*/
@@ -79,6 +81,7 @@ class SrsHttpResponseWriter : public ISrsHttpResponseWriter
7981
private:
8082
SrsStSocket* skt;
8183
SrsHttpHeader* hdr;
84+
char header_cache[SRS_HTTP_HEADER_CACHE_SIZE];
8285
private:
8386
// reply header has been (logically) written
8487
bool header_wrote;

trunk/src/core/srs_core.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
// current release version
3232
#define VERSION_MAJOR 2
3333
#define VERSION_MINOR 0
34-
#define VERSION_REVISION 167
34+
#define VERSION_REVISION 168
3535

3636
// server info.
3737
#define RTMP_SIG_SRS_KEY "SRS"

0 commit comments

Comments
 (0)