Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H/3 stress #55098

Merged
merged 11 commits into from
Jul 9, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Builds and copies library artifacts into target dotnet sdk image
ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim

FROM $BUILD_BASE_IMAGE as corefxbuild

Expand Down
2 changes: 1 addition & 1 deletion eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# escape=`
# Simple Dockerfile which copies library build artifacts into target dotnet sdk image
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809
FROM $SDK_BASE_IMAGE as target

ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost"
Expand Down
2 changes: 1 addition & 1 deletion eng/docker/libraries-sdk.linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Builds and copies library artifacts into target dotnet sdk image
ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim

FROM $BUILD_BASE_IMAGE as corefxbuild

Expand Down
2 changes: 1 addition & 1 deletion eng/docker/libraries-sdk.windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# escape=`
# Simple Dockerfile which copies clr and library build artifacts into target dotnet sdk image
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809
FROM $SDK_BASE_IMAGE as target

ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public RequestContext(Configuration config, HttpClient httpClient, Random random
public int TaskNum { get; }
public bool IsCancellationRequested { get; private set; }

public Version HttpVersion => _config.HttpVersion;
public Version HttpVersion => _client.DefaultRequestVersion;
public HttpVersionPolicy VersionPolicy => _client.DefaultVersionPolicy;
public int MaxRequestParameters => _config.MaxParameters;
public int MaxRequestUriSize => _config.MaxRequestUriSize;
public int MaxRequestHeaderCount => _config.MaxRequestHeaderCount;
Expand All @@ -54,6 +55,7 @@ public RequestContext(Configuration config, HttpClient httpClient, Random random
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, HttpCompletionOption httpCompletion = HttpCompletionOption.ResponseContentRead, CancellationToken? token = null)
{
request.Version = HttpVersion;
request.VersionPolicy = VersionPolicy;

if (token != null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Seems like buster is still latest stable...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we don't. I didn't realize it's "testing" and not "stable". I just took the newest without checking. I'll revert it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need the bullseye after all. Seems like buster doesn't have current 6.0 preview SDK...

FROM $SDK_BASE_IMAGE

RUN echo "DOTNET_SDK_VERSION="$DOTNET_SDK_VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -13,6 +13,7 @@
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="System.CommandLine.Experimental" Version="0.3.0-alpha.19577.1" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="4.5.4" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Quic" Version="6.0.0-preview.5.21301.17"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- Add public nuget feed. -->
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this default? I don't mind to be explicit but I'm wondering if we need it in case we do not need custom feeds

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not if run from runtime repo, ours explicitly removes nuget.org: https://github.com/dotnet/runtime/blob/main/NuGet.config
So it all works in docker, where it's isolated, but when you ran it locally from S.N.Http/tests/... it failed due to one dependency coming from the public feed.

</packageSources>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using System.Net;
using HttpStress;

[assembly:SupportedOSPlatform("windows")]
[assembly:SupportedOSPlatform("linux")]

/// <summary>
/// Simple HttpClient stress app that launches Kestrel in-proc and runs many concurrent requests of varying types against it.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ HttpMessageHandler CreateHttpHandler()
}
}

return new HttpClient(CreateHttpHandler())
{
return new HttpClient(CreateHttpHandler())
{
BaseAddress = _baseAddress,
Timeout = _config.DefaultTimeout,
DefaultRequestVersion = _config.HttpVersion,
Expand Down Expand Up @@ -283,7 +283,7 @@ public void RecordCancellation(int operationIndex, TimeSpan elapsed)
public void RecordFailure(Exception exn, int operationIndex, TimeSpan elapsed, bool isCancelled, int taskNum, long iteration)
{
DateTime timestamp = DateTime.Now;

Interlocked.Increment(ref _totalRequests);
Interlocked.Increment(ref _failures[operationIndex]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public StressServer(Configuration configuration)
(string scheme, string hostname, int port) = ParseServerUri(configuration.ServerUri);
IWebHostBuilder host = WebHost.CreateDefaultBuilder();

if (configuration.UseHttpSys)
if (configuration.UseHttpSys && OperatingSystem.IsWindows())
{
// Use http.sys. This requires additional manual configuration ahead of time;
// see https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/httpsys?view=aspnetcore-2.2#configure-windows-server.
Expand Down Expand Up @@ -108,16 +108,29 @@ void ConfigureListenOptions(ListenOptions listenOptions)
}
listenOptions.UseHttps(cert);
}
if (configuration.HttpVersion == HttpVersion.Version30)
{
listenOptions.Protocols = HttpProtocols.Http3;
}
}
else
{
listenOptions.Protocols =
configuration.HttpVersion == new Version(2,0) ?
configuration.HttpVersion == HttpVersion.Version20 ?
HttpProtocols.Http2 :
HttpProtocols.Http1 ;
}
}
});

if (configuration.HttpVersion == HttpVersion.Version30)
{
host = host.UseQuic(options =>
{
options.Alpn = "h3-29";
options.IdleTimeout = TimeSpan.FromMinutes(1);
});
}
};

LoggerConfiguration loggerConfiguration = new LoggerConfiguration();
Expand Down Expand Up @@ -161,7 +174,7 @@ void ConfigureListenOptions(ListenOptions listenOptions)
private static void MapRoutes(IEndpointRouteBuilder endpoints)
{
var loggerFactory = endpoints.ServiceProvider.GetService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger<StressServer>();
var logger = loggerFactory?.CreateLogger<StressServer>();
var head = new[] { "HEAD" };

endpoints.MapGet("/", async context =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# escape=`
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809
FROM $SDK_BASE_IMAGE

# Use powershell as the default shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace System.Net
{
[EventSource(Name = "Microsoft-System-Net-Quic")]
[EventSource(Name = "Private.InternalDiagnostics.System.Net.Quic")]
internal sealed partial class NetEventSource : EventSource
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim
FROM $SDK_BASE_IMAGE

RUN echo "DOTNET_SDK_VERSION="$DOTNET_SDK_VERSION
RUN echo "DOTNET_VERSION="$DOTNET_VERSION

WORKDIR /app
COPY . .
WORKDIR /app/System.Net.Security/tests/StressTests/SslStress
WORKDIR /app/System.Net.Security/tests/StressTests/SslStress

ARG CONFIGURATION=Release
RUN dotnet build -c $CONFIGURATION
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Common\tests\System\IO\Compression\CRC.cs"
Link="Utils\CRC.cs" />
<Compile Include="..\..\..\..\Common\tests\System\IO\Compression\CRC.cs" Link="Utils\CRC.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.CommandLine.Experimental" Version="0.3.0-alpha.19577.1" />
<PackageReference Include="System.IO.Pipelines" Version="4.6.0" />
<PackageReference Include="System.IO.Pipelines" Version="6.0.0-preview.5.21301.5" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# escape=`
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-nanoserver-1809
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809
FROM $SDK_BASE_IMAGE

# Use powershell as the default shell
Expand All @@ -10,7 +10,7 @@ RUN echo "DOTNET_VERSION="$env:DOTNET_VERSION

WORKDIR /app
COPY . .
WORKDIR /app/System.Net.Security/tests/StressTests/SslStress
WORKDIR /app/System.Net.Security/tests/StressTests/SslStress

ARG CONFIGURATION=Release
RUN dotnet build -c $env:CONFIGURATION
Expand Down