为部署的 Azure 机器学习工作室(经典)Web 服务创建终结点Create endpoints for deployed Azure Machine Learning Studio (classic) web services

适用于: yes机器学习工作室(经典) noAzure 机器学习APPLIES TO: yesMachine Learning Studio (classic) noAzure Machine Learning

备注

本主题介绍适用于经典机器学习 Web 服务的技术。This topic describes techniques applicable to a Classic Machine Learning web service.

部署 Web 服务之后,将为该服务创建默认终结点。After a web service is deployed, a default endpoint is created for that service. 该默认终结点可以使用其 API 密钥调用。The default endpoint can be called by using its API key. 可以从 Web 服务门户添加更多具有自身密钥的终结点。You can add more endpoints with their own keys from the Web Services portal. Web 服务中的每个终结点都是独立处理、限制和托管的。Each endpoint in the web service is independently addressed, throttled, and managed. 每个终结点唯一 URL 和身份验证密钥,可以将其分发给客户。Each endpoint is a unique URL with an authorization key that you can distribute to your customers.

将终结点添加到 Web 服务Add endpoints to a web service

可以使用 Azure 机器学习 Web 服务门户将终结点添加到 Web 服务。You can add an endpoint to a web service using the Azure Machine Learning Web Services portal. 创建终结点后,可以通过同步 API、Batch API 和 Excel 工作表来使用它。Once the endpoint is created, you can consume it through synchronous APIs, batch APIs, and excel worksheets.

备注

如果 Web 服务已添加其他终结点,则无法删除默认终结点。If you have added additional endpoints to the web service, you cannot delete the default endpoint.

  1. 在机器学习工作室(经典)的左侧导航栏中,单击“Web 服务”。In Machine Learning Studio (classic), on the left navigation column, click Web Services.
  2. 在“Web 服务”仪表板的底部,单击“管理终结点”。At the bottom of the web service dashboard, click Manage endpoints. Azure 机器学习 Web 服务门户可打开 Web 服务的终结点页。The Azure Machine Learning Web Services portal opens to the endpoints page for the web service.
  3. 单击 “新建”Click New.
  4. 键入新终结点的名称及说明。Type a name and description for the new endpoint. 终结点名称的长度必须少于或等于 24 个字符,并且必须由小写字母或数字组成。Endpoint names must be 24 character or less in length, and must be made up of lower-case alphabets or numbers. 选择日志记录级别以及是否启用示例数据。Select the logging level and whether sample data is enabled. 有关日志记录的详细信息,请参阅为机器学习 Web 服务启用日志记录For more information on logging, see Enable logging for Machine Learning web services.

通过添加其他终结点来扩展 Web 服务Scale a web service by adding additional endpoints

默认情况下,每个已发布的 Web 服务配置为支持 20 个并发请求,并且最高可达 200 个并发请求。By default, each published web service is configured to support 20 concurrent requests and can be as high as 200 concurrent requests. Azure 机器学习工作室(经典)自动优化设置以为 Web 服务提供最佳性能,并忽略门户值。Azure Machine Learning Studio (classic) automatically optimizes the setting to provide the best performance for your web service and the portal value is ignored.

如果计划调用带有高于并发调用值 200 所支持的负载的 API,应在同一个 Web 服务上创建多个终结点。If you plan to call the API with a higher load than a Max Concurrent Calls value of 200 will support, you should create multiple endpoints on the same web service. 然后可在所有终结点上随机分发负载。You can then randomly distribute your load across all of them.

Web 服务的扩展是常见任务。The scaling of a web service is a common task. 扩展的一些原因是为了支持超过 200 个并发请求、通过多个终结点增加可用性或为 Web 服务提供单独的终结点。Some reasons to scale are to support more than 200 concurrent requests, increase availability through multiple endpoints, or provide separate endpoints for the web service. 通过 Azure 机器学习 Web 服务门户为同一个 Web 服务添加其他终结点,可增加规模。You can increase the scale by adding additional endpoints for the same web service through the Azure Machine Learning Web Service portal.

请记住,如果不使用相应的高速率调用 API,使用高并发数可能有害。Keep in mind that using a high concurrency count can be detrimental if you're not calling the API with a correspondingly high rate. 如果在针对高负载配置的 API 上放置相对较低的负载,则可能看到偶发的超时和/或延迟峰值。You might see sporadic timeouts and/or spikes in the latency if you put a relatively low load on an API configured for high load.

同步 API 通常在需要低延迟的情况下使用。The synchronous APIs are typically used in situations where a low latency is desired. 此处的延迟表示 API 完成一个请求所需的时间,不考虑任何网络延迟。Latency here implies the time it takes for the API to complete one request, and doesn't account for any network delays. 假设有一个带有 50 毫秒延迟的 API。Let's say you have an API with a 50-ms latency. 若要使用限制级别高和最大并发调用 = 20 完全消耗可用容量,每秒需要调用此 API 20 * 1000 / 50 = 400 次。To fully consume the available capacity with throttle level High and Max Concurrent Calls = 20, you need to call this API 20 * 1000 / 50 = 400 times per second. 进一步扩展,假设 50 毫秒的延迟,最大并行调用 200 允许每秒调用 API 4000 次。Extending this further, a Max Concurrent Calls of 200 allows you to call the API 4000 times per second, assuming a 50-ms latency.

后续步骤Next steps

如何使用 Azure 机器学习 Web 服务How to consume an Azure Machine Learning web service.