mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-07-31 01:40:42 +00:00
RateControl
This commit is contained in:
@@ -78,6 +78,12 @@ internal static class Program
|
||||
static async Task<MyService> StartServer(Warehouse warehouse, ushort port)
|
||||
{
|
||||
warehouse.RegisterAuthenticationProvider(new ServerAuthenticationProvider());
|
||||
warehouse.Configuration.Parser.MaximumPacketSize = 8 * 1024 * 1024;
|
||||
warehouse.Configuration.Parser.MaximumAllocationSize = 4 * 1024 * 1024;
|
||||
warehouse.Configuration.Parser.MaximumCollectionItems = 65_536;
|
||||
warehouse.Configuration.ResourceAttachments.MaximumAttachedResourcesPerConnection = 4_096;
|
||||
warehouse.Configuration.ResourceAttachments.MaximumPendingAttachmentsPerConnection = 128;
|
||||
warehouse.Configuration.Connections.MaximumConnectionsPerIpAddress = 64;
|
||||
warehouse.Configuration.RateControl.DenialsBeforeConnectionBlock = 10;
|
||||
warehouse.AddRatePolicy(new BurstRatePolicy("standard-call")
|
||||
{
|
||||
@@ -139,6 +145,8 @@ internal static class Program
|
||||
static async Task<EpConnection> ConnectClient(Warehouse warehouse, ushort port)
|
||||
{
|
||||
warehouse.RegisterAuthenticationProvider(new ClientAuthenticationProvider());
|
||||
warehouse.Configuration.ResourceAttachments.MaximumAttachedResourcesPerConnection = 4_096;
|
||||
warehouse.Configuration.ResourceAttachments.MaximumPendingAttachmentsPerConnection = 128;
|
||||
|
||||
return await warehouse.Get<EpConnection>($"ep://localhost:{port}", new EpConnectionContext
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ Coverage includes:
|
||||
- pull streams backed by `IAsyncEnumerable<T>`;
|
||||
- `TerminateExecution` through async-enumerator disposal;
|
||||
- `HaltExecution` and `ResumeExecution` for a cooperative push stream.
|
||||
- parser allocation and collection budgets, attachment quotas, and per-IP connection limits.
|
||||
|
||||
Run it from the repository root:
|
||||
|
||||
@@ -41,3 +42,17 @@ public void Call()
|
||||
{
|
||||
}
|
||||
```
|
||||
|
||||
Security limits are configured per Warehouse. A value of zero disables an individual limit:
|
||||
|
||||
```csharp
|
||||
warehouse.Configuration.Parser.MaximumPacketSize = 8 * 1024 * 1024;
|
||||
warehouse.Configuration.Parser.MaximumAllocationSize = 4 * 1024 * 1024;
|
||||
warehouse.Configuration.Parser.MaximumCollectionItems = 65_536;
|
||||
|
||||
warehouse.Configuration.ResourceAttachments.MaximumAttachedResourcesPerConnection = 4_096;
|
||||
warehouse.Configuration.ResourceAttachments.MaximumPendingAttachmentsPerConnection = 128;
|
||||
warehouse.Configuration.ResourceAttachments.RejectDuplicateAttachments = true;
|
||||
|
||||
warehouse.Configuration.Connections.MaximumConnectionsPerIpAddress = 64;
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user