1. A GraphQL API takes up to 7 seconds. See Figure 1.

2. Querying the time for this request in Laravel Telescope shows 1345 ms. See Figure 2.

3. Instead of requesting the GraphQL API from the page, making a standalone request using Altair GraphQL Client takes 1.87 seconds. This is roughly consistent with the time in Laravel Telescope. See Figure 3.

4. The current runtime environment is Windows 10, Nginx, and PHP FastCGI. This environment has a limitation: it can only serve one HTTP request at a time. This causes the GraphQL API wait time to reach 7 seconds.
5. The current Nginx configuration is as follows:
http {
## PHP-FPM Servers ##
upstream php-fpm {
server 127.0.0.1:9000;
}
server {
location ~ \.php$ {
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
6. Reference: https://stackoverflow.com/questions/15819351/can-windows-php-fpm-serve-multiple-simultaneous-requests .
7. Adjust the Nginx configuration as follows:
http {
## PHP-FPM Servers ##
upstream php-fpm {
server 127.0.0.1:9000;
}
upstream php_farm {
server 127.0.0.1:9003 weight=1;
server 127.0.0.1:9004 weight=1;
server 127.0.0.1:9005 weight=1;
server 127.0.0.1:9006 weight=1;
}
server {
location ~ \.php$ {
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass php_farm;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
8. Several php-cgi processes need to be started and bound to different ports: 9003, 9004, 9005, 9006. See Figure 4.

9. After restarting Nginx. See Figure 5.

10. Refresh the page in the browser again to check the GraphQL API request time. It has been reduced to about 2 seconds, as expected. See Figure 6.

