25.4.8 Example Consumer 配置

setupconsumers table 中的 consumer 设置形成从较高级别到较低级别的层次结构。以下讨论描述了消费者如何工作,显示特定配置及其效果,因为 consumer 设置从高到低逐步启用。显示的 consumer 值具有代表性。此处描述的一般原则适用于可能可用的其他消费者值。

configuration 描述发生在增加功能和开销的序列中。如果您不需要通过启用 lower-level 设置提供的信息,请禁用它们,Performance Schema 将代表您执行 less code,您将获得更少的信息来筛选。

setupconsumers table 包含以下值的层次结构:

global_instrumentation
 thread_instrumentation
   events_waits_current
     events_waits_history
     events_waits_history_long
   events_stages_current
     events_stages_history
     events_stages_history_long
   events_statements_current
     events_statements_history
     events_statements_history_long
   events_transactions_current
     events_transactions_history
     events_transactions_history_long
 statements_digest

注意
在 consumer 层次结构中,等待,阶段,语句和 transactions 的使用者都处于相同的 level。这与 event 嵌套层次结构不同,wait events 嵌套在 stage events 中,它嵌套在_sevents events 中的语句 events 中。
如果给定的 consumer 设置为NO,则 Performance Schema 将禁用与 consumer 关联的检测并忽略所有 lower-level 设置。如果给定的设置为YES,则 Performance Schema 将启用与其关联的检测,并检查下一个最低 level 的设置。有关每个 consumer 的规则的说明,请参阅第 25.4.7 节,“Pre-Filtering by Consumer”

例如,如果启用global_instrumentation,则选中thread_instrumentation。如果启用了thread_instrumentation,则会检查events_xxx_current使用者。如果启用了这些events_waits_current,则检查events_waits_historyevents_waits_history_long

以下每个 configuration 描述都指示 Performance Schema 检查哪些设置元素以及它维护哪些输出表(即,它收集信息的表)。

没有仪器

服务器 configuration state:

mysql> SELECT * FROM performance_schema.setup_consumers;
+---------------------------+---------+
| NAME                      | ENABLED |
+---------------------------+---------+
| global_instrumentation    | NO      |
...
+---------------------------+---------+

在此 configuration 中,没有任何内容可供使用。

检查设置元素:

保存输出表:

  • 没有

仅限全球仪器

服务器 configuration state:

mysql> SELECT * FROM performance_schema.setup_consumers;
+---------------------------+---------+
| NAME                      | ENABLED |
+---------------------------+---------+
| global_instrumentation    | YES     |
| thread_instrumentation    | NO      |
...
+---------------------------+---------+

在此 configuration 中,仅为 global 状态维护检测。 Per-thread 检测已禁用。

相对于前面的 configuration,检查了其他设置元素:

  • Table setupconsumers, consumer thread_instrumentation

  • 表格 1_

  • 表格 1_

  • 表格 1_

相对于前面的 configuration 维护了额外的输出表:

仅限全局和线程检测

服务器 configuration state:

mysql> SELECT * FROM performance_schema.setup_consumers;
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | NO      |
...
| events_stages_current            | NO      |
...
| events_statements_current        | NO      |
...
| events_transactions_current      | NO      |
...
+----------------------------------+---------+

在此 configuration 中,将按全局和每个线程维护检测。 current-events 或 event-history 表中不会收集单个 events。

相对于前面的 configuration,检查了其他设置元素:

  • Table setupconsumers,消费者events_xxx_current,其中xxxwaitsstagesstatementstransactions

  • 表格 1_

  • 专栏threads.instrumented

相对于前面的 configuration 维护了额外的输出表:

  • events_xxx_summary_by_yyy_by_event_name,其中xxxwaitsstagesstatementstransactions;和yyythreaduserhostaccount

Global,Thread 和 Current-Event Instrumentation

服务器 configuration state:

mysql> SELECT * FROM performance_schema.setup_consumers;
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | YES     |
| events_waits_history             | NO      |
| events_waits_history_long        | NO      |
| events_stages_current            | YES     |
| events_stages_history            | NO      |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | NO      |
| events_statements_history_long   | NO      |
| events_transactions_current      | YES     |
| events_transactions_history      | NO      |
| events_transactions_history_long | NO      |
...
+----------------------------------+---------+

在此 configuration 中,将按全局和每个线程维护检测。单个 events 收集在 current-events table 中,但不收集在 event-history 表中。

相对于前面的 configuration,检查了其他设置元素:

  • 消费者events_xxx_history,其中xxxwaitsstagesstatementstransactions

  • 消费者events_xxx_history_long,其中xxxwaitsstagesstatementstransactions

相对于前面的 configuration 维护了额外的输出表:

  • events_xxx_current,其中xxxwaitsstagesstatementstransactions

Global,Thread,Current-Event 和 Event-History instrumentation

前面的 configuration 不会收集 event 历史记录,因为events_xxx_historyevents_xxx_history_long使用者被禁用。这些消费者可以单独或一起启用,以收集每个线程,全局或两者的 event 历史记录。

此 configuration 收集每个线程的 event 历史记录,但不是全局的:

mysql> SELECT * FROM performance_schema.setup_consumers;
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | YES     |
| events_waits_history             | YES     |
| events_waits_history_long        | NO      |
| events_stages_current            | YES     |
| events_stages_history            | YES     |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | NO      |
| events_transactions_current      | YES     |
| events_transactions_history      | YES     |
| events_transactions_history_long | NO      |
...
+----------------------------------+---------+

为此 configuration 维护了 Event-history 个表:

  • events_xxx_history,其中xxxwaitsstagesstatementstransactions

此 configuration 全局收集 event 历史记录,但不是每个线程:

mysql> SELECT * FROM performance_schema.setup_consumers;
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | YES     |
| events_waits_history             | NO      |
| events_waits_history_long        | YES     |
| events_stages_current            | YES     |
| events_stages_history            | NO      |
| events_stages_history_long       | YES     |
| events_statements_current        | YES     |
| events_statements_history        | NO      |
| events_statements_history_long   | YES     |
| events_transactions_current      | YES     |
| events_transactions_history      | NO      |
| events_transactions_history_long | YES     |
...
+----------------------------------+---------+

为此 configuration 维护了 Event-history 个表:

  • events_xxx_history_long,其中xxxwaitsstagesstatementstransactions

此 configuration 每个线程和全局收集 event 历史记录:

mysql> SELECT * FROM performance_schema.setup_consumers;
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| events_waits_current             | YES     |
| events_waits_history             | YES     |
| events_waits_history_long        | YES     |
| events_stages_current            | YES     |
| events_stages_history            | YES     |
| events_stages_history_long       | YES     |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | YES     |
| events_transactions_current      | YES     |
| events_transactions_history      | YES     |
| events_transactions_history_long | YES     |
...
+----------------------------------+---------+

为此 configuration 维护了 Event-history 个表:

  • events_xxx_history,其中xxxwaitsstagesstatementstransactions

  • events_xxx_history_long,其中xxxwaitsstagesstatementstransactions

Updated at: 7 months ago
Pre-Filtering by ConsumerTable of content命名仪器或消费者进行过滤操作