Skip to content

Instantly share code, notes, and snippets.

@olivertappin
olivertappin / show-blocking-transactions.sql
Created November 16, 2019 19:06
Run this query to check for a blocking transaction
SELECT
trx_w.trx_id AS waiting_trx_id,
trx_w.trx_mysql_thread_id AS waiting_process_id,
TIMESTAMPDIFF(SECOND, trx_w.trx_wait_started, CURRENT_TIMESTAMP) AS wait_time,
trx_w.trx_query AS waiting_query,
l.lock_table AS waiting_table_lock,
trx_b.trx_id AS blocking_trx_id,
trx_b.trx_mysql_thread_id AS blocking_process_id,
CONCAT(pl.user, '@', pl.host) AS blocking_user,
pl.command,
@holmberd
holmberd / php-pools.md
Last active May 17, 2024 07:21
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@ysasaki
ysasaki / cloudwatch-php-fpm-status.sh
Last active August 24, 2023 11:30
php-fpm status to AWS CloudWatch
#!/bin/bash
AWS_DEFAULT_REGION="ap-northeast-1"
AWS_ACCESS_KEY_ID="YOUR ACCESS KEY HERE"
AWS_SECRET_ACCESS_KEY="YOUR SECRET ACCESS KEY HERE"
INSTANCE_ID_URL="http://169.254.169.254/latest/meta-data/instance-id"
INSTANCE_ID=$(curl -s ${INSTANCE_ID_URL})
SERVER_STATUS_URL="http://localhost/php-fpm-status"