加载中

Universal Profiling 入门

本页介绍如何在 Elastic Cloud 部署中配置和使用 Universal Profiling。若要设置自托管的 Elastic Stack 部署,请参考 在自托管的 Elastic Stack 上运行 Universal Profiling

本页内容包括

  • 在 Elastic Cloud 上设置 Universal Profiling 的前提条件
  • 在您的 Elastic Cloud 部署中设置 Universal Profiling
  • 安装 Universal Profiling Agent
  • 安装 Universal Profiling Agent 集成

我们非常期待您对该产品的使用体验以及您可能遇到的任何其他性能分析痛点的反馈。有关详细信息,请参阅故障排除文档中的 发送反馈 部分。

在设置 Universal Profiling 之前,请确保您满足以下要求

  • Elastic Cloud 上的 Elastic Stack 部署。若要设置自托管的 Elastic Stack 部署,请参考 在自托管的 Elastic Stack 上运行 Universal Profiling
  • 您正在分析的工作负载必须运行在配备 x86_64 或 ARM64 CPU 的 Linux 机器上。
  • x86_64 机器最低支持的内核版本为 4.19,ARM64 机器为 5.5。
  • 必须在您的 Elastic Cloud 部署中启用 Integrations Server。
  • superuser Elasticsearch 角色的凭据(用户名和密码)(通常为 elastic 用户)。

Universal Profiling 是一个系统级的性能分析解决方案,同时额外支持 PHP、Python、Java(或任何 JVM 语言)、Go、Rust、C/C++、Node.js/V8、Ruby、.Net 和 Perl。

各解释器最低支持的版本如下

  • JVM/JDK: 7
  • Python: 3.6
  • V8: 8.1.0(AMD64 系统需要 Elastic Stack 9.2.2 或更高版本;ARM64 系统需要 Elastic Stack 9.1.8 或 9.2.2 及更高版本)
  • Perl: 5.28
  • PHP: 7.3
  • Ruby: 2.5
  • .Net: 6

经过测试,以下部署配置示例支持来自多达 500 个主机(每个主机拥有 8 或 16 个 CPU 核心,总计约 6000 个核心)的性能分析数据

组件 每个可用区大小(内存) 可用区
Elasticsearch 64 GB 2
Kibana 8 GB 1
Integrations Server 8 GB 1

即使您分析的主机集群较小,我们仍建议为 Elasticsearch 配置至少两个可用区,并为 Integrations Server 和 Kibana 各配置至少 4 GB 的内存。

要在 Elastic Cloud 部署中设置 Universal Profiling,您需要先 配置数据引入

首次在部署中启用 Universal Profiling 后,请在导航菜单中选择 Universal Profiling 下的任意子标题以打开以下页面

profiling setup popup

点击 Set up Universal Profiling 以配置数据引入。

注意

要配置数据引入,您需要提升的权限,通常为 elastic 用户。

如果您是从启用了 Universal Profiling 的早期版本进行升级,请参阅 升级指南

如果您更喜欢以编程方式配置数据引入,可以使用 Kibana API 调用。该调用可以通过 Kibana 中的“Dev Tools”控制台进行,也可以通过任何独立 HTTP 客户端(例如 curlwget)进行。在这两种情况下,都必须使用 elastic 用户凭据执行 API 调用,以确保具备必要的权限。

成功的 API 调用将返回带有空正文的 202 Accepted 响应。

要从控制台配置数据引入,请转到导航菜单中的 Dev Tools 并运行以下命令

				POST kbn:/api/profiling/setup/es_resources
					{}
		

要使用独立的 HTTP 客户端(例如 curl)以编程方式配置数据引入,请运行以下命令

				
					curl -u elastic:<PASSWORD> -H "kbn-xsrf: true" -H "Content-Type: application/json" \
    --data "{}" "https://<kibana-host>:<kibana-port>/api/profiling/setup/es_resources"
		

安装 Universal Profiling Agent 时,您有以下选项

  1. 使用 Elastic Agent 安装 Universal Profiling Agent
  2. 以独立模式安装 Universal Profiling Agent

要使用 Elastic Agent 和 Universal Profiling Agent 集成安装 Universal Profiling Agent,请完成以下步骤

  1. 从 Elastic Agent 集成中复制 secret tokenUniversal Profiling Collector url

    profiling elastic agent
  2. 点击 Manage Universal Profiling Agent in Fleet 以完成集成。

  3. 在集成页面上,点击 Add Universal Profiling Agent

  4. Universal Profiling Agent → Settings 中,添加您从 Add profiling data 页面复制的信息

    1. 将 Universal Profiling 收集器 URL 添加到 Universal Profiling collector endpoint 字段中。

    2. 将密钥令牌添加到 Authorization 字段中。

      profililing elastic agent creds
  5. 点击 Save and continue

要使用 Kubernetes 部署集成有 Universal Profiling Agent 的 Elastic Agent,请确保在清单中设置了以下选项。

				
					hostPID: true
securityContext:
  readOnlyRootFilesystem: true
  privileged: true
  runAsUser: 0
  runAsGroup: 0
  capabilities:
    add:
      - SYS_ADMIN
		

Universal Profiling Agent 用于分析您的主机集群。您需要在要分析的每台机器上安装并配置它。Universal Profiling Agent 需要 root / CAP_SYS_ADMIN 权限才能运行。

在上一步中点击 Set up Universal Profiling 后,您将看到安装 Universal Profiling Agent 的说明。您也可以通过点击页面右上角的 Add data 按钮来找到这些说明。

以下是为 Kubernetes 提供的说明示例

profiling k8s hostagent

在配置 Universal Profiling Agent 时,请考虑以下事项

  • Kibana 中的说明适用于测试环境。对于生产环境,我们建议设置不可变的版本。
  • 在 Elastic Stack 8.9 版本之前,Universal Profiling Agent 的版本控制方案与 Elastic Stack 版本方案不一致
  • 您可以在 Elastic 容器库存储库中找到容器镜像版本列表。
  • 对于 Kubernetes 部署,Helm chart 版本已用于配置相同的容器镜像,除非在 Helm values 文件中使用 version 参数对其进行了覆盖。
  • 对于 Elastic Stack 8.8 版本,请使用 v3 主机代理。对于 8.7 版本,请使用 v2v3 主机代理与 8.7 版本的 Elastic Stack 不兼容。
  • 不支持或不建议将 Universal Profiling Agent 作为 sidecar 部署。
© . This website operates independently and is not affiliated with or endorsed by Elasticsearch B.V. All brand names, logos, and trademarks are the property of their respective owners.