Resistance 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Resistance --version 1.0.1                
NuGet\Install-Package Resistance -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Resistance" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Resistance --version 1.0.1                
#r "nuget: Resistance, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Resistance as a Cake Addin
#addin nuget:?package=Resistance&version=1.0.1

// Install Resistance as a Cake Tool
#tool nuget:?package=Resistance&version=1.0.1                

Resistance

It is a library containing functions that create a chaotic environment for durability tests in web app environments.

In distributed systems, it is important that the whole is durable. The functions in this package can be added to an Asp.Net Runtime Middleware line. The following situations can be simulated in server or service environments.

Simulation Scenarios

  • Latency: Generating HTTP 500 statuses in service calls. For example, ensuring that a service call returns HTTP 500 with a 25% probability.
  • Resource Race: Simulating receiving too many requests.
  • Outage: Providing service interruption for certain periods of time. For example, a service outage of ten seconds per minute.
  • Network Failure: It ensures that HTTP 500 is returned based on a certain percentage of service calls. For example, service response times are delayed randomly by 500 to 2500 milliseconds.
  • Data Inconsistency: Data corruption on the response body. For example, adding text-based information to the body of every second response.

Usage

By default, all simulation behaviors are disabled. These values ​​can be enabled via appSettings. For more detailed settings, the Middleware function is used.

{
  "ResistanceFlags": {
    "NetworkFailureIsActive": true,
    "LatencyIsActive": false,
    "ResourceRaceIsActive": true,
    "OutageIsActive": false,
    "DataInconsistencyIsActive": false
  }
}

Code example;

app.UseResistance(new ResistanceOptions
{
    // Network Failure (HTTP 500 Internal Service Error with %25 probility)
    NetworkFailureProbability = NetworkFailureProbability.Percent25,
    // Produce HTTP 429 Too Many Request scenario with 3 concurrent request
    ResourceRaceUpperLimit = 3,
    // Manipulating response data with %50 probability
    DataInconsistencyProbability = DataInconsistencyProbability.Percent20,
    // Produce HTTP 503 Service Unavailable 10 seconds per minute
    OutagePeriod = new OutagePeriod
    {
        Duration = TimeSpan.FromSeconds(10),
        Frequency = TimeSpan.FromMinutes(1)
    },
    // Latency 500 millisecdons - 2500 milliseconds
    LatencyPeriod = new LatencyPeriod
    {
        MinDelayMs = TimeSpan.FromMilliseconds(500),
        MaxDelayMs = TimeSpan.FromMilliseconds(2500)
    }
});
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Resistance:

Repository Stars
buraksenyurt/DistributedChallenge
Bu repoda aslında asenkron mesaj kuyruklarını hedef alan bir dağıtık sistem problemi oluşturmaya ve bu problemin çözümünü uygulamaya çalışıyorum.