mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Perf: Limit the size of object cache pool
This commit is contained in:
parent
3989f2d553
commit
501104e728
6 changed files with 72 additions and 48 deletions
|
@ -4936,7 +4936,7 @@ bool SrsConfig::get_rtc_server_rtp_cache_enabled()
|
|||
|
||||
uint64_t SrsConfig::get_rtc_server_rtp_cache_pkt_size()
|
||||
{
|
||||
int DEFAULT = 128 * 1024 * 1024;
|
||||
int DEFAULT = 64 * 1024 * 1024;
|
||||
|
||||
SrsConfDirective* conf = get_rtc_server_rtp_cache();
|
||||
if (!conf) {
|
||||
|
@ -4948,12 +4948,12 @@ uint64_t SrsConfig::get_rtc_server_rtp_cache_pkt_size()
|
|||
return DEFAULT;
|
||||
}
|
||||
|
||||
return (uint64_t)(1024 * ::atof(conf->arg0().c_str()));
|
||||
return 1024 * (uint64_t)(1024 * ::atof(conf->arg0().c_str()));
|
||||
}
|
||||
|
||||
uint64_t SrsConfig::get_rtc_server_rtp_cache_payload_size()
|
||||
{
|
||||
int DEFAULT = 32 * 1024 * 1024;
|
||||
int DEFAULT = 16 * 1024 * 1024;
|
||||
|
||||
SrsConfDirective* conf = get_rtc_server_rtp_cache();
|
||||
if (!conf) {
|
||||
|
@ -4965,7 +4965,7 @@ uint64_t SrsConfig::get_rtc_server_rtp_cache_payload_size()
|
|||
return DEFAULT;
|
||||
}
|
||||
|
||||
return (uint64_t)(1024 * ::atof(conf->arg0().c_str()));
|
||||
return 1024 * (uint64_t)(1024 * ::atof(conf->arg0().c_str()));
|
||||
}
|
||||
|
||||
SrsConfDirective* SrsConfig::get_rtc_server_rtp_msg_cache()
|
||||
|
@ -5002,7 +5002,7 @@ bool SrsConfig::get_rtc_server_rtp_msg_cache_enabled()
|
|||
|
||||
uint64_t SrsConfig::get_rtc_server_rtp_msg_cache_msg_size()
|
||||
{
|
||||
int DEFAULT = 32 * 1024 * 1024;
|
||||
int DEFAULT = 16 * 1024 * 1024;
|
||||
|
||||
SrsConfDirective* conf = get_rtc_server_rtp_msg_cache();
|
||||
if (!conf) {
|
||||
|
@ -5014,12 +5014,12 @@ uint64_t SrsConfig::get_rtc_server_rtp_msg_cache_msg_size()
|
|||
return DEFAULT;
|
||||
}
|
||||
|
||||
return (uint64_t)(1024 * ::atof(conf->arg0().c_str()));
|
||||
return 1024 * (uint64_t)(1024 * ::atof(conf->arg0().c_str()));
|
||||
}
|
||||
|
||||
uint64_t SrsConfig::get_rtc_server_rtp_msg_cache_buffer_size()
|
||||
{
|
||||
int DEFAULT = 1024 * 1024 * 1024;
|
||||
int DEFAULT = 512 * 1024 * 1024;
|
||||
|
||||
SrsConfDirective* conf = get_rtc_server_rtp_msg_cache();
|
||||
if (!conf) {
|
||||
|
@ -5031,7 +5031,7 @@ uint64_t SrsConfig::get_rtc_server_rtp_msg_cache_buffer_size()
|
|||
return DEFAULT;
|
||||
}
|
||||
|
||||
return (uint64_t)(1024 * ::atof(conf->arg0().c_str()));
|
||||
return 1024 * (uint64_t)(1024 * ::atof(conf->arg0().c_str()));
|
||||
}
|
||||
|
||||
bool SrsConfig::get_rtc_server_black_hole()
|
||||
|
|
|
@ -282,17 +282,17 @@ srs_error_t SrsRtcServer::initialize()
|
|||
bool rtp_cache_enabled = _srs_config->get_rtc_server_rtp_cache_enabled();
|
||||
uint64_t rtp_cache_pkt_size = _srs_config->get_rtc_server_rtp_cache_pkt_size();
|
||||
uint64_t rtp_cache_payload_size = _srs_config->get_rtc_server_rtp_cache_payload_size();
|
||||
_srs_rtp_cache->set_enabled(rtp_cache_enabled, rtp_cache_pkt_size);
|
||||
_srs_rtp_raw_cache->set_enabled(rtp_cache_enabled, rtp_cache_payload_size);
|
||||
_srs_rtp_fua_cache->set_enabled(rtp_cache_enabled, rtp_cache_payload_size);
|
||||
_srs_rtp_cache->setup(rtp_cache_enabled, rtp_cache_pkt_size);
|
||||
_srs_rtp_raw_cache->setup(rtp_cache_enabled, rtp_cache_payload_size);
|
||||
_srs_rtp_fua_cache->setup(rtp_cache_enabled, rtp_cache_payload_size);
|
||||
|
||||
bool rtp_msg_cache_enabled = _srs_config->get_rtc_server_rtp_msg_cache_enabled();
|
||||
uint64_t rtp_msg_cache_msg_size = _srs_config->get_rtc_server_rtp_msg_cache_msg_size();
|
||||
uint64_t rtp_msg_cache_buffer_size = _srs_config->get_rtc_server_rtp_msg_cache_buffer_size();
|
||||
_srs_rtp_msg_cache_buffers->set_enabled(rtp_msg_cache_enabled, rtp_msg_cache_msg_size);
|
||||
_srs_rtp_msg_cache_objs->set_enabled(rtp_msg_cache_enabled, rtp_msg_cache_buffer_size);
|
||||
_srs_rtp_msg_cache_buffers->setup(rtp_msg_cache_enabled, rtp_msg_cache_buffer_size);
|
||||
_srs_rtp_msg_cache_objs->setup(rtp_msg_cache_enabled, rtp_msg_cache_msg_size);
|
||||
|
||||
srs_trace("RTC server init ok, rtp-cache=(enabled:%d,pkt:%dm-%dw,payload:%dm-%dw-%dw), msg-cache=(enabled:%d,obj:%dm-%dw,buf:%dm-%dw)",
|
||||
srs_trace("RTC: Object cache init, rtp-cache=(enabled:%d,pkt:%dm-%dw,payload:%dm-%dw-%dw), msg-cache=(enabled:%d,obj:%dm-%dw,buf:%dm-%dw)",
|
||||
rtp_cache_enabled, (int)(rtp_cache_pkt_size/1024/1024), _srs_rtp_cache->capacity()/10000,
|
||||
(int)(rtp_cache_payload_size/1024/1024), _srs_rtp_raw_cache->capacity()/10000, _srs_rtp_fua_cache->capacity()/10000,
|
||||
rtp_msg_cache_enabled, (int)(rtp_msg_cache_msg_size/1024/1024), _srs_rtp_msg_cache_objs->capacity()/10000,
|
||||
|
|
|
@ -97,6 +97,7 @@ public:
|
|||
virtual ~SrsRtcServer();
|
||||
public:
|
||||
virtual srs_error_t initialize();
|
||||
public:
|
||||
// Set the handler for server events.
|
||||
void set_handler(ISrsRtcServerHandler* h);
|
||||
void set_hijacker(ISrsRtcServerHijacker* h);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue