Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
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;
Copy link
Contributor

@antonfirsov antonfirsov Jun 28, 2021

Choose a reason for hiding this comment

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

Doesn't this work with the -http config switch? Or am I missing something?

Edit: I see you leave it for the server + ALPN

public HttpVersionPolicy HttpVersionPolicy => _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 = HttpVersionPolicy;

if (token != null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:5.0-buster-slim
# use nightly build of 6.0 from main (Debian)
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:latest
FROM $SDK_BASE_IMAGE

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

# install dependencies of libmsquic.so
RUN apt-get update -y \
&& apt-get install -y \
liblttng-ust0 \
libatomic1 \
libc6 \
&& apt-get clean

WORKDIR /app
COPY . .

# pre-built msquic should be inside stress tests directory so we can copy it to container here
COPY libmsquic.so /usr/share/dotnet/shared/Microsoft.NETCore.App/$DOTNET_VERSION/
COPY libmsquic.lttng.so /usr/share/dotnet/shared/Microsoft.NETCore.App/$DOTNET_VERSION/

# no need to rebuild whole clr+libs with "-b" argument, we can substitute specific dlls only
# for that, pre-build locally for net6.0-Linux-Release, put inside stress tests directory and uncomment copy below
# COPY System.Net.Quic.dll /usr/share/dotnet/shared/Microsoft.NETCore.App/$DOTNET_VERSION/
# COPY System.Net.Http.dll /usr/share/dotnet/shared/Microsoft.NETCore.App/$DOTNET_VERSION/

ARG CONFIGURATION=Release
RUN dotnet build -c $CONFIGURATION

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,8 @@
<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>
</Project>
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 @@ -108,6 +108,10 @@ void ConfigureListenOptions(ListenOptions listenOptions)
}
listenOptions.UseHttps(cert);
}
if (configuration.HttpVersion == new Version(3,0))
{
listenOptions.Protocols = HttpProtocols.Http3;
}
}
else
{
Expand All @@ -118,6 +122,15 @@ void ConfigureListenOptions(ListenOptions listenOptions)
}
}
});

if (configuration.HttpVersion == new Version(3,0))
{
host = host.UseQuic(options =>
{
options.Alpn = "h3-29";
options.IdleTimeout = TimeSpan.FromHours(1);
});
}
};

LoggerConfiguration loggerConfiguration = new LoggerConfiguration();
Expand Down