Add a script to time server startup.
This commit is contained in:
@@ -83,6 +83,6 @@ class Program
|
|||||||
new OptionsWrapper<KestrelServerOptions>(serverOptions), transportFactory, loggerFactory);
|
new OptionsWrapper<KestrelServerOptions>(serverOptions), transportFactory, loggerFactory);
|
||||||
|
|
||||||
await server.StartAsync(new Application(loggerFactory), CancellationToken.None);
|
await server.StartAsync(new Application(loggerFactory), CancellationToken.None);
|
||||||
Console.ReadLine();
|
await Task.Delay(Timeout.Infinite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ This project demonstrates how to run Kestrel without ASP.NET. It creates a web
|
|||||||
|
|
||||||
It also demonstrates how to add the websocket middleware. If you connect to ws://localhost:8080 (with wscat, for example) it will again respond with "hello world". This time it will be sent as a textual websocket message.
|
It also demonstrates how to add the websocket middleware. If you connect to ws://localhost:8080 (with wscat, for example) it will again respond with "hello world". This time it will be sent as a textual websocket message.
|
||||||
|
|
||||||
I wrote this code because I was curious to see if it could be done, but it may be interesting for someone. It uses significantly less memory than ASP.NET.
|
I wrote this code because I was curious to see if it could be done, but it may be interesting for someone. It uses significantly less memory than ASP.NET. Startup time is a bit lower too, about 180ms on my system. On a Linux system, you can measure it like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
dotnet publish -c Release
|
||||||
|
time ./time-startup
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
5
time-startup
Executable file
5
time-startup
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
trap "trap exit TERM; trap EXIT; pkill --pgroup 0" INT TERM EXIT
|
||||||
|
./bin/Release/net6.0/StandaloneKestrel &
|
||||||
|
while ! curl -s http://localhost:8080; do true; done
|
||||||
Reference in New Issue
Block a user