Skip to content

Commit ff7d660

Browse files
committed
Renaming http throttle settings
1 parent 10fd505 commit ff7d660

File tree

6 files changed

+33
-31
lines changed

6 files changed

+33
-31
lines changed

sample/host.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
},
66
"http": {
77
"routePrefix": "api",
8-
"maxDegreeOfParallelism": 5,
9-
"maxQueueLength": 30
8+
"maxConcurrentRequests": 5,
9+
"maxOutstandingRequests": 30
1010
},
1111
"tracing": {
1212
"fileLoggingMode": "always"

schemas/json/host.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545
"type": "string",
4646
"default": "api"
4747
},
48-
"maxDegreeOfParallelism": {
48+
"maxConcurrentRequests": {
4949
"description": "Defines the the maximum number of http functions that will execute in parallel.",
5050
"type": "integer",
5151
"default": -1
5252
},
53-
"maxQueueLength": {
54-
"description": "Defines the maximum number of pending requests that will be queued for processing.",
53+
"maxOutstandingRequests": {
54+
"description": "Defines the maximum number of oustanding requests that will be held at any given time.",
5555
"type": "integer",
5656
"default": -1
5757
},

src/WebJobs.Script/Binding/Http/HttpConfiguration.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ public class HttpConfiguration
99
{
1010
public HttpConfiguration()
1111
{
12-
MaxQueueLength = DataflowBlockOptions.Unbounded;
13-
MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded;
12+
MaxOutstandingRequests = DataflowBlockOptions.Unbounded;
13+
MaxConcurrentRequests = DataflowBlockOptions.Unbounded;
1414
RoutePrefix = ScriptConstants.DefaultHttpRoutePrefix;
1515
}
1616

@@ -21,17 +21,19 @@ public HttpConfiguration()
2121
public string RoutePrefix { get; set; }
2222

2323
/// <summary>
24-
/// Gets or sets the maximum number of pending requests that
25-
/// will be queued for processing. If this limit is exceeded,
26-
/// new requests will be rejected with a 429 status code.
24+
/// Gets or sets the maximum number of outstanding requests that
25+
/// will be held at any given time. This limit includes requests
26+
/// that have started executing, as well as requests that have
27+
/// not yet started executing.
28+
/// If this limit is exceeded, new requests will be rejected with a 429 status code.
2729
/// </summary>
28-
public int MaxQueueLength { get; set; }
30+
public int MaxOutstandingRequests { get; set; }
2931

3032
/// <summary>
31-
/// Gets or sets the maximum number of http functions that will execute
32-
/// in parallel.
33+
/// Gets or sets the maximum number of http functions that will
34+
/// be allowed to execute in parallel.
3335
/// </summary>
34-
public int MaxDegreeOfParallelism { get; set; }
36+
public int MaxConcurrentRequests { get; set; }
3537

3638
/// <summary>
3739
/// Gets or sets a value indicating whether dynamic host counter

src/WebJobs.Script/Binding/Http/HttpRequestManager.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public HttpRequestManager(HttpConfiguration httpConfiguration, TraceWriter trace
2323
Config = httpConfiguration;
2424
TraceWriter = traceWriter;
2525

26-
if (Config.MaxQueueLength != DataflowBlockOptions.Unbounded ||
27-
Config.MaxDegreeOfParallelism != DataflowBlockOptions.Unbounded)
26+
if (Config.MaxOutstandingRequests != DataflowBlockOptions.Unbounded ||
27+
Config.MaxConcurrentRequests != DataflowBlockOptions.Unbounded)
2828
{
2929
InitializeRequestQueue();
3030
}
@@ -58,7 +58,7 @@ public async Task<HttpResponseMessage> ProcessRequestAsync(HttpRequestMessage re
5858
}
5959
else
6060
{
61-
TraceWriter.Info($"Http request queue limit of {Config.MaxQueueLength} has been exceeded.");
61+
TraceWriter.Info($"Http request queue limit of {Config.MaxOutstandingRequests} has been exceeded.");
6262
return RejectRequest(request);
6363
}
6464
}
@@ -95,8 +95,8 @@ private void InitializeRequestQueue()
9595
{
9696
var options = new ExecutionDataflowBlockOptions
9797
{
98-
MaxDegreeOfParallelism = Config.MaxDegreeOfParallelism,
99-
BoundedCapacity = Config.MaxQueueLength
98+
MaxDegreeOfParallelism = Config.MaxConcurrentRequests,
99+
BoundedCapacity = Config.MaxOutstandingRequests
100100
};
101101

102102
_requestQueue = new ActionBlock<HttpRequestItem>(async item =>

test/WebJobs.Script.Tests/Binding/HttpRequestManagerTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public async Task ProcessRequest_PropigatesExceptions()
3434
};
3535
var config = new HttpConfiguration
3636
{
37-
MaxQueueLength = 10,
38-
MaxDegreeOfParallelism = 5
37+
MaxOutstandingRequests = 10,
38+
MaxConcurrentRequests = 5
3939
};
4040
var manager = new HttpRequestManager(config, _traceWriter);
4141

@@ -83,7 +83,7 @@ public async Task ProcessRequest_MaxParallelism_RequestsAreThrottled()
8383
};
8484
var config = new HttpConfiguration
8585
{
86-
MaxDegreeOfParallelism = maxParallelism
86+
MaxConcurrentRequests = maxParallelism
8787
};
8888
var manager = new HttpRequestManager(config, _traceWriter);
8989

@@ -99,7 +99,7 @@ public async Task ProcessRequest_MaxParallelism_RequestsAreThrottled()
9999
}
100100

101101
[Fact]
102-
public async Task ProcessRequest_MaxQueueLength_RequestsAreRejected()
102+
public async Task ProcessRequest_MaxOutstandingRequestsExceeded_RequestsAreRejected()
103103
{
104104
int maxQueueLength = 10;
105105
Func<HttpRequestMessage, CancellationToken, Task<HttpResponseMessage>> process = async (req, ct) =>
@@ -109,8 +109,8 @@ public async Task ProcessRequest_MaxQueueLength_RequestsAreRejected()
109109
};
110110
var config = new HttpConfiguration
111111
{
112-
MaxQueueLength = maxQueueLength,
113-
MaxDegreeOfParallelism = 1
112+
MaxOutstandingRequests = maxQueueLength,
113+
MaxConcurrentRequests = 1
114114
};
115115
var manager = new HttpRequestManager(config, _traceWriter);
116116

test/WebJobs.Script.Tests/ScriptHostTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,20 +539,20 @@ public void ApplyConfiguration_Http()
539539

540540
Assert.Equal(ScriptConstants.DefaultHttpRoutePrefix, scriptConfig.HttpConfiguration.RoutePrefix);
541541
Assert.Equal(false, scriptConfig.HttpConfiguration.DynamicThrottlesEnabled);
542-
Assert.Equal(scriptConfig.HttpConfiguration.MaxDegreeOfParallelism, DataflowBlockOptions.Unbounded);
543-
Assert.Equal(scriptConfig.HttpConfiguration.MaxQueueLength, DataflowBlockOptions.Unbounded);
542+
Assert.Equal(scriptConfig.HttpConfiguration.MaxConcurrentRequests, DataflowBlockOptions.Unbounded);
543+
Assert.Equal(scriptConfig.HttpConfiguration.MaxOutstandingRequests, DataflowBlockOptions.Unbounded);
544544

545545
http["routePrefix"] = "myprefix";
546546
http["dynamicThrottlesEnabled"] = true;
547-
http["maxDegreeOfParallelism"] = 5;
548-
http["maxQueueLength"] = 10;
547+
http["maxConcurrentRequests"] = 5;
548+
http["maxOutstandingRequests"] = 10;
549549

550550
ScriptHost.ApplyConfiguration(config, scriptConfig);
551551

552552
Assert.Equal("myprefix", scriptConfig.HttpConfiguration.RoutePrefix);
553553
Assert.Equal(true, scriptConfig.HttpConfiguration.DynamicThrottlesEnabled);
554-
Assert.Equal(scriptConfig.HttpConfiguration.MaxDegreeOfParallelism, 5);
555-
Assert.Equal(scriptConfig.HttpConfiguration.MaxQueueLength, 10);
554+
Assert.Equal(scriptConfig.HttpConfiguration.MaxConcurrentRequests, 5);
555+
Assert.Equal(scriptConfig.HttpConfiguration.MaxOutstandingRequests, 10);
556556
}
557557

558558
// with swagger with setting name with value

0 commit comments

Comments
 (0)