Skip to content

Commit f56c9d0

Browse files
committed
feat(franken): update image file and frankenphp.md
1 parent d1518aa commit f56c9d0

File tree

4 files changed

+36
-35
lines changed

4 files changed

+36
-35
lines changed
361 KB
Loading

docs/images/franken-metrics.png

346 KB
Loading

docs/images/prometheus-franken.png

26.4 KB
Loading

frankenphp.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,26 @@ Go to - http://localhost:8080/
1818

1919
### Show target prom sources
2020

21-
Check franken is up
21+
Check franken metric is up
2222

23-
http://localhost:9090/targets?search=
23+
go to http://localhost:2020/metrics
24+
25+
Find CTRL / CMD + F `frankenphp_total_threads`
26+
27+
![img_1.png](docs/images/franken-metric-classic.png)
28+
29+
we notice that we have total threads 16 by default, this is means Franken doing monitoring for us
30+
31+
now check Prometheus go to http://localhost:9090/targets?search=
2432

2533
![img.png](docs/images/prometheus-franken.png)
2634

35+
we notice that franken:2019 is up
36+
2737
### show grafana franken/opcache dashboard
2838

39+
let's make performance testing on it
40+
2941
```bash
3042
make benchmark-product-random-franken
3143
```
@@ -56,9 +68,19 @@ Go to - http://localhost:8081/
5668

5769
### Show target prom sources
5870

59-
Check franken is up
71+
Check franken metrics is up
72+
73+
Go to http://localhost:2020/metrics
6074

61-
http://localhost:9090/targets?search=
75+
Find CTRL / CMD + F `frankenphp_total_threads`
76+
77+
![img.png](docs/images/franken-metrics.png)
78+
79+
we notice that our `frankenphp_total_threads` is 20
80+
81+
now let's check Prometheus go to http://localhost:9090/targets?search=
82+
83+
we notice that our http://franken-worker:2019 is Up
6284

6385
![img.png](docs/images/prometheus-franken.png)
6486

@@ -80,10 +102,14 @@ Check grafana output go to http://localhost:3000 or http://localhost:3000/d/9cf6
80102

81103
![img_6.png](docs/images/grafana-franken-worker-dashboard.png)
82104

105+
you can scroll down to see more graph
106+
83107
---
84108

85109
## Performance Comparison: PHP-FPM vs FrankenPHP Classic vs FrankenPHP Worker
86110

111+
So far we are testing FPM, Franken Classic and Franken worker mode and we know where Franken worker shine
112+
87113
### Performance Summary Table
88114

89115
| Metric | PHP-FPM | FrankenPHP Classic | FrankenPHP Worker | Winner |
@@ -94,8 +120,6 @@ Check grafana output go to http://localhost:3000 or http://localhost:3000/d/9cf6
94120
| **Memory Efficiency** | Medium | Good | Excellent | 🏆 Worker |
95121
| **CPU Efficiency** | Medium | Good | Excellent | 🏆 Worker |
96122

97-
\* Worker mode stability depends on application code being stateless and handling errors properly.
98-
99123
---
100124

101125
## Service Configuration
@@ -122,7 +146,7 @@ Check grafana output go to http://localhost:3000 or http://localhost:3000/d/9cf6
122146
- Auto-reloads on file changes if needed
123147
- Better suited for production workloads
124148

125-
## Auto-Reload (File Watching)
149+
### Auto-Reload (File Watching) When you are in Development Mode
126150

127151
Both FrankenPHP services can automatically reload PHP workers when your code changes, thanks to the `watch` directive in
128152
the Caddyfile:
@@ -164,18 +188,20 @@ frankenphp {
164188

165189
why ?
166190

191+
```
167192
watch → FrankenPHP auto-reloads when files change
168193
preload → Load files once; changes NOT detected
169194
revalidate_freq → How often to check files for changes
170195
validate_timestamps → Whether to check changes at all
196+
```
171197

172198
go to terminal
173199

174200
```bash
175201
make worker-shell
176202
```
177203

178-
enter
204+
run this command
179205

180206
```bash
181207
frankenphp reload --config=/etc/frankenphp/Caddyfile
@@ -203,15 +229,15 @@ frankenphp reload --config=/etc/frankenphp/Caddyfile
203229

204230
Go to http://localhost:8081/en/blog/, if you reload it will hard reload the browser
205231

206-
if you found it stuck at loading run command below in terminal
232+
if you found it stuck at loading run command below in terminal to restart container in docker
207233

208234
```bash
209235
make down-worker && make up-worker
210236
```
211237

212238
now let's open file ./src/Controller/BlogController.php
213239

214-
and uncommented
240+
and uncomment `// phpinfo();`
215241

216242
```php
217243
public function index(Request $request, int $page, string $_format, PostRepository $posts, TagRepository $tags): Response
@@ -228,28 +254,3 @@ then Go to http://localhost:8081/en/blog/ again, we notice that phpinfo page is
228254

229255
so now everytime you make changes on the php, twig files it will reflect on the browser
230256

231-
### Important Considerations
232-
233-
- **Performance Impact**: File watching uses system resources
234-
- **Production Warning**: Always disable `watch` in production for stability
235-
- **Large Projects**: Watching many files can impact performance
236-
237-
### Worker Metrics
238-
239-
When `metrics` is enabled, worker information is exposed at the metrics endpoint:
240-
241-
## View franken metrics for grafana
242-
243-
Go to - http://localhost:2020/metrics
244-
245-
```
246-
# With num 1
247-
frankenphp_total_workers{worker="/var/www/html/public/index.php"} 1
248-
249-
# With num 8
250-
frankenphp_total_workers{worker="/var/www/html/public/index.php"} 8
251-
```
252-
- Access metrics at `http://localhost:2020/metrics` (or your configured admin port)
253-
- The `frankenphp_total_workers` metric shows active workers per script
254-
- Worker path reflects the `file` directive in your configuration
255-
- Updates in real-time when workers are added/removed

0 commit comments

Comments
 (0)