tcp http 最佳化

來源:互聯網
上載者:User

標籤:tcp   http   

tcp

1.tcp_keepalive_time

int keepAlive = 1;   // 開啟keepalive屬性. 預設值: 0(關閉)  

int keepIdle = 60;   // 如果在60秒內沒有任何資料互動,則進行探測. 預設值:7200(s)  

int keepInterval = 5;   // 探測時發探測包的時間間隔為5秒. 預設值:75(s)  

int keepCount = 2;   // 探測重試的次數. 全部逾時則認定串連失效..預設值:9(次)  

setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (void*)&keepAlive, sizeof(keepAlive));  

setsockopt(s, SOL_TCP, TCP_KEEPIDLE, (void*)&keepIdle, sizeof(keepIdle));  

setsockopt(s, SOL_TCP, TCP_KEEPINTVL, (void*)&keepInterval, sizeof(keepInterval));  

setsockopt(s, SOL_TCP, TCP_KEEPCNT, (void*)&keepCount, sizeof(keepCount)); 


mongodb echo 300 > /proc/sys/net/ipv4/tcp_keepalive_time 預設是7200


tcp_keepalive_time and rst Flag in NAT Environment


本文出自 “人,要有自己的想法” 部落格,請務必保留此出處http://szgb2016.blog.51cto.com/340201/1854649

tcp http 最佳化

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.