winlin

set send socket buf. mw/mr sleep default to 350.

@@ -726,6 +726,7 @@ The play benchmark by [st-load](https://github.com/winlinvip/st-load): @@ -726,6 +726,7 @@ The play benchmark by [st-load](https://github.com/winlinvip/st-load):
726 * 2014-11-12, SRS 2.0.14, 3.5k(3500)clients, 95%CPU, 78MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/8acd143a7a152885b815999162660fd4e7a3f247) 726 * 2014-11-12, SRS 2.0.14, 3.5k(3500)clients, 95%CPU, 78MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/8acd143a7a152885b815999162660fd4e7a3f247)
727 * 2014-11-13, SRS 2.0.15, 6.0k(6000)clients, 82%CPU, 203MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/cc6aca9ad55342a06440ce7f3b38453776b2b2d1) 727 * 2014-11-13, SRS 2.0.15, 6.0k(6000)clients, 82%CPU, 203MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/cc6aca9ad55342a06440ce7f3b38453776b2b2d1)
728 * 2014-11-22, SRS 2.0.30, 7.5k(7500)clients, 87%CPU, 320MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/58136ec178e3d47db6c90a59875d7e40946936e5) 728 * 2014-11-22, SRS 2.0.30, 7.5k(7500)clients, 87%CPU, 320MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/58136ec178e3d47db6c90a59875d7e40946936e5)
  729 +* 2014-12-05, SRS 2.0.55, 8.0k(8000)clients, 89%CPU, 360MB. (mw_sleep=1800)[commit](https://github.com/winlinvip/simple-rtmp-server/commit/58136ec178e3d47db6c90a59875d7e40946936e5)
729 730
730 ### Publish benchmark 731 ### Publish benchmark
731 732
@@ -739,7 +740,7 @@ The publish benchmark by [st-load](https://github.com/winlinvip/st-load): @@ -739,7 +740,7 @@ The publish benchmark by [st-load](https://github.com/winlinvip/st-load):
739 * 2014-12-04, SRS 2.0.49, 1.4k(1400) publishers, 68%CPU, 144MB. 740 * 2014-12-04, SRS 2.0.49, 1.4k(1400) publishers, 68%CPU, 144MB.
740 * 2014-12-04, SRS 2.0.49, 2.5k(2500) publishers, 95%CPU, 404MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/29324fab469e0f7cef9ad04ffdbce832ac7dd9ff) 741 * 2014-12-04, SRS 2.0.49, 2.5k(2500) publishers, 95%CPU, 404MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/29324fab469e0f7cef9ad04ffdbce832ac7dd9ff)
741 * 2014-12-04, SRS 2.0.51, 2.5k(2500) publishers, 91%CPU, 259MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/f57801eb46c16755b173984b915a4166922df6a6) 742 * 2014-12-04, SRS 2.0.51, 2.5k(2500) publishers, 91%CPU, 259MB. [commit](https://github.com/winlinvip/simple-rtmp-server/commit/f57801eb46c16755b173984b915a4166922df6a6)
742 -* 2014-12-04, SRS 2.0.52, 4.0k(4000) publishers, 80%CPU, 331MB. (mr_sleep=2000) [commit](https://github.com/winlinvip/simple-rtmp-server/commit/5589b13d2e216b91f97afb78ee0c011b2fccf7da) 743 +* 2014-12-04, SRS 2.0.52, 4.0k(4000) publishers, 80%CPU, 331MB. (mr_sleep=2000)[commit](https://github.com/winlinvip/simple-rtmp-server/commit/5589b13d2e216b91f97afb78ee0c011b2fccf7da)
743 744
744 ## Architecture 745 ## Architecture
745 746
@@ -158,14 +158,15 @@ vhost mrw.srs.com { @@ -158,14 +158,15 @@ vhost mrw.srs.com {
158 # when there are 2500 publisher, the total memory of SRS atleast: 158 # when there are 2500 publisher, the total memory of SRS atleast:
159 # 183KB * 2500 = 446MB 159 # 183KB * 2500 = 446MB
160 # the value recomment is [300, 2000] 160 # the value recomment is [300, 2000]
161 - # default: 500  
162 - latency 500; 161 + # default: 350
  162 + latency 350;
163 } 163 }
164 # set the MW(merged-write) latency in ms. 164 # set the MW(merged-write) latency in ms.
165 # SRS always set mw on, so we just set the latency value. 165 # SRS always set mw on, so we just set the latency value.
166 # the latency of stream >= mw_latency + mr_latency 166 # the latency of stream >= mw_latency + mr_latency
167 - # default: 500  
168 - mw_latency 500; 167 + # the value recomment is [300, 1800]
  168 + # default: 350
  169 + mw_latency 350;
169 } 170 }
170 171
171 # vhost for edge, edge and origin is the same vhost 172 # vhost for edge, edge and origin is the same vhost
@@ -421,13 +421,14 @@ int SrsPublishRecvThread::on_reload_vhost_mr(string vhost) @@ -421,13 +421,14 @@ int SrsPublishRecvThread::on_reload_vhost_mr(string vhost)
421 421
422 void SrsPublishRecvThread::set_socket_buffer(int sleep_ms) 422 void SrsPublishRecvThread::set_socket_buffer(int sleep_ms)
423 { 423 {
424 - // the underlayer api will set to SRS_MR_SOCKET_BUFFER bytes. 424 + // the bytes:
425 // 4KB=4096, 8KB=8192, 16KB=16384, 32KB=32768, 64KB=65536, 425 // 4KB=4096, 8KB=8192, 16KB=16384, 32KB=32768, 64KB=65536,
426 // 128KB=131072, 256KB=262144, 512KB=524288 426 // 128KB=131072, 256KB=262144, 512KB=524288
427 - // the buffer should set to SRS_MR_MAX_SLEEP_MS*kbps/8, 427 + // the buffer should set to sleep*kbps/8,
428 // for example, your system delivery stream in 1000kbps, 428 // for example, your system delivery stream in 1000kbps,
429 // sleep 800ms for small bytes, the buffer should set to: 429 // sleep 800ms for small bytes, the buffer should set to:
430 // 800*1000/8=100000B(about 128KB). 430 // 800*1000/8=100000B(about 128KB).
  431 + // other examples:
431 // 2000*3000/8=750000B(about 732KB). 432 // 2000*3000/8=750000B(about 732KB).
432 // 2000*5000/8=1250000B(about 1220KB). 433 // 2000*5000/8=1250000B(about 1220KB).
433 int kbps = 5000; 434 int kbps = 5000;
@@ -83,7 +83,9 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd) @@ -83,7 +83,9 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd)
83 duration = 0; 83 duration = 0;
84 kbps = new SrsKbps(); 84 kbps = new SrsKbps();
85 kbps->set_io(skt, skt); 85 kbps->set_io(skt, skt);
  86 +
