Score:0

IIS FastCGI configuration for high concurrency

yt flag

I am hosting, on Windows Server 2022, a web application that makes regular ajax calls to a PHP backend.

The calls themselves are quite light, just pulling and pushing data from and to a MySQL db.

Over 1,000 users could be logged in concurrently (up to 10,000 in the near future). It doesn't seem to be an issue, until 100+ or so users log in concurrently, or near-concurrently.

I then get the server clogged with tens of stuck PHP-CGI processes.

Can anyone share advice on an adequate FastCGI config for this scenario? I am - to say the least - confused by

Maxrequests vs Maxinstances Activity timeout vs Idle timeout Queue length Rapid fails per minute vs Request timeout Using tcp vs using Namedpipe

Thanks

ua flag
Login counts are not of interest. Queries per second is. "nginx" is touted as fast; I have not tested it. You need to discover the max number of we clients and connections to MySQL. The latter is `SHOW GLOBAL STATUS LIKE 'Max_used_connections'` and also `'Threads_running'`. Do you have SSD?
Lex Li avatar
vn flag
Learn how to analyze why PHP web apps clogged with a profiler and then you can resolve stuck PHP-CGI processes and get what you wanted. Otherwise, you just get more of them.
resle avatar
yt flag
@RickJames it's a VPS, and yes I believe it's running on SSD. I remember in the past, analysis of that same application led to set max_connections to 600. However, SQL didn't seem to be the bottleneck. I was able to fire queries on workbench and get results instantly - while the clogging went on. It looks to me that PHP was somehow the culprit
resle avatar
yt flag
@LexLi can you suggest a profiler that will work with IIS? All I have found seems to require either Nginx or Apache
ua flag
@resle - PHP is limited to, or allowed to, a number of processes as specified by the web server. Otherwise, my experience says that PHP is not the villain. Sure, 600 MySQL connections is no problem -- but only if most are sitting idle. When `Threads_running` exceeds 20, you have a problem.
ua flag
@resle - And... AJAX feels lightweight, but look at what it must go through -- client -> web server -> fire up PHP -> connect to database -> perform query -> unwind. Realize that PHP is a process that is not sitting there waiting, but must be started up like any other process.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.