Skip to content
Advertisement

PHP Async Multi-threaded Curl Application

I’m looking to build a process/script that can handle at least 300-400 transaction per second. Currently i’m using Workerman to do the following job. I can run without any issue with 400 threads , but the tps was around 60-70 tps it can process with latency of less than a second.

Below is the working code :-

main.php:-

JavaScript

Now when I increase the thread to 800, the issue starts :-

JavaScript

I check and it seems the CURL XML was empty when i increased the worker count. But when it was 400 http_worker there is no issue at all.

I’m running on 8 core CPU and 16GB RAM in a VM. My goal is to process as much request from the northbound and check against a southbound with minimum 300 TPS.

The process flow is as below :-

Client -> Main.php -> Check with southbound -> Produce to Kafka Topic

Problem : The issue that i’m facing when i increased from 400 to 800 threads , my curl response is always empty.

Is there any method i can leverage to send 300 tps minimum and XML parse it without any issue? Or is there any suggest for me to improve my process flow?

Advertisement

Answer

I found out OS Unix has limitation when it comes to handle multiple request above 200-300 tps.

I had found another alternative using guzzleHTTP , that helped me. It helped me to achieve 600 tps + with transaction latency of 2 seconds.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement