Looking for ideas/advises lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- egsuh · 2021-03-17 06:14 I had problems with FCGI web server (in Windows 10, 64bit). The absolutely same application in CGI run without any problem. But CGI is quite slow when there are frequent database access. So I devised following structure. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit WebModule; uses DBModule; type  TwmDC1 = class(TFPWebModule)         procedure DataModuleRequest(Sender: TObject; ARequest: TRequest;        AResponse: TResponse; var Handled: Boolean);       // ....  and others    end;     // in the creation,  procedure TwmDC1.DataModuleCreate(Sender: TObject);begin   inherited;   while not Assigned(AQFB4) do AQFB4 := TAQFB4.Create(Self);  // <== This is the Trick   // some other operations end;  // -------  Separate module  unit DBModule; type  TAQFB4 = class(TDataModule, IDBAccess)     fbAQ: TIBConnection;       // This is firebird database     trAQ: TSQLTransaction;          // Queries, etc.     end; var   aqfb4 : TAQFB4;   // ...implementation   // ........................ initialization   aqfb4:= Taqfb4.Create(nil); finalization   aqfb4.free;       end. The WebModule is wkOneShot. The whole thing is because wkPooled mode does not work correctly. I tested my approach. I found that abfb4 is created about 65 times per about 1900 requests.  FCGI may create new instance as it is the way FCGI works, but I set the maximum instance of FCGI as 1 at IIS.  How do you think about this approach in overall? Or any better idea? Do you think the datamodule is created 65 times is normal? ---------------------------------------------------------------------- egsuh · 2021-03-17 08:13 I found the reason. I set FastCGI - IIS as       - Max number of instance = 1     - Max requests per instance = 20 So the application is re-loaded every 20 requests.  It's funny that it works up to 30 requests per instance, but crash at 35.