做壓力測(cè)試或服務(wù)端請(qǐng)求一個(gè)特定域名時(shí),同一時(shí)刻的連接量默認(rèn)被.NET框架限制了,需要設(shè)置才能生效,我是通過windows的性能計(jì)數(shù)查看到壓力測(cè)試一直沒有真正提交上來,才發(fā)現(xiàn)這個(gè)問題,主要的設(shè)置參數(shù)為:System.Net.ServicePointManager.DefaultConnectionLimit,需要設(shè)置的相關(guān)參數(shù)如下:
System.Net.ServicePointManager.DefaultConnectionLimit在windows程序時(shí)默認(rèn)為2,不設(shè)置值,有可能會(huì)更大一點(diǎn),但不會(huì)超過100,可以把該值設(shè)置更大,但如果設(shè)置小了,就以設(shè)置后的值為準(zhǔn)
System.Net.ServicePointManager.DefaultConnectionLimit網(wǎng)站里默認(rèn)為12*N,N為CPU邏輯數(shù)量
這個(gè)參數(shù)也可能被設(shè)置,System.Net.ServicePointManager.MaxServicePoints默認(rèn)0,是設(shè)置ServicePoint的值,但是我沒用過,為0時(shí)表示不限制。
新聞熱點(diǎn)
疑難解答
圖片精選