-
Notifications
You must be signed in to change notification settings - Fork 466
Remove thread count limitation on workers #7671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,5 +53,10 @@ public static class RpcWorkerConstants | |
public const string DotNetExecutableName = "dotnet"; | ||
public const string DotNetExecutableNameWithExtension = DotNetExecutableName + ".exe"; | ||
public const string DotNetFolderName = "dotnet"; | ||
|
||
// Language worker concurrency limits | ||
public const string PythonThreadpoolThreadCount = "PYTHON_THREADPOOL_THREAD_COUNT"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add the link to the external documentation of both these settings - to give future context on where these things came from. |
||
public const string PSWorkerInProcConcurrencyUpperBound = "PSWorkerInProcConcurrencyUpperBound"; | ||
public const string DefaultConcurrencyLimit = "1000"; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using Microsoft.Azure.WebJobs.Script; | ||
using Microsoft.Azure.WebJobs.Script.Workers; | ||
using Microsoft.Azure.WebJobs.Script.Workers.Http; | ||
using Microsoft.Azure.WebJobs.Script.Workers.Rpc; | ||
|
@@ -115,5 +117,25 @@ public IDictionary<string, string> GetTestEnvVars() | |
{ | ||
return new Dictionary<string, string>() { { "rpckey1", "rpcvalue1" }, { "rpckey2", "rpcvalue2" } }; | ||
} | ||
|
||
[Theory] | ||
[InlineData(RpcWorkerConstants.PythonLanguageWorkerName, RpcWorkerConstants.PythonThreadpoolThreadCount, "1", "1")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need any special test for values more than 1000? |
||
[InlineData(RpcWorkerConstants.PythonLanguageWorkerName, RpcWorkerConstants.PythonThreadpoolThreadCount, null, RpcWorkerConstants.DefaultConcurrencyLimit)] | ||
[InlineData(RpcWorkerConstants.PowerShellLanguageWorkerName, RpcWorkerConstants.PSWorkerInProcConcurrencyUpperBound, "1", "1")] | ||
[InlineData(RpcWorkerConstants.PowerShellLanguageWorkerName, RpcWorkerConstants.PSWorkerInProcConcurrencyUpperBound, null, RpcWorkerConstants.DefaultConcurrencyLimit)] | ||
[InlineData(RpcWorkerConstants.NodeLanguageWorkerName, "test", null, null)] | ||
public void DefaultWorkerProcessFactory_ApplyWorkerConcurrencyLimits_WorksAsExpected(string runtime, string name, string value, string expectedValue) | ||
{ | ||
DefaultWorkerProcessFactory defaultWorkerProcessFactory = new DefaultWorkerProcessFactory(_loggerFactory); | ||
|
||
Process process = defaultWorkerProcessFactory.CreateWorkerProcess(TestWorkerContexts.ToList()[1][0] as WorkerContext); | ||
process.StartInfo.EnvironmentVariables[RpcWorkerConstants.FunctionWorkerRuntimeSettingName] = runtime; | ||
if (!string.IsNullOrEmpty(value)) | ||
{ | ||
process.StartInfo.EnvironmentVariables[name] = value; | ||
} | ||
defaultWorkerProcessFactory.ApplyWorkerConcurrencyLimits(process.StartInfo); | ||
Assert.Equal(process.StartInfo.EnvironmentVariables.GetValue(name), expectedValue); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can these be exposed in worker.config.json instead of AppSettings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, these settings are user-configurable per app. They are not new, they already exist and the language workers expect them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DefaultConcurrencyLimit could be a part of worker.config, but adding them doesn't add any value as they can be overwritten by the Cx.