Skip to content

Commit f022481

Browse files
SamuelCoxSamuel Cox
andauthored
feat: add dotnet10 to benchmarks (#3451)
* feat: preemptively add dotnet10 to benchmarks * chore: make script executable * fix: use correct Microsoft packages for aot * chore: update to latest amazon packages for dotnet10 * fix: aot compilation --------- Co-authored-by: Samuel Cox <samuel.cox@cenosco.com>
1 parent 3378773 commit f022481

13 files changed

Lines changed: 170 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ An ultra simple hello-world function has been written in each AWS supported runt
3434
- `python3.14`
3535
- `dotnet6`
3636
- `dotnet8`
37+
- `dotnet10`
3738
- `java11`
3839
- `java17`
3940
- `java21`
@@ -53,6 +54,7 @@ in addition to the following custom runtimes:
5354
- `dotnet8 aot` on `provided.al2`
5455
- `dotnet8 aot` on `provided.al2023`
5556
- `dotnet9 aot` on `provided.al2023`
57+
- `dotnet10 aot` on `provided.al2023`
5658
- `quarkus native` on `provided.al2`
5759
- `graalvm java17` on `provided.al2`
5860
- `graalvm java21` on `provided.al2023`

manifest.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,26 @@
151151
"baseImage": "public.ecr.aws/lambda/provided:al2023"
152152
}
153153
},
154+
{
155+
"displayName": "dotnet10",
156+
"runtime": "dotnet10",
157+
"handler": "LambdaPerf::LambdaPerf.Function::Handler",
158+
"path": "dotnet10",
159+
"architectures": ["x86_64", "arm64"],
160+
"image": {
161+
"baseImage": "public.ecr.aws/lambda/dotnet:10"
162+
}
163+
},
164+
{
165+
"displayName": "dotnet10 aot (prov.al2023)",
166+
"runtime": "provided.al2023",
167+
"handler": "bootstrap",
168+
"path": "dotnet10_aot_on_provided_al2023",
169+
"architectures": ["x86_64", "arm64"],
170+
"image": {
171+
"baseImage": "public.ecr.aws/lambda/provided:al2023"
172+
}
173+
},
154174
{
155175
"displayName": "java11",
156176
"runtime": "java11",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS builder
2+
ARG ARCH
3+
RUN apt-get update
4+
RUN apt-get install -y zip
5+
RUN dotnet tool install -g Amazon.Lambda.Tools
6+
WORKDIR /tmp
7+
COPY src .
8+
RUN export PATH="$PATH:/root/.dotnet/tools" && dotnet lambda package -farch ${ARCH} --configuration Release --framework net10.0 --output-package /tmp/code.zip
9+
10+
FROM scratch
11+
COPY --from=builder /tmp/code.zip /
12+
ENTRYPOINT ["/code.zip"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DIR_NAME="./runtimes/$1"
2+
ARCH=$2
3+
4+
rm ${DIR_NAME}/code_${ARCH}.zip 2> /dev/null
5+
6+
docker build ${DIR_NAME} --build-arg ARCH=${ARCH} -t maxday/dotnet10
7+
dockerId=$(docker create maxday/dotnet10)
8+
docker cp $dockerId:/code.zip ${DIR_NAME}/code_${ARCH}.zip
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Amazon.Lambda.Core;
2+
3+
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
4+
namespace LambdaPerf
5+
{
6+
public class Function
7+
{
8+
public object Handler()
9+
{
10+
return new { statusCode = 200 };
11+
}
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net10.0</TargetFramework>
4+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
5+
<AWSProjectType>Lambda</AWSProjectType>
6+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
7+
<PublishReadyToRun>true</PublishReadyToRun>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<PackageReference Include="Amazon.Lambda.Core" Version="2.8.0" />
11+
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
12+
</ItemGroup>
13+
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"configuration": "Release",
3+
"framework": "net10.0",
4+
"function-runtime": "dotnet10"
5+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ARG IMAGE_TAG
2+
FROM $IMAGE_TAG/amazonlinux:2023 AS builder
3+
ARG ARCH
4+
WORKDIR /tmp
5+
COPY src .
6+
RUN yum update -y && yum install -y clang zlib-devel krb5-devel openssl-devel zip gzip tar wget
7+
RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && chmod +x ./dotnet-install.sh && ./dotnet-install.sh --channel 10.0
8+
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
9+
ENV SSL_CERT_FILE=/tmp/noop
10+
RUN /root/.dotnet/dotnet publish --configuration Release --arch $ARCH --output /tmp/publish
11+
RUN zip -j /tmp/code.zip /tmp/publish/bootstrap
12+
13+
FROM scratch
14+
COPY --from=builder /tmp/code.zip /
15+
ENTRYPOINT ["/code.zip"]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
DIR_NAME="./runtimes/$1"
2+
3+
if [ $2 = "x86_64" ]; then
4+
ARCH="x64"
5+
IMAGE_TAG="amd64"
6+
PLATFORM="linux/amd64"
7+
elif [ $2 = "arm64" ]; then
8+
ARCH="arm64"
9+
IMAGE_TAG="arm64v8"
10+
PLATFORM="linux/arm64"
11+
else
12+
echo "The process architecture $2 is set incorrectly. The value can only be either x86_64 or arm64."
13+
exit 1
14+
fi
15+
16+
rm ${DIR_NAME}/code_${2}.zip 2> /dev/null
17+
18+
docker build --platform ${PLATFORM} ${DIR_NAME} --build-arg ARCH=${ARCH} --build-arg IMAGE_TAG=${IMAGE_TAG} -t maxday/dotnet10_on_provided_al2023_${2}
19+
dockerId=$(docker create maxday/dotnet10_on_provided_al2023_${2})
20+
docker cp $dockerId:/code.zip ${DIR_NAME}/code_${2}.zip

0 commit comments

Comments
 (0)