86 mw_sleep = SRS_PERF_MW_SLEEP; 87 mw_sleep = SRS_PERF_MW_SLEEP;
  88 + mw_enabled = false;
87 89
88 _srs_config->subscribe(this); 90 _srs_config->subscribe(this);
89 } 91 }
@@ -212,7 +214,10 @@ int SrsRtmpConn::on_reload_vhost_removed(string vhost) @@ -212,7 +214,10 @@ int SrsRtmpConn::on_reload_vhost_removed(string vhost)
212 214
213 int SrsRtmpConn::on_reload_vhost_mw(string /*vhost*/) 215 int SrsRtmpConn::on_reload_vhost_mw(string /*vhost*/)
214 { 216 {
215 - mw_sleep = _srs_config->get_mw_sleep_ms(req->vhost); 217 + int sleep_ms = _srs_config->get_mw_sleep_ms(req->vhost);
  218 +
  219 + // when mw_sleep changed, resize the socket send buffer.
  220 + change_mw_sleep(sleep_ms);
216 221
217 return ERROR_SUCCESS; 222 return ERROR_SUCCESS;
218 } 223 }
@@ -513,8 +518,7 @@ int SrsRtmpConn::playing(SrsSource* source) @@ -513,8 +518,7 @@ int SrsRtmpConn::playing(SrsSource* source)
513 518
514 // use isolate thread to recv, 519 // use isolate thread to recv,
515 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/217 520 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
516 - SrsQueueRecvThread trd(rtmp,  
517 - SRS_CONSTS_RTMP_PULSE_TIMEOUT_US / 1000); 521 + SrsQueueRecvThread trd(rtmp, SRS_PERF_MW_SLEEP);
518 522
519 // start isolate recv thread. 523 // start isolate recv thread.
520 if ((ret = trd.start()) != ERROR_SUCCESS) { 524 if ((ret = trd.start()) != ERROR_SUCCESS) {
@@ -558,10 +562,15 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd) @@ -558,10 +562,15 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
558 562
559 // initialize other components 563 // initialize other components
560 SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_PLAY_USER); 564 SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_PLAY_USER);
561 - SrsMessageArray msgs(SYS_CONSTS_MAX_PLAY_SEND_MSGS); 565 + SrsMessageArray msgs(SRS_PERF_MW_MSGS);
562 bool user_specified_duration_to_stop = (req->duration > 0); 566 bool user_specified_duration_to_stop = (req->duration > 0);
563 int64_t starttime = -1; 567 int64_t starttime = -1;
564 568
  569 + // setup the mw config.
  570 + // when mw_sleep changed, resize the socket send buffer.
  571 + mw_enabled = true;
  572 + change_mw_sleep(_srs_config->get_mw_sleep_ms(req->vhost));
  573 +
