我希望构建一个每秒至少可以处理 300-400 个事务的流程/脚本。目前我正在使用 Workerman 来完成以下工作。我可以毫无问题地运行 400 个线程,但 tps 约为 60-70 tps,它可以以不到一秒的延迟进行处理。
以下是工作代码:-
现在,当我将线程增加到 800 时,问题就开始了:-
Notice: Undefined variable: PAK in test.php.php on line 77
PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 69
Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 69
PHP Notice: Undefined variable: PAK in test.php.php on line 77
Notice: Undefined variable: PAK in test.php.php on line 77
PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 166
Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 166
PHP Notice: Undefined variable: resultCode in test.php.php on line 182
Notice: Undefined variable: resultCode in test.php.php on line 182
PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 185
Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 185
PHP Notice: Undefined variable: PAK_checking in test.php.php on line 197
Notice: Undefined variable: PAK_checking in test.php.php on line 197
PHP Notice: Undefined variable: psetdatelist in test.php.php on line 198
Notice: Undefined variable: psetdatelist in test.php.php on line 198
PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 166
Warning: DOMDocument::loadXML(): Empty string supplied as input in test.php.php on line 166
PHP Notice: Undefined variable: resultCode in test.php.php on line 182
我检查了一下,当我增加工作人员数量时,CURL XML 似乎是空的。但当 http_worker 为 400 时,就完全没有问题了。
我在虚拟机中运行 8 核 CPU 和 16GB RAM。我的目标是处理来自北行的尽可能多的请求,并以至少 300 TPS 的速度检查南行。
工艺流程如下:-
客户端 -> Main.php -> 检查南向 -> 生产到 Kafka Topic
问题:当我从 400 个线程增加到 800 个线程时,我面临的问题是,我的curl 响应始终为空。
有没有什么方法可以让我至少发送 300 tps 并且 XML 解析它而不会出现任何问题?或者有什么建议可以帮助我改进我的流程吗?
慕妹3242003