delphimvcframework/samples/concurrency_speed_test/concurrency_speed_test.dpr

70 lines
1.9 KiB
ObjectPascal
Raw Normal View History

2019-05-19 14:06:12 +02:00
program concurrency_speed_test;
{$APPTYPE CONSOLE}
uses
2023-06-06 17:33:37 +02:00
// RDPMM64,
2019-05-19 14:06:12 +02:00
System.SysUtils,
MVCFramework,
2019-05-19 14:06:12 +02:00
MVCFramework.Logger,
MVCFramework.DotEnv,
2019-05-19 14:06:12 +02:00
MVCFramework.Commons,
MVCFramework.Signal,
2019-05-19 14:06:12 +02:00
Web.ReqMulti,
Web.WebReq,
Web.WebBroker,
IdHTTPWebBrokerBridge,
MainControllerU in 'MainControllerU.pas',
WebModuleU in 'WebModuleU.pas' {MyWebModule: TWebModule};
{$R *.res}
procedure RunServer(APort: Integer);
var
lServer: TIdHTTPWebBrokerBridge;
begin
Writeln('** DMVCFramework Server ** build ' + DMVCFRAMEWORK_VERSION);
Writeln('Listening on port: ', APort);
2019-05-19 14:06:12 +02:00
lServer := TIdHTTPWebBrokerBridge.Create(nil);
try
lServer.DefaultPort := APort;
lServer.MaxConnections := dotEnv.Env('dmvc.webbroker.max_connections', 0);
lServer.ListenQueue := dotEnv.Env('dmvc.indy.listen_queue', 500);
lServer.Active := True;
WriteLn('CTRL+C to shutdown the server');
WaitForTerminationSignal;
EnterInShutdownState;
2019-05-19 14:06:12 +02:00
finally
lServer.Free;
end;
end;
begin
2023-06-06 17:33:37 +02:00
//ReportMemoryLeaksOnShutdown := True;
2019-05-19 14:06:12 +02:00
IsMultiThread := True;
try
if WebRequestHandler <> nil then
WebRequestHandler.WebModuleClass := WebModuleClass;
dotEnvConfigure(
function : IMVCDotEnv
begin
Result := NewDotEnv
.UseStrategy(TMVCDotEnvPriority.FileThenEnv)
2023-06-21 12:20:46 +02:00
//if available, by default, loads default environment (.env)
.UseProfile('test') //if available loads the test environment (.env.test)
.UseProfile('prod') //if available loads the prod environment (.env.prod)
.Build(); //uses the executable folder to look for .env* files
end);
WebRequestHandlerProc.MaxConnections := dotEnv.Env('dmvc.handler.max_connections', 1024);
RunServer(dotEnv.Env('dmvc.server.port', 9999));
2019-05-19 14:06:12 +02:00
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.