Skip to content

Instantly share code, notes, and snippets.

@k4mrul
Created June 9, 2023 11:04
Show Gist options
  • Save k4mrul/20a86d9d0b2e11b434211e2c8f7498be to your computer and use it in GitHub Desktop.
Save k4mrul/20a86d9d0b2e11b434211e2c8f7498be to your computer and use it in GitHub Desktop.
PHP-FPM Benchmark
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotatiodns & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"description": "A dashboard for metric using for php fpm benchmarking",
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": 10757,
"graphTooltip": 1,
"id": 65,
"links": [],
"liveNow": false,
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 4,
"interval": "",
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": false,
"show": false,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "9.2.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{
"alias": "# of pod terminations",
"yaxis": 2
}
],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"dsType": "influxdb",
"expr": "avg((sum(phpfpm_active_processes{job=\"php-benchmark-php\"}) by (kubernetes_pod_name) *100) / sum(phpfpm_total_processes{job=\"php-benchmark-php\"}) by (kubernetes_pod_name))",
"format": "time_series",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"intervalFactor": 2,
"legendFormat": "Process utilisation",
"metric": "",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"step": 2,
"tags": []
}
],
"thresholds": [],
"timeRegions": [],
"title": "Total process utilisation",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"show": true,
"values": [
"total"
]
},
"yaxes": [
{
"format": "percent",
"label": "Process utilisation",
"logBase": 1,
"max": "100",
"min": "0",
"show": true
},
{
"format": "short",
"label": "Pod termination",
"logBase": 1,
"min": "0",
"show": true
}
],
"yaxis": {
"align": false
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"fill": 0,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 0
},
"hiddenSeries": false,
"id": 12,
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"hideEmpty": false,
"hideZero": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"sort": "current",
"sortDesc": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "9.2.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "",
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"expr": "avg(phpfpm_process_request_duration{job=\"php-benchmark-php\"}) ",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "{{ pid_hash }}",
"rawSql": "SELECT\n UNIX_TIMESTAMP(<time_column>) as time_sec,\n <value column> as value,\n <series name column> as metric\nFROM <table name>\nWHERE $__timeFilter(time_column)\nORDER BY <time_column> ASC\n",
"refId": "A",
"step": 2
}
],
"thresholds": [],
"timeRegions": [],
"title": "Request Duration by process",
"tooltip": {
"shared": false,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"show": true,
"values": []
},
"yaxes": [
{
"format": "µs",
"logBase": 1,
"show": true
},
{
"format": "short",
"logBase": 1,
"show": true
}
],
"yaxis": {
"align": false
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 7
},
"hiddenSeries": false,
"id": 8,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": true,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "9.2.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"dsType": "influxdb",
"expr": "sum(phpfpm_listen_queue{job=\"php-benchmark-php\"})",
"format": "time_series",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"intervalFactor": 2,
"legendFormat": "# of requests",
"metric": "",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"step": 2,
"tags": []
}
],
"thresholds": [],
"timeRegions": [],
"title": "Queued requests",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"show": true,
"values": []
},
"yaxes": [
{
"format": "none",
"logBase": 1,
"min": "0",
"show": true
},
{
"format": "short",
"logBase": 1,
"show": false
}
],
"yaxis": {
"align": false
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 7,
"w": 12,
"x": 12,
"y": 7
},
"hiddenSeries": false,
"id": 10,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": true,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "9.2.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"dsType": "influxdb",
"expr": "sum(phpfpm_active_processes{job=\"php-benchmark-php\"})",
"format": "time_series",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"intervalFactor": 1,
"legendFormat": "# of active processes",
"metric": "phpfpm_active_processes",
"orderByTime": "ASC",
"policy": "default",
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
}
]
],
"step": 1,
"tags": []
},
{
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"expr": "sum(phpfpm_idle_processes{job=\"php-benchmark-php\"})",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "# of idle processes",
"metric": "phpfpm_idle_processes",
"refId": "B",
"step": 1
},
{
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"expr": "sum(phpfpm_total_processes{job=\"php-benchmark-php\"})",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "# of total processes",
"metric": "phpfpm_total_processes",
"refId": "C",
"step": 1
}
],
"thresholds": [],
"timeRegions": [],
"title": "# of Active & Idle processes",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"logBase": 1,
"show": true
},
{
"format": "short",
"logBase": 1,
"show": true
}
],
"yaxis": {
"align": false
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"editable": true,
"error": false,
"fill": 1,
"fillGradient": 0,
"grid": {},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 14
},
"hiddenSeries": false,
"id": 2,
"legend": {
"alignAsTable": false,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": false,
"show": true,
"sort": "avg",
"sortDesc": true,
"total": true,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "9.2.1",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"expr": "sum(irate(container_cpu_usage_seconds_total{pod=~\"php-fpm-benchmark-php.*\",container=\"php\"}[30s])) by (namespace,container)",
"format": "time_series",
"hide": false,
"interval": "",
"intervalFactor": 1,
"legendFormat": "actual",
"metric": "",
"refId": "A",
"step": 1
},
{
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"expr": "sum(container_spec_cpu_quota{pod=~\"php-fpm-benchmark-php.*\",container=\"php\"}\n/ \ncontainer_spec_cpu_period{pod=~\"php-fpm-benchmark-php.*\",container=\"php\"}) by (namespace,container)",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "limit",
"refId": "B",
"step": 1
},
{
"datasource": {
"type": "prometheus",
"uid": "P4169E866C3094E38"
},
"expr": "sum(container_spec_cpu_shares{pod=~\"php-fpm-benchmark-php.*\",container_name=\"php\"} / 1024) by (namespace,container_name) ",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "request",
"refId": "C",
"step": 1
}
],
"thresholds": [],
"timeRegions": [],
"title": "Cpu usage (total)",
"tooltip": {
"msResolution": true,
"shared": false,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"mode": "time",
"show": true,
"values": []
},
"yaxes": [
{
"format": "none",
"label": "cores",
"logBase": 1,
"min": 0,
"show": true
},
{
"format": "short",
"logBase": 1,
"show": true
}
],
"yaxis": {
"align": false
}
}
],
"refresh": false,
"schemaVersion": 37,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "PHP-FPM Benchmark",
"uid": "IRW98wdWk",
"version": 7,
"weekStart": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment