我希望構(gòu)建一個(gè)每秒至少可以處理 300-400 個(gè)事務(wù)的流程/腳本。目前我正在使用 Workerman 來(lái)完成以下工作。我可以毫無(wú)問(wèn)題地運(yùn)行 400 個(gè)線程,但 tps 約為 60-70 tps,它可以以不到一秒的延遲進(jìn)行處理。以下是工作代碼:-現(xiàn)在,當(dāng)我將線程增加到 800 時(shí),問(wèn)題就開始了:-Notice: Undefined variable: PAK in test.php.php on line 77PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 69Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 69PHP Notice: Undefined variable: PAK in test.php.php on line 77Notice: Undefined variable: PAK in test.php.php on line 77PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 166Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 166PHP Notice: Undefined variable: resultCode in test.php.php on line 182Notice: Undefined variable: resultCode in test.php.php on line 182PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 185Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 185PHP Notice: Undefined variable: PAK_checking in test.php.php on line 197Notice: Undefined variable: PAK_checking in test.php.php on line 197PHP Notice: Undefined variable: psetdatelist in test.php.php on line 198Notice: Undefined variable: psetdatelist in test.php.php on line 198PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 166Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 166PHP Notice: Undefined variable: resultCode in test.php.php on line 182我檢查了一下,當(dāng)我增加工作人員數(shù)量時(shí),CURL XML 似乎是空的。但當(dāng) http_worker 為 400 時(shí),就完全沒(méi)有問(wèn)題了。我在虛擬機(jī)中運(yùn)行 8 核 CPU 和 16GB RAM。我的目標(biāo)是處理來(lái)自北行的盡可能多的請(qǐng)求,并以至少 300 TPS 的速度檢查南行。工藝流程如下:-客戶端 -> Main.php -> 檢查南向 -> 生產(chǎn)到 Kafka Topic問(wèn)題:當(dāng)我從 400 個(gè)線程增加到 800 個(gè)線程時(shí),我面臨的問(wèn)題是,我的curl 響應(yīng)始終為空。有沒(méi)有什么方法可以讓我至少發(fā)送 300 tps 并且 XML 解析它而不會(huì)出現(xiàn)任何問(wèn)題?或者有什么建議可以幫助我改進(jìn)我的流程嗎?
1 回答

慕妹3242003
TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超6個(gè)贊
我發(fā)現(xiàn) Unix 操作系統(tǒng)在處理超過(guò) 200-300 tps 的多個(gè)請(qǐng)求時(shí)有限制。
我找到了另一種使用 guzzleHTTP 的替代方案,這對(duì)我有幫助。它幫助我實(shí)現(xiàn)了 600 tps 以上,交易延遲為 2 秒。
- 1 回答
- 0 關(guān)注
- 262 瀏覽
添加回答
舉報(bào)
0/150
提交
取消