565 while (true) { 574 while (true) {
566 // to use isolate thread to recv, can improve about 33% performance. 575 // to use isolate thread to recv, can improve about 33% performance.
567 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/196 576 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/196
@@ -602,6 +611,7 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd) @@ -602,6 +611,7 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
602 srs_verbose("sleep for no messages to send"); 611 srs_verbose("sleep for no messages to send");
603 st_usleep(mw_sleep * 1000); 612 st_usleep(mw_sleep * 1000);
604 } 613 }
  614 + srs_info("got %d msgs, mw=%d", count, mw_sleep);
605 615
606 // reportable 616 // reportable
607 if (pithy_print.can_print()) { 617 if (pithy_print.can_print()) {
@@ -980,6 +990,46 @@ int SrsRtmpConn::process_play_control_msg(SrsConsumer* consumer, SrsMessage* msg @@ -980,6 +990,46 @@ int SrsRtmpConn::process_play_control_msg(SrsConsumer* consumer, SrsMessage* msg
980 return ret; 990 return ret;
981 } 991 }
982 992
  993 +void SrsRtmpConn::change_mw_sleep(int sleep_ms)
  994 +{
  995 + if (!mw_enabled) {
  996 + return;
  997 + }
  998 +
  999 + // the bytes:
  1000 + // 4KB=4096, 8KB=8192, 16KB=16384, 32KB=32768, 64KB=65536,
  1001 + // 128KB=131072, 256KB=262144, 512KB=524288
  1002 + // the buffer should set to sleep*kbps/8,
  1003 + // for example, your system delivery stream in 1000kbps,
  1004 + // sleep 800ms for small bytes, the buffer should set to:
  1005 + // 800*1000/8=100000B(about 128KB).
  1006 + // other examples:
  1007 + // 2000*3000/8=750000B(about 732KB).
  1008 + // 2000*5000/8=1250000B(about 1220KB).
  1009 + int kbps = 5000;
  1010 + int socket_buffer_size = sleep_ms * kbps / 8;
  1011 +
  1012 + int fd = st_netfd_fileno(stfd);
  1013 + int onb_sbuf = 0;
  1014 + socklen_t sock_buf_size = sizeof(int);
  1015 + getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &onb_sbuf, &sock_buf_size);
  1016 +
  1017 + // socket send buffer, system will double it.
  1018 + int nb_sbuf = socket_buffer_size / 2;
  1019 +
  1020 + // set the socket send buffer when required larger buffer
  1021 + if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &nb_sbuf, sock_buf_size) < 0) {
  1022 + srs_warn("set sock SO_SENDBUF=%d failed.", nb_sbuf);
  1023 + }
  1024 + getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &nb_sbuf, &sock_buf_size);
  1025 +
  1026 + srs_trace("mw changed %d=>%d, max_msgs=%d, esbuf=%d, sbuf %d=>%d",
  1027 + mw_sleep, sleep_ms, SRS_PERF_MW_MSGS, socket_buffer_size,
  1028 + onb_sbuf, nb_sbuf);
  1029 +
  1030 + mw_sleep = sleep_ms;
  1031 +}
  1032 +
