EfficientDynamoDb 0.9.16-alpha.0.9

This is a prerelease version of EfficientDynamoDb.
There is a newer version of this package available.
See the version list below for details.
dotnet add package EfficientDynamoDb --version 0.9.16-alpha.0.9                
NuGet\Install-Package EfficientDynamoDb -Version 0.9.16-alpha.0.9                
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="EfficientDynamoDb" Version="0.9.16-alpha.0.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EfficientDynamoDb --version 0.9.16-alpha.0.9                
#r "nuget: EfficientDynamoDb, 0.9.16-alpha.0.9"                
#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 EfficientDynamoDb as a Cake Addin
#addin nuget:?package=EfficientDynamoDb&version=0.9.16-alpha.0.9&prerelease

// Install EfficientDynamoDb as a Cake Tool
#tool nuget:?package=EfficientDynamoDb&version=0.9.16-alpha.0.9&prerelease                

EfficientDynamoDb

.NET Core NuGet Version

EfficientDynamoDb is a high-performance C# library for DynamoDb with a huge focus on efficient resources utilization. Due to DynamoDb extreme scaling capabilities it is very important for backend services to not waste valuable CPU time on unmarshalling responses. EfficientDynamoDb is capable of zero allocation deserialization. In general it allocates up to 26X less memory and is up to 21X faster than official .NET AWS SDK.

For more details and developer's guide, visit our documentation page.

Benchmarks

Comparison with official DynamoDb SDK for .NET

|          Method | Items |         Mean |      Error |     StdDev |  Gen 0 |  Gen 1 | Gen 2 |  Allocated |
|---------------- |------ |-------------:|-----------:|-----------:|-------:|-------:|------:|-----------:|
|    EfficientDdb |    10 |      79.1 us |     0.8 us |     0.7 us |    4.3 |      - |     - |    18.2 KB |
|     aws-sdk-net |    10 |     620.8 us |     7.2 us |     6.0 us |   85.9 |   18.5 |     - |   352.3 KB |
|                 |       |              |            |            |        |        |       |            |
|    EfficientDdb |   100 |     484.1 us |     1.7 us |     1.6 us |   29.2 |    5.8 |     - |   120.8 KB |
|     aws-sdk-net |   100 |   6,127.1 us |   120.6 us |   148.1 us |  500.0 |  250.0 |     - |  3066.6 KB |
|                 |       |              |            |            |        |        |       |            |
|    EfficientDdb |  1000 |   4,733.0 us |    24.2 us |    22.7 us |  195.3 |   93.7 |     - |  1147.5 KB |
|     aws-sdk-net |  1000 |  99,438.8 us | 1,951.4 us | 3,518.9 us | 5200.0 | 1600.0 | 600.0 | 30177.0 KB |

Every benchmark simulates QUERY request to DynamoDb that return responses with number of items specified in Items column. All network calls are excluded and data is served from memory to eliminate network inconsistency in benchmarks. Entity contains various data types including lists, hashsets, strings, etc.

Configuration

BenchmarkDotNet=v0.12.1, OS=Windows 10.0.19041.685 (2004/?/20H1)
Intel Core i7-8550U CPU 1.80GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=3.1.110
  [Host]     : .NET Core 3.1.10 (CoreCLR 4.700.20.51601, CoreFX 4.700.20.51901), X64 RyuJIT
  DefaultJob : .NET Core 3.1.10 (CoreCLR 4.700.20.51601, CoreFX 4.700.20.51901), X64 RyuJIT

Introduction

EfficientDynamoDb has two types of API: high-level and low-level. High-level API, in most cases, is on-par with low-level in terms of raw processing speed and requires fewer memory allocations. It is recommended to use the high-level API in most cases unless you're sure about what you do.

GetItem

Retrieves a single item.

var user = await _context.GetItemAsync<UserEntity>("qwerty", "1234");

Query

Retrieves a list of items that match key and filter conditions.

var items = await _context.Query<UserEntity>()
    .WithKeyExpression(Condition<UserEntity>.On(x => x.Username).EqualsTo("qwerty"))
    .WithFilterExpression(Condition<UserEntity>.On(x => x.Age).GreaterThanOrEqualsTo(18))
    .ToListAsync();

UpdateItem

Edits an existing item's attributes or adds a new item to the table if it does not already exist.

await ddbContext.UpdateItem<UserEntity>()
    .WithPrimaryKey("partitionKey", "sortKey")
    .On(x => x.FirstName).Assign("John")
    .On(x => x.LastName).Assign("Doe")
    .ExecuteAsync();

TransactWriteItems

Atomically applies one of four operations per item within the same AWS account and Region.

await context.TransactWrite()
    .WithItems(
        Transact.PutItem(new UserEmailEntity("test@test.com")),
        Transact.ConditionCheck<UserEntity>()
            .WithPrimaryKey("partitionKey", "sortKey")
            .WithCondition(Condition<UserEntity>.On(x => x.Verified).EqualsTo(false))
    )
    .ExecuteAsync();

