- 入门指南
- 要求
- 最佳实践
- 安装
- 正在更新
- 身份服务器
- 对启动错误进行故障排除
![](https://docs.uipath.com/_next/static/media/grid.05ebd128.png?w=3840&%3Bq=100)
性能最佳实践
UiPathOrchestrator.dll.config
文件进行的一系列调整,以提高大规模生产环境中的性能。
<appSettings>
<add key="LoadBalancer.UseRedis" value="true"/>
<add key="LoadBalancer.Redis.ConnectionString" value="your.redis.cache.windows.net:6379,password=***"/>
</appSettings>
<appSettings>
<add key="LoadBalancer.UseRedis" value="true"/>
<add key="LoadBalancer.Redis.ConnectionString" value="your.redis.cache.windows.net:6379,password=***"/>
</appSettings>
<connectionStrings>
<add name="Default" providerName="Microsoft.Data.SqlClient" connectionString="Data Source=<SQLServer>;Initial Catalog=<dbName>;User ID=<username>;Password=***;Max Pool Size=1000" />
</connectionStrings>
<connectionStrings>
<add name="Default" providerName="Microsoft.Data.SqlClient" connectionString="Data Source=<SQLServer>;Initial Catalog=<dbName>;User ID=<username>;Password=***;Max Pool Size=1000" />
</connectionStrings>
- 使用以下参数添加或修改 Elasticsearch 的记录目标。
xml <nlog> <targets> <target name="robotElasticBuffer" xsi:type="AsyncWrapper" overflowAction="Grow" queueLimit="10000" batchSize="1000" timeToSleepBetweenBatches="1"> <target xsi:type="ElasticSearch" name="robotElastic" uri="elastic.example.com:9200" requireAuth="true" username="***" password="***" index="${event-properties:item=indexName}-${date:format=yyyy.MM}" documentType="logEvent" includeAllProperties="true" layout="${message}" excludedProperties="agentSessionId,tenantId,indexName" /> </target> </targets> </nlog>
xml <nlog> <targets> <target name="robotElasticBuffer" xsi:type="AsyncWrapper" overflowAction="Grow" queueLimit="10000" batchSize="1000" timeToSleepBetweenBatches="1"> <target xsi:type="ElasticSearch" name="robotElastic" uri="elastic.example.com:9200" requireAuth="true" username="***" password="***" index="${event-properties:item=indexName}-${date:format=yyyy.MM}" documentType="logEvent" includeAllProperties="true" layout="${message}" excludedProperties="agentSessionId,tenantId,indexName" /> </target> </targets> </nlog> - 添加或修改机器人日志规则,以仅将日志写入到上一个示例中显示的目标。这将自动禁用默认的数据库目标。
xml <nlog> <rules> <logger name="Robot.*" ruleName="primaryRobotLogsTarget" final="true" writeTo="robotElasticBuffer" /> </rules> </nlog>
xml <nlog> <rules> <logger name="Robot.*" ruleName="primaryRobotLogsTarget" final="true" writeTo="robotElasticBuffer" /> </rules> </nlog> - 配置 Orchestrator 以从 ElasticSearch 读取日志。
<appSettings> <add key="Logs.RobotLogs.ReadTarget" value="robotElasticBuffer" /> </appSettings>
<appSettings> <add key="Logs.RobotLogs.ReadTarget" value="robotElasticBuffer" /> </appSettings>
为此,您可以选择 Azure Blob 存储。
<appSettings>
<add key="Storage.Type" value="Azure" />
<add key="Storage.Location" value="DefaultEndpointsProtocol=https;AccountName=yourBlob;AccountKey=yourKey;EndpointSuffix=core.windows.net" />
</appSettings>
<appSettings>
<add key="Storage.Type" value="Azure" />
<add key="Storage.Location" value="DefaultEndpointsProtocol=https;AccountName=yourBlob;AccountKey=yourKey;EndpointSuffix=core.windows.net" />
</appSettings>
您可以将 Orchestrator 配置为使用部分内存缓存,以减少对 Redis 的调用次数。例如,将它们配置为每 30 分钟过期一次意味着,一旦更改了应用程序级设置,它可能要等到 30 分钟间隔后才会反映出来。
您在此处设置的到期时间可能会有所不同,具体取决于您可以容忍的延迟时间,但是即使是 5 分钟的缓存时间也可以极大地提高性能。
<appSettings>
<add key="Caching.MultiTier[AbpApplicationSettingsCache]" value="Memory" />
<add key="Caching.MultiTier[AbpApplicationSettingsCache].ExpiresAfter" value="0:30:00" />
<add key="Caching.MultiTier[AbpTenantSettingsCache]" value="Memory"/>
<add key="Caching.MultiTier[AbpTenantSettingsCache].ExpiresAfter" value="0:30:00"/>
<add key="Caching.MultiTier[AbpZeroTenantFeatures]" value="Memory"/>
<add key="Caching.MultiTier[AbpZeroTenantFeatures].ExpiresAfter" value="0:30:00"/>
<add key="Caching.MultiTier[AbpZeroRolePermissions]" value="Memory"/>
<add key="Caching.MultiTier[AbpZeroRolePermissions].ExpiresAfter" value="0:30:00"/>
<add key="Caching.MultiTier[LicenseKeys]" value="Memory"/>
<add key="Caching.MultiTier[LicenseKeys].ExpiresAfter" value="0:30:00"/>
<add key="Caching.MultiTier[TenantLicense]" value="Memory"/>
<add key="Caching.MultiTier[TenantLicense].ExpiresAfter" value="0:30:00"/>
</appSettings>
<appSettings>
<add key="Caching.MultiTier[AbpApplicationSettingsCache]" value="Memory" />
<add key="Caching.MultiTier[AbpApplicationSettingsCache].ExpiresAfter" value="0:30:00" />
<add key="Caching.MultiTier[AbpTenantSettingsCache]" value="Memory"/>
<add key="Caching.MultiTier[AbpTenantSettingsCache].ExpiresAfter" value="0:30:00"/>
<add key="Caching.MultiTier[AbpZeroTenantFeatures]" value="Memory"/>
<add key="Caching.MultiTier[AbpZeroTenantFeatures].ExpiresAfter" value="0:30:00"/>
<add key="Caching.MultiTier[AbpZeroRolePermissions]" value="Memory"/>
<add key="Caching.MultiTier[AbpZeroRolePermissions].ExpiresAfter" value="0:30:00"/>
<add key="Caching.MultiTier[LicenseKeys]" value="Memory"/>
<add key="Caching.MultiTier[LicenseKeys].ExpiresAfter" value="0:30:00"/>
<add key="Caching.MultiTier[TenantLicense]" value="Memory"/>
<add key="Caching.MultiTier[TenantLicense].ExpiresAfter" value="0:30:00"/>
</appSettings>
MinWorkerThreads
设置较大的值有助于加速方案。
<appSettings>
<add key="ThreadPool.MinWorkerThreads" value="50" />
</appSettings>
<appSettings>
<add key="ThreadPool.MinWorkerThreads" value="50" />
</appSettings>
如果您不在公司网络中,或者不需要查看 Audit 中记录的 IP 的 DNS 名称,则可以禁用解析。
<appSettings>
<add key="Audit.UseDnsResolving" value="false" />
</appSettings>
<appSettings>
<add key="Audit.UseDnsResolving" value="false" />
</appSettings>
Directory.ActiveDirectory.GroupMembershipFetchStrategy
和 Directory.ActiveDirectory.AuthorizationGroupsCacheExpirationHours
仅适用于旧版 AD 适配器。仅当从启用了 AD 的 Orchestrator 版本升级到 2021.10 或更高版本时,才应使用这些设置。
[identity].[Settings]
表中的 Directory.ActiveDirectory.GroupMembershipFetchStrategy
设置为 TokenGroups
,请运行:
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.GroupMembershipFetchStrategy' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='TokenGroups' WHERE [Key]='Directory.ActiveDirectory.GroupMembershipFetchStrategy' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.GroupMembershipFetchStrategy', 'TokenGroups', 1)
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.GroupMembershipFetchStrategy' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='TokenGroups' WHERE [Key]='Directory.ActiveDirectory.GroupMembershipFetchStrategy' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.GroupMembershipFetchStrategy', 'TokenGroups', 1)
[identity].[Settings]
表中的 Directory.ActiveDirectory.AuthorizationGroupsCacheExpirationHours
设置为 4 小时,请运行:
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.AuthorizationGroupsCacheExpirationHours' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='4' WHERE [Key]='Directory.ActiveDirectory.AuthorizationGroupsCacheExpirationHours' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.AuthorizationGroupsCacheExpirationHours', '4', 1)
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.AuthorizationGroupsCacheExpirationHours' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='4' WHERE [Key]='Directory.ActiveDirectory.AuthorizationGroupsCacheExpirationHours' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.AuthorizationGroupsCacheExpirationHours', '4', 1)
Directory.ActiveDirectory.CacheExpirationSeconds
仅适用于旧版 AD 适配器。仅当从启用了 AD 的 Orchestrator 版本升级到 2021.10 或更高版本时,才应使用此设置。
[identity].[Settings]
表中的 Directory.ActiveDirectory.CacheExpirationSeconds
设置。此设置的默认值为 43200 秒(12 小时)。要禁用 AD 域缓存,您必须将此设置设置为 0。
要将此设置设置为 7 天,请运行:
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.CacheExpirationSeconds' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='604800' WHERE [Key]='Directory.ActiveDirectory.CacheExpirationSeconds' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.CacheExpirationSeconds', '604800', 1)
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.CacheExpirationSeconds' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='604800' WHERE [Key]='Directory.ActiveDirectory.CacheExpirationSeconds' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.CacheExpirationSeconds', '604800', 1)
要禁用 AD 域缓存,请运行:
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.CacheExpirationSeconds' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='0' WHERE [Key]='Directory.ActiveDirectory.CacheExpirationSeconds' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.CacheExpirationSeconds', '0', 1)
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.CacheExpirationSeconds' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='0' WHERE [Key]='Directory.ActiveDirectory.CacheExpirationSeconds' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.CacheExpirationSeconds', '0', 1)
Directory.ActiveDirectory.DomainFilter
仅适用于旧版 AD 适配器。仅当从启用了 AD 的 Orchestrator 版本升级到 2021.10 或更高版本时,才应使用此设置。
要启用域筛选器,请运行:
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.DomainFilter' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='<comma separated list of domain FQDNs>' WHERE [Key]='Directory.ActiveDirectory.DomainFilter' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.DomainFilter', '<comma separated list of domain FQDNs>', 1)
SELECT * FROM [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.DomainFilter' and [PartitionId]=1
IF @@ROWCOUNT>0
UPDATE [identity].[Settings] SET [Value]='<comma separated list of domain FQDNs>' WHERE [Key]='Directory.ActiveDirectory.DomainFilter' and [PartitionId]=1
ELSE
INSERT INTO [identity].[Settings] ([Key], [Value], [PartitionId]) VALUES ('Directory.ActiveDirectory.DomainFilter', '<comma separated list of domain FQDNs>', 1)
要禁用 AD 域缓存,请使用:
DELETE [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.DomainFilter' and [PartitionId]=1
DELETE [identity].[Settings] WHERE [Key]='Directory.ActiveDirectory.DomainFilter' and [PartitionId]=1
在激增期间,许可证获取事件将对 SignalR Redis 背板造成巨大压力。为了减轻这种情况,可以禁用该事件,这将导致许可 UI 不再实时更新。但是,当您有 10 万个机器人时,实时屏幕更新几乎没有价值。
<appSettings>
<add key="Scalability.SignalR.Browser.RobotLicenseChangeEventEnabled" value="false" />
</appSettings>
<appSettings>
<add key="Scalability.SignalR.Browser.RobotLicenseChangeEventEnabled" value="false" />
</appSettings>
此更改可确保在服务器端缓存包内容,并且在文件共享无法跟上包下载吞吐量的情况下,此更改非常有用。
<<add key="NuGet.Caching.Enabled" value="true" />
<add key="NuGet.Caching.MaxCacheSize" value="104857600" /><!-- (100 MiB) -->
<add key="NuGet.Caching.MaxPackageSize" value="4194304" /><!-- (4 MiB) -->
<add key="NuGet.Caching.AbsoluteExpirationRelativeToNow" value="00:10:00" /><!-- (1 min) -->
<<add key="NuGet.Caching.Enabled" value="true" />
<add key="NuGet.Caching.MaxCacheSize" value="104857600" /><!-- (100 MiB) -->
<add key="NuGet.Caching.MaxPackageSize" value="4194304" /><!-- (4 MiB) -->
<add key="NuGet.Caching.AbsoluteExpirationRelativeToNow" value="00:10:00" /><!-- (1 min) -->
NuGet.Caching.Enabled
设置应该足以启用该功能。如果要更改默认值,例如,增加缓存大小或包大小限制,则仅需要调整上例中显示的其余设置。
在 Orchestrator App 服务的生产插槽上将以下配置设置为粘性插槽。
WEBSITE_LOCAL_CACHE_OPTION = Always
WEBSITE_LOCAL_CACHE_SIZEINMB = 1000
WEBSITE_LOCAL_CACHE_OPTION = Always
WEBSITE_LOCAL_CACHE_SIZEINMB = 1000
在 Orchestrator App 服务的生产和热插拔部署插槽上设置以下配置。在部署过程中,这将预热应用程序,从而最大程度地减少将流量重定向到冷应用程序引起的性能下降。
WEBSITE_SWAP_WARMUP_PING_PATH = /api/status
WEBSITE_SWAP_WARMUP_PING_STATUSES = 200
WEBSITE_SWAP_WARMUP_PING_PATH = /api/status
WEBSITE_SWAP_WARMUP_PING_STATUSES = 200
在 Azure 部署中使用 Azure SignalR 服务 可以显着减少网页服务器上的负载。 有关该设置的更多详细信息,请参阅 Scalability.AzureSignalR.ConnectionString 。
<appSettings>
<add key="LoadBalancer.UseRedis" value="true"/>
<add key="Scalability.AzureSignalR.ConnectionString" value="**myAzureSignalRConnectionString" />
</appSettings>
<appSettings>
<add key="LoadBalancer.UseRedis" value="true"/>
<add key="Scalability.AzureSignalR.ConnectionString" value="**myAzureSignalRConnectionString" />
</appSettings>
UiPath.Orchestrator.dll.config
中启用以下设置,然后根据需要进行配置:
-
RobotsLogs.Flush.Interval
<add key="RobotsLogs.Flush.Interval" value="0" />
<add key="RobotsLogs.Flush.Interval" value="0" />
有关此设置的更多信息,请参阅 RobotsLogs.Flush.Interval。
-
RobotsLogs.Flush.BatchSize
<add key="RobotsLogs.Flush.BatchSize" value="100" />
<add key="RobotsLogs.Flush.BatchSize" value="100" />
有关此设置的更多信息,请参阅 RobotsLogs.Flush.BatchSize。
AppSettings.Production.json
文件进行以下更改应当会提高大规模生产环境中的性能。
"ConnectionStrings": {
"DefaultConnection": "Data Source=dbServer;Initial Catalog=UiPath_is;User ID=username;Password=****;Max Pool Size=1000"
}
"ConnectionStrings": {
"DefaultConnection": "Data Source=dbServer;Initial Catalog=UiPath_is;User ID=username;Password=****;Max Pool Size=1000"
}
- 大规模生产环境的推荐要求
- 用于提高性能的 Orchestrator 变更
- 启用 Redis
- 在连接字符串中指定较大的最大池大小
- 将机器人日志写入 Elasticsearch 并使用 AsyncWrapper
- 使用高吞吐量存储
- 增加应用程序设置的缓存时间
- 增加 MinWorkerThreads 值
- 在审核中禁用 IP 到 DNS 解析
- 切换到更快的策略以获取组成员身份
- 调整 AD 域缓存过期时间
- 提高 AD 域加载性能
- 禁用用于机器人许可证更改事件的 SignalR
- 启用 NuGet 包缓存
- 在 Azure PaaS 部署中启用本地缓存
- 在 Azure PaaS 部署中配置插槽预热
- 在 Azure PaaS 部署中使用 Azure SignalR 服务
- 调整 SubmitLogs 端点的刷新间隔和大小
- 用于提高性能的 Identity Server 变更
- 在连接字符串中指定较大的最大池大小
- 启用 Redis
- 用于提高性能的 UI 配置变更