983 int SrsRtmpConn::check_edge_token_traverse_auth() 1033 int SrsRtmpConn::check_edge_token_traverse_auth()
984 { 1034 {
985 int ret = ERROR_SUCCESS; 1035 int ret = ERROR_SUCCESS;
@@ -73,6 +73,8 @@ private: @@ -73,6 +73,8 @@ private:
73 SrsKbps* kbps; 73 SrsKbps* kbps;
74 // the MR(merged-write) sleep time in ms. 74 // the MR(merged-write) sleep time in ms.
75 int mw_sleep; 75 int mw_sleep;
  76 + // the MR(merged-write) only enabled for play.
  77 + int mw_enabled;
76 public: 78 public:
77 SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd); 79 SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd);
78 virtual ~SrsRtmpConn(); 80 virtual ~SrsRtmpConn();
@@ -102,6 +104,7 @@ private: @@ -102,6 +104,7 @@ private:
102 virtual int handle_publish_message(SrsSource* source, SrsMessage* msg, bool is_fmle, bool vhost_is_edge); 104 virtual int handle_publish_message(SrsSource* source, SrsMessage* msg, bool is_fmle, bool vhost_is_edge);
103 virtual int process_publish_message(SrsSource* source, SrsMessage* msg, bool vhost_is_edge); 105 virtual int process_publish_message(SrsSource* source, SrsMessage* msg, bool vhost_is_edge);
104 virtual int process_play_control_msg(SrsConsumer* consumer, SrsMessage* msg); 106 virtual int process_play_control_msg(SrsConsumer* consumer, SrsMessage* msg);
  107 + virtual void change_mw_sleep(int sleep_ms);
105 private: 108 private:
106 virtual int check_edge_token_traverse_auth(); 109 virtual int check_edge_token_traverse_auth();
107 virtual int connect_server(int origin_index, st_netfd_t* pstsock); 110 virtual int connect_server(int origin_index, st_netfd_t* pstsock);
@@ -216,7 +216,7 @@ int SrsMessageQueue::dump_packets(int max_count, SrsMessage** pmsgs, int& count) @@ -216,7 +216,7 @@ int SrsMessageQueue::dump_packets(int max_count, SrsMessage** pmsgs, int& count)
216 } else { 216 } else {
217 // erase some vector elements may cause memory copy, 217 // erase some vector elements may cause memory copy,
218 // maybe can use more efficient vector.swap to avoid copy. 218 // maybe can use more efficient vector.swap to avoid copy.
219 - // @remark for the pmsgs is big enough, for instance, SYS_CONSTS_MAX_PLAY_SEND_MSGS 128, 219 + // @remark for the pmsgs is big enough, for instance, SRS_PERF_MW_MSGS 128,
220 // the rtmp play client will get 128msgs once, so this branch rarely execute. 220 // the rtmp play client will get 128msgs once, so this branch rarely execute.
221 msgs.erase(msgs.begin(), msgs.begin() + count); 221 msgs.erase(msgs.begin(), msgs.begin() + count);
222 } 222 }
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 53 34 +#define VERSION_REVISION 55
35 // server info. 35 // server info.
36 #define RTMP_SIG_SRS_KEY "SRS" 36 #define RTMP_SIG_SRS_KEY "SRS"
37 #define RTMP_SIG_SRS_ROLE "origin/edge server" 37 #define RTMP_SIG_SRS_ROLE "origin/edge server"
@@ -60,7 +60,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -60,7 +60,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
60 #define SRS_PERF_MERGED_READ 60 #define SRS_PERF_MERGED_READ
61 // the default config of mr. 61 // the default config of mr.
62 #define SRS_PERF_MR_ENABLED false 62 #define SRS_PERF_MR_ENABLED false
63 -#define SRS_PERF_MR_SLEEP 500 63 +#define SRS_PERF_MR_SLEEP 350
64 64
65 /** 65 /**
66 * the MW(merged-write) send cache time in ms. 66 * the MW(merged-write) send cache time in ms.
@@ -73,9 +73,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -73,9 +73,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
73 * @remark the socket send buffer default to 185KB, it large enough. 73 * @remark the socket send buffer default to 185KB, it large enough.
74 * @see https://github.com/winlinvip/simple-rtmp-server/issues/194 74 * @see https://github.com/winlinvip/simple-rtmp-server/issues/194
75 * @see SrsConfig::get_mw_sleep_ms() 75 * @see SrsConfig::get_mw_sleep_ms()
  76 +* @remark the mw sleep and msgs to send, maybe:
  77 +* mw_sleep msgs iovs
  78 +* 350 24/48 48/84
  79 +* 500 24/48 48/84
  80 +* 800 42/64 84/128
  81 +* 1000 64/85 128/170
  82 +* 1200 65/86 130/172
  83 +* 1500 87/110 174/220
  84 +* 1800 106/128 212/256
  85 +* 2000 134/142 268/284
76 */ 86 */
77 // the default config of mw. 87 // the default config of mw.
78 -#define SRS_PERF_MW_SLEEP 500 88 +#define SRS_PERF_MW_SLEEP 350
  89 +/**
  90 +* how many msgs can be send entirely.
  91 +* for play clients to get msgs then totally send out.
  92 +* for the mw sleep set to 1800, the msgs is about 128.
  93 +* @remark, recomment to 156.
  94 +*/
  95 +#define SRS_PERF_MW_MSGS 156
