Skip to content

This is a benchmark project using the BenchmarkDotNet library to measure the performance of a ProductsController in a WebAPI project.

Notifications You must be signed in to change notification settings

BerkayMehmetSert/netCore.BenchmarkDotNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.Net Core BenchmarkDotNet

This is a benchmark project using the BenchmarkDotNet library to measure the performance of a ProductsController in a WebAPI project.

Prerequisites

Installing

  1. Clone the repository
git clone https://github.com/BerkayMehmetSert/netCore.BenchmarkDotNet.git
  1. Change directory to the project
cd WebAPI
  1. Run the project
dotnet run

Usage

The API allows you to manage products. You can create, update, delete, and retrieve products.

Create a product

POST /api/products

Request Body:

{
  "name": "Product Name",
  "price": 9.99
}

Response Body:

{
  "id": "1a2b3c4d-5e6f-7g8h-9i10-jk11lmno12pq",
  "name": "Product Name",
  "price": 9.99
}

Update a product

PUT /api/products/{id}

Request Body:

{
  "name": "Updated Product Name",
  "price": 12.99
}

Response Body:

{
  "id": "1a2b3c4d-5e6f-7g8h-9i10-jk11lmno12pq",
  "name": "Updated Product Name",
  "price": 12.99
}

Delete a product

DELETE /api/products/{id}

Response Body:

{
  "id": "1a2b3c4d-5e6f-7g8h-9i10-jk11lmno12pq",
  "name": "Product Name",
  "price": 9.99
}

Get a product by ID

GET /api/products/{id}

Response Body:

{
  "id": "1a2b3c4d-5e6f-7g8h-9i10-jk11lmno12pq",
  "name": "Product Name",
  "price": 9.99
}

Get all products

GET /api/products

Response Body:

[
  {
    "id": "1a2b3c4d-5e6f-7g8h-9i10-jk11lmno12pq",
    "name": "Product Name 1",
    "price": 9.99
  },
  {
    "id": "2b3c4d5e-6f7g-8h9i-10jk-lm11nopq12rs",
    "name": "Product Name 2",
    "price": 12.99
  }
]

Performance Tests

We have also included a performance benchmark for the Get All Products endpoint. To run the benchmark, navigate to the WebAPI project and execute the following command:

dotnet run -c Release --framework net6.0 --project WebAPI.csproj

dotnet run -c Release --framework net6.0 --project Benchmark.Test.csproj

About

This is a benchmark project using the BenchmarkDotNet library to measure the performance of a ProductsController in a WebAPI project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages