diff --git a/ansible/macrobench.yml b/ansible/macrobench.yml index 3cf54797..fde8de4e 100644 --- a/ansible/macrobench.yml +++ b/ansible/macrobench.yml @@ -39,10 +39,20 @@ name: sysbench tasks_from: install +- hosts: macrobench + include_role: + name: profile + tasks_from: start + - hosts: macrobench roles: - macrobench +- hosts: macrobench + include_role: + name: profile + tasks_from: stop + - name: Clean Post Macrobench when: arewefastyet_next_exec_is_same is undefined import_playbook: clean_macrobench.yml diff --git a/ansible/roles/profile/tasks/start.yml b/ansible/roles/profile/tasks/start.yml new file mode 100644 index 00000000..d4fbfcd3 --- /dev/null +++ b/ansible/roles/profile/tasks/start.yml @@ -0,0 +1,16 @@ +# Copyright 2024 The Vitess Authors. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +- name: Start profiling + shell: | + kill -s USR1 $(pgrep -d " " {{vitess_profile_binary}}) + when: vitess_profile_binary is defined \ No newline at end of file diff --git a/ansible/roles/profile/tasks/stop.yml b/ansible/roles/profile/tasks/stop.yml new file mode 100644 index 00000000..8eabe183 --- /dev/null +++ b/ansible/roles/profile/tasks/stop.yml @@ -0,0 +1,16 @@ +# Copyright 2024 The Vitess Authors. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +- name: Stop profiling + shell: | + kill -s USR1 $(pgrep -d " " {{vitess_profile_binary}}) + when: vitess_profile_binary is defined \ No newline at end of file diff --git a/ansible/roles/vtgate/templates/vtgate.conf.j2 b/ansible/roles/vtgate/templates/vtgate.conf.j2 index 5a4e49e3..709568cf 100644 --- a/ansible/roles/vtgate/templates/vtgate.conf.j2 +++ b/ansible/roles/vtgate/templates/vtgate.conf.j2 @@ -23,7 +23,7 @@ EXTRA_VTGATE_FLAGS="\ --vtgate-config-terse-errors \ --tablet_types_to_wait REPLICA \ {% if vitess_profile_binary == 'vtgate' %}\ - --pprof=\"{{vitess_profile_mode}},path=/pprof/{{arewefastyet_exec_uuid}}/vtgate-{{ gateway.id }}\" \ + --pprof=\"{{vitess_profile_mode}},waitSig,path=/pprof/{{arewefastyet_exec_uuid}}/vtgate-{{ gateway.id }}\" \ {% endif %}\ {{gateway.extra_flags|default("")}} \ {{extra_vtgate_flags|default("")}} \ diff --git a/ansible/roles/vttablet/templates/vttablet.conf.j2 b/ansible/roles/vttablet/templates/vttablet.conf.j2 index 8e9d0253..592866ea 100644 --- a/ansible/roles/vttablet/templates/vttablet.conf.j2 +++ b/ansible/roles/vttablet/templates/vttablet.conf.j2 @@ -45,7 +45,7 @@ EXTRA_VTTABLET_FLAGS="--alsologtostderr \ --grpc_max_message_size=67108864 \ --db_charset=utf8 \ {% if vitess_profile_binary == 'vttablet' %}\ - --pprof=\"{{vitess_profile_mode}},path=/pprof/{{arewefastyet_exec_uuid}}/vttablet-{{ tablet.id }}\" \ + --pprof=\"{{vitess_profile_mode}},waitSig,path=/pprof/{{arewefastyet_exec_uuid}}/vttablet-{{ tablet.id }}\" \ {% endif %}\ {{ tablet.extra_flags | default("") }} \ {{ extra_vttablet_flags | default("") }} \