79 96
80 /** 97 /**
81 * how many chunk stream to cache, [0, N]. 98 * how many chunk stream to cache, [0, N].
@@ -99,41 +99,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -99,41 +99,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
99 //#define SRS_CONSTS_RTMP_MAX_FMT3_HEADER_SIZE 5 99 //#define SRS_CONSTS_RTMP_MAX_FMT3_HEADER_SIZE 5
100 100
101 /** 101 /**
102 -* how many msgs can be send entirely.  
103 -* for play clients to get msgs then totally send out.  
104 -* for example, 25fps video, 40ms per video packet,  
105 -* while audio is 20ms per audio packet where 2/3 is audios,  
106 -* when SYS_CONSTS_MAX_PLAY_SEND_MSGS is 128, then  
107 -* we will send all 128*40ms/3=1706ms packets in a time,  
108 -* which should greater than the SRS_CONSTS_RTMP_PULSE_TIMEOUT_US  
109 -* (for example, 500ms), that is, we should:  
110 -* SYS_CONSTS_MAX_PLAY_SEND_MSGS * 40 / 3 >= SRS_CONSTS_RTMP_PULSE_TIMEOUT_US  
111 -* @remark, recomment to 128.  
112 -*/  
113 -#define SYS_CONSTS_MAX_PLAY_SEND_MSGS 128  
114 -/**  
115 * for performance issue, 102 * for performance issue,
116 * the iovs cache, @see https://github.com/winlinvip/simple-rtmp-server/issues/194 103 * the iovs cache, @see https://github.com/winlinvip/simple-rtmp-server/issues/194
117 * iovs cache for multiple messages for each connections. 104 * iovs cache for multiple messages for each connections.
118 -* each iovc is 16bytes, sizeof(iovec)=16, suppose the chunk size is 64k,  
119 -* each message send in a chunk which needs only 2 iovec,  
120 -* so the iovs max should be (SYS_CONSTS_MAX_PLAY_SEND_MSGS * 16 * 2) 105 +* suppose the chunk size is 64k, each message send in a chunk which needs only 2 iovec,
  106 +* so the iovs max should be (SRS_PERF_MW_MSGS * 2)
121 * 107 *
122 * @remark, SRS will realloc when the iovs not enough. 108 * @remark, SRS will realloc when the iovs not enough.
123 */ 109 */
124 -#define SRS_CONSTS_IOVS_MAX (SYS_CONSTS_MAX_PLAY_SEND_MSGS * 32) 110 +#define SRS_CONSTS_IOVS_MAX (SRS_PERF_MW_MSGS * 2)
125 /** 111 /**
126 * for performance issue, 112 * for performance issue,
127 * the c0c3 cache, @see https://github.com/winlinvip/simple-rtmp-server/issues/194 113 * the c0c3 cache, @see https://github.com/winlinvip/simple-rtmp-server/issues/194
128 * c0c3 cache for multiple messages for each connections. 114 * c0c3 cache for multiple messages for each connections.
129 * each c0 <= 16byes, suppose the chunk size is 64k, 115 * each c0 <= 16byes, suppose the chunk size is 64k,
130 * each message send in a chunk which needs only a c0 header, 116 * each message send in a chunk which needs only a c0 header,
131 -* so the c0c3 cache should be (SYS_CONSTS_MAX_PLAY_SEND_MSGS * 16) 117 +* so the c0c3 cache should be (SRS_PERF_MW_MSGS * 16)
132 * 118 *
133 * @remark, SRS will try another loop when c0c3 cache dry, for we cannot realloc it. 119 * @remark, SRS will try another loop when c0c3 cache dry, for we cannot realloc it.
134 -* so we use larger c0c3 cache, that is (SYS_CONSTS_MAX_PLAY_SEND_MSGS * 32) 120 +* so we use larger c0c3 cache, that is (SRS_PERF_MW_MSGS * 32)
135 */ 121 */
136 -#define SRS_CONSTS_C0C3_HEADERS_MAX (SYS_CONSTS_MAX_PLAY_SEND_MSGS * 32) 122 +#define SRS_CONSTS_C0C3_HEADERS_MAX (SRS_PERF_MW_MSGS * 32)
137 123
138 /////////////////////////////////////////////////////////// 124 ///////////////////////////////////////////////////////////
139 /////////////////////////////////////////////////////////// 125 ///////////////////////////////////////////////////////////
@@ -645,7 +645,7 @@ int SrsProtocol::do_send_messages(SrsMessage** msgs, int nb_msgs) @@ -645,7 +645,7 @@ int SrsProtocol::do_send_messages(SrsMessage** msgs, int nb_msgs)
645 // we donot use the complex basic header, 645 // we donot use the complex basic header,
646 // ensure the basic header is 1bytes. 646 // ensure the basic header is 1bytes.
647 if (msg->header.perfer_cid < 2) { 647 if (msg->header.perfer_cid < 2) {
648 - srs_warn("change the chunk_id=%d to default=%d", 648 + srs_info("change the chunk_id=%d to default=%d",
649 msg->header.perfer_cid, RTMP_CID_ProtocolControl); 649 msg->header.perfer_cid, RTMP_CID_ProtocolControl);
650 msg->header.perfer_cid = RTMP_CID_ProtocolControl; 650 msg->header.perfer_cid = RTMP_CID_ProtocolControl;
651 } 651 }
@@ -682,6 +682,10 @@ int SrsProtocol::do_send_messages(SrsMessage** msgs, int nb_msgs) @@ -682,6 +682,10 @@ int SrsProtocol::do_send_messages(SrsMessage** msgs, int nb_msgs)
682 // for we donot know how many messges maybe to send entirely, 682 // for we donot know how many messges maybe to send entirely,
683 // we just alloc the iovs, it's ok. 683 // we just alloc the iovs, it's ok.
684 if (iov_index >= nb_out_iovs - 2) { 684 if (iov_index >= nb_out_iovs - 2) {
  685 + srs_warn("resize iovs %d => %d, max_msgs=%d",
  686 + nb_out_iovs, nb_out_iovs + SRS_CONSTS_IOVS_MAX,
  687 + SRS_PERF_MW_MSGS);
  688 +
685 nb_out_iovs += SRS_CONSTS_IOVS_MAX; 689 nb_out_iovs += SRS_CONSTS_IOVS_MAX;
686 int realloc_size = sizeof(iovec) * nb_out_iovs; 690 int realloc_size = sizeof(iovec) * nb_out_iovs;
687 out_iovs = (iovec*)realloc(out_iovs, realloc_size); 691 out_iovs = (iovec*)realloc(out_iovs, realloc_size);
@@ -732,6 +736,8 @@ int SrsProtocol::do_send_messages(SrsMessage** msgs, int nb_msgs) @@ -732,6 +736,8 @@ int SrsProtocol::do_send_messages(SrsMessage** msgs, int nb_msgs)
732 if (iov_index <= 0) { 736 if (iov_index <= 0) {
733 return ret; 737 return ret;
734 } 738 }
  739 + srs_info("mw %d msgs in %d iovs, max_msgs=%d, nb_out_iovs=%d",
  740 + nb_msgs, iov_index, SRS_PERF_MW_MSGS, nb_out_iovs);
735 741
736 // send by writev 742 // send by writev
737 // sendout header and payload by writev. 743 // sendout header and payload by writev.