Visit our website for a complete operations list.

Compatibility with official AWS SDK for .NET

EfficientDynamoDb API is quite similar to the official DynamoDB SDK for .NET, so migration should be relatively easy. The most significant differences are described in the compatibility guide.

Documentation

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on EfficientDynamoDb:

Package Downloads
EfficientDynamoDb.Credentials.AWSSDK

AWS SDK credentials compatibility package for EfficientDynamoDb

Eska.DynamoDb.Orm

DynamoDb ORM for Single Table Design

GitHub repositories (1)

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

Repository Stars
AllocZero/EfficientDynamoDb
High-performance C# DynamoDb library
Version Downloads Last updated
0.9.17-alpha.0.1 142 10/16/2024
0.9.16 31,349 5/25/2024
0.9.16-alpha.0.9 67 5/25/2024
0.9.16-alpha.0.8 69 5/25/2024
0.9.16-alpha.0.7 77 5/11/2024
0.9.16-alpha.0.6 65 4/27/2024
0.9.16-alpha.0.5 71 4/27/2024
0.9.15 10,924 2/4/2024
0.9.15-alpha.0.12 722 9/5/2023
0.9.15-alpha.0.7 102 8/16/2023
0.9.15-alpha.0.6 84 8/16/2023
0.9.15-alpha.0.2 453 7/7/2023
0.9.15-alpha.0.1 92 7/5/2023
0.9.14 59,283 5/22/2023
0.9.14-alpha.0.7 85 5/22/2023
0.9.14-alpha.0.6 105 3/19/2023
0.9.14-alpha.0.5 70,059 9/20/2022
0.9.14-alpha.0.4 107 9/9/2022
0.9.14-alpha.0.3 2,294 6/30/2022
0.9.14-alpha.0.2 121 5/26/2022
0.9.13 50,844 4/27/2022
0.9.13-alpha.0.8 121 4/27/2022
0.9.13-alpha.0.5 208 12/17/2021
0.9.13-alpha.0.4 1,188 11/27/2021
0.9.13-alpha.0.2 191 11/2/2021
0.9.13-alpha.0.1 183 10/27/2021
0.9.12 24,921 10/19/2021
0.9.12-alpha.0.1 157 10/19/2021
0.9.11 340 10/12/2021
0.9.11-alpha.0.2 137 10/11/2021
0.9.11-alpha.0.1 144 10/11/2021
0.9.10 464 9/29/2021
0.9.10-alpha.0.3 175 9/29/2021
0.9.9 696 9/15/2021
0.9.9-alpha.0.5 145 9/15/2021
0.9.9-alpha.0.4 146 9/15/2021
0.9.9-alpha.0.3 150 9/15/2021
0.9.9-alpha.0.2 155 9/7/2021
0.9.8 643 9/1/2021
0.9.8-alpha.0.3 142 9/1/2021
0.9.8-alpha.0.2 136 9/1/2021
0.9.8-alpha.0.1 149 9/1/2021
0.9.7 648 8/16/2021
0.9.7-alpha.0.2 147 8/16/2021
0.9.7-alpha.0.1 157 8/16/2021
0.9.6 381 8/16/2021
0.9.6-alpha.0.5 158 8/16/2021
0.9.6-alpha.0.4 161 8/16/2021
0.9.5 424 7/29/2021
0.9.5-alpha.0.1 173 7/27/2021
0.9.4 649 7/20/2021
0.9.4-alpha.0.2 163 7/20/2021
0.9.4-alpha.0.1 165 7/20/2021
0.9.3 487 7/18/2021
0.9.3-alpha.0.8 179 7/18/2021
0.9.3-alpha.0.4 244 5/29/2021
0.9.3-alpha.0.2 206 5/20/2021
0.9.3-alpha.0.1 280 5/15/2021
0.9.2 4,388 4/21/2021
0.9.2-alpha.0.11 170 4/19/2021
0.9.2-alpha.0.9 171 4/19/2021
0.9.2-alpha.0.8 172 4/19/2021
0.9.2-alpha.0.6 148 4/18/2021
0.9.2-alpha.0.4 15,072 4/15/2021
0.9.2-alpha.0.3 159 4/15/2021
0.9.2-alpha.0.2 163 4/15/2021
0.9.2-alpha.0.1 147 4/15/2021
0.9.1 363 4/13/2021
0.9.1-alpha.0.20 142 4/13/2021
0.9.1-alpha.0.19 145 4/12/2021
0.9.1-alpha.0.18 153 4/12/2021
0.9.1-alpha.0.17 145 4/11/2021
0.9.1-alpha.0.16 146 4/11/2021
0.9.1-alpha.0.15 144 4/11/2021
0.9.1-alpha.0.13 183 4/8/2021
0.9.1-alpha.0.12 203 4/2/2021
0.9.1-alpha.0.9 168 4/2/2021
0.9.1-alpha.0.5 185 3/31/2021
0.9.1-alpha.0.4 207 3/30/2021
0.9.0 379 3/29/2021