/DataProcessingBenchmark

SqlServer vs Redis basic table operations benchmark

Primary LanguageC#

DataProcessingBenchmark

DataProcessingBenchmark is a .NET console application that compares the processing speed between Redis and SQL Server. The application creates a table, fills it with a specified number of rows, processes them, and measures the performance in terms of rows processed per second and elapsed time.

Table of Contents

Prerequisites

  • .NET SDK 6.0 or later
  • Redis server (if testing with Redis)
  • SQL Server (if testing with SQL Server)

Installation

  1. Clone the repository or download the source code.
  2. Navigate to the project directory.
cd DataProcessingBenchmark

### Add the necessary packages.

dotnet add package StackExchange.Redis
dotnet add package Microsoft.Data.SqlClient
dotnet add package CommandLineParser

### Build the project

dotnet build

Usage

Run the application with the appropriate command-line arguments to test the performance of Redis or SQL Server.

dotnet run -- [options]

Options

  • -d, --dataSource (required): Specify the data source: Redis or SqlServer.
  • -c, --connection (required): Connection string for the data source.
  • -b, --batchSize (default: 1000): Number of rows written at once.
  • -t, --threads (default: 4): Number of parallel threads.
  • -r, --rows (default: 10000): Total number of rows to be processed.

Examples

SQL Server

dotnet run -- -d SqlServer -c "Server=your_server;Database=your_db;User Id=your_user;Password=your_password;TrustServerCertificate=True" -b 1000 -t 4 -r 10000

Replace your_server, your_db, your_user, and your_password with the appropriate values for your SQL Server instance.

How to launch a DOcker image to test :

sudo docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<YourStrong@Passw0rd>" \
   -p 1433:1433 --name sql1 --hostname sql1 \
   -d \
   mcr.microsoft.com/mssql/server:2022-latest

dotnet run -- -d SqlServer -c "Server=localhost;Database=TestDB;User Id=SA;Password=YourStrong@Passw0rd;" -b 1000 -t 4 -r 10000

Redis

dotnet run -- -d Redis -c "localhost" -b 1000 -t 4 -r 10000

How to launch a DOcker image to test :

docker run -p 6379:6379 --name redis -d redis:latest

License

This project is licensed under the MIT License. See the LICENSE file for details.

Feel free to customize the README further based on your specific needs and preferences.