-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
161 lines (145 loc) · 12.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="PHP-FPM Process Calculator for optimizing PHP pool settings and Nginx configurations">
<meta name="keywords" content="PHP, PHP-FPM, Nginx, Process Calculator, Server Optimization, RAM, Tutorials">
<meta name="author" content="Gabriel Kanev">
<title>PHP-FPM Process Calculator</title>
<link href="src/output.css" rel="stylesheet">
</head>
<body class="bg-gray-100">
<div class="container mx-auto p-6">
<div class="flex flex-wrap -mx-3">
<div class="w-full md:w-2/3 px-3">
<div class="bg-white shadow-lg rounded-lg p-8 mb-6" aria-labelledby="calculator-heading">
<h1 id="calculator-heading" class="text-3xl font-bold text-gray-800 mb-6 text-center">PHP-FPM Process Calculator</h1>
<form id="calculator-form">
<div class="mb-6">
<label for="ram-total" class="block text-lg font-medium text-gray-700 mb-2">
Total RAM (GB)
<input id="ram-total-val" type="number" min="1" max="512" step="1" value="4" aria-labelledby="ram-total-label" class="text-blue-800 ml-2 w-16 text-center border rounded-md" oninput="validateInput(this)">
</label>
<input id="ram-total" name="ram-total" type="range" min="1" max="512" step="1" value="4" aria-labelledby="ram-total-label" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
</div>
<div class="mb-6">
<label for="ram-reserved" class="block text-lg font-medium text-gray-700 mb-2">
Reserved RAM (GB)
<input id="ram-reserved-val" type="number" min="0.25" max="512" step="0.25" value="1" aria-labelledby="ram-reserved-label" class="text-blue-800 ml-2 w-16 text-center border rounded-md" oninput="validateInput(this)">
</label>
<input id="ram-reserved" name="ram-reserved" type="range" min="0.25" max="512" step="0.25" value="1" aria-labelledby="ram-reserved-label" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
</div>
<div class="mb-6">
<label for="ram-buffer" class="block text-lg font-medium text-gray-700 mb-2">
RAM Buffer (%)
<input id="ram-buffer-val" type="number" min="0" max="100" step="1" value="10" aria-labelledby="ram-buffer-label" class="text-blue-800 ml-2 w-16 text-center border rounded-md" oninput="validateInput(this)">
</label>
<input id="ram-buffer" name="ram-buffer" type="range" min="0" max="100" step="1" value="10" aria-labelledby="ram-buffer-label" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
</div>
<div class="mb-6">
<label for="process-size" class="block text-lg font-medium text-gray-700 mb-2">
Process Size (MB)
<input id="process-size-val" type="number" min="1" max="1024" step="1" value="32" aria-labelledby="process-size-label" class="text-blue-800 ml-2 w-16 text-center border rounded-md" oninput="validateInput(this)">
</label>
<input id="process-size" name="process-size" type="range" min="1" max="1024" step="1" value="32" aria-labelledby="process-size-label" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
</div>
<div class="mb-6">
<label for="ram-available" class="block text-lg font-medium text-gray-700 mb-2">Available RAM (GB)</label>
<input id="ram-available" name="ram-available" type="text" readonly aria-readonly="true"
class="w-full px-4 py-2 border border-gray-300 rounded-md bg-gray-100" aria-labelledby="ram-available-label">
</div>
<div class="mb-6">
<label for="ram-available-mb" class="block text-lg font-medium text-gray-700 mb-2">Available RAM (MB)</label>
<input id="ram-available-mb" name="ram-available-mb" type="text" readonly aria-readonly="true"
class="w-full px-4 py-2 border border-gray-300 rounded-md bg-gray-100" aria-labelledby="ram-available-mb-label">
</div>
<div class="mb-6">
<label for="max-children" class="block text-lg font-medium text-gray-700 mb-2">
<a href="https://www.php.net/manual/en/install.fpm.configuration.php#pm.max-children" class="text-blue-800" target="_blank">pm.max_children</a>
</label>
<input id="max-children" name="max-children" type="text" readonly aria-readonly="true"
class="w-full px-4 py-2 border border-gray-300 rounded-md bg-gray-100" aria-labelledby="max-children-label">
</div>
<div class="mb-6">
<label for="start-servers" class="block text-lg font-medium text-gray-700 mb-2">
<a href="https://www.php.net/manual/en/install.fpm.configuration.php#pm.start-servers" class="text-blue-800" target="_blank">pm.start_servers</a>
</label>
<input id="start-servers" name="start-servers" type="text" readonly aria-readonly="true"
class="w-full px-4 py-2 border border-gray-300 rounded-md bg-gray-100" aria-labelledby="start-servers-label">
</div>
<div class="mb-6">
<label for="min-spare" class="block text-lg font-medium text-gray-700 mb-2">
<a href="https://www.php.net/manual/en/install.fpm.configuration.php#pm.min-spare-servers" class="text-blue-800" target="_blank">pm.min_spare_servers</a>
</label>
<input id="min-spare" name="min-spare" type="text" readonly aria-readonly="true"
class="w-full px-4 py-2 border border-gray-300 rounded-md bg-gray-100" aria-labelledby="min-spare-label">
</div>
<div class="mb-6">
<label for="max-spare" class="block text-lg font-medium text-gray-700 mb-2">
<a href="https://www.php.net/manual/en/install.fpm.configuration.php#pm.max-spare-servers" class="text-blue-800" target="_blank">pm.max_spare_servers</a>
</label>
<input id="max-spare" name="max-spare" type="text" readonly aria-readonly="true"
class="w-full px-4 py-2 border border-gray-300 rounded-md bg-gray-100" aria-labelledby="max-spare-label">
</div>
<div class="mb-6">
<label for="copyPasteArea" class="block text-lg font-medium text-gray-700 mb-2">PHP Pool Settings / Tuning</label>
<textarea id="copyPasteArea" name="copyPasteArea" rows="4" aria-readonly="true"
class="w-full px-4 py-2 border border-gray-300 rounded-md bg-gray-100" aria-labelledby="copyPasteArea-label"></textarea>
<button id="buttonCopy" type="button" class="mt-4 bg-blue-500 text-white py-2 w-full rounded-md">Copy to Clipboard</button>
</div>
</form>
</div>
<div class="bg-white shadow-lg rounded-lg p-8 mt-6">
<h2 class="text-2xl font-bold text-gray-800 mb-6">FAQ: PHP-FPM Process Calculator</h2>
<h3 class="text-lg font-bold text-gray-700 mt-4">What is PHP-FPM?</h3>
<p class="text-gray-600 mb-4">PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">Why is process calculation important?</h3>
<p class="text-gray-600 mb-4">Proper process calculation ensures optimal use of server resources, improves performance, and prevents issues like memory exhaustion.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">How do I implement these settings?</h3>
<p class="text-gray-600 mb-4">These settings can be applied in your php-fpm.conf file or the pool configuration file, typically located in /etc/php/8.x/fpm/pool.d/www.conf (path may vary based on your setup).</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">What if my site's traffic fluctuates?</h3>
<p class="text-gray-600 mb-4">Consider using the dynamic pm mode, which allows PHP-FPM to adjust the number of child processes based on the current load.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">Can I use these settings for all environments?</h3>
<p class="text-gray-600 mb-4">While these calculations provide a excelent starting point, it's important to test and adjust based on your specific environment and application needs.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">What does 'pm.max_children' represent?</h3>
<p class="text-gray-600 mb-4">pm.max_children sets the maximum number of child processes that can be created to serve requests. It's crucial for controlling server resource usage.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">How do 'pm.start_servers', 'pm.min_spare_servers', and 'pm.max_spare_servers' work together?</h3>
<p class="text-gray-600 mb-4">These settings work together to manage the number of idle processes. pm.start_servers sets the number of child processes created on startup, while pm.min_spare_servers and pm.max_spare_servers define the minimum and maximum number of idle child processes.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">What is the significance of the RAM buffer?</h3>
<p class="text-gray-600 mb-4">The RAM buffer is a safety margin to prevent your server from using all available RAM. It helps ensure system stability and provides room for other OS/processes.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">How often should I review and adjust these settings?</h3>
<p class="text-gray-600 mb-4">It's recommended to review your PHP-FPM settings regularly, especially after significant changes in traffic patterns or server resources. Monthly or quarterly reviews are common practices.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">Can this calculator be used for other server configurations besides PHP-FPM?</h3>
<p class="text-gray-600 mb-4">While this calculator is specifically designed for PHP-FPM, the general principles of resource allocation can be applied to other server configurations. However, the specific settings and terminologies may differ.</p>
<h3 class="text-lg font-bold text-gray-700 mt-4">How does PHP-FPM differ from traditional PHP CGI?</h3>
<p class="text-gray-600 mb-4">PHP-FPM offers better performance and more granular control over process management compared to traditional PHP CGI. It allows for better resource utilization and can handle high-traffic situations more efficiently.</p>
</div>
</div>
<div class="w-full md:w-1/3 px-3">
<div class="bg-white shadow-lg rounded-lg p-8 mb-10">
<h2 class="text-2xl font-bold text-gray-800 mb-6 text-center">PHP Tutorials</h2>
<ul class="list-disc pl-5 mb-8">
<li><a href="https://www.php.net/manual/en/" class="text-blue-800">PHP Manual</a></li>
<li><a href="https://www.w3schools.com/php/" class="text-blue-800">PHP Tutorial on W3Schools</a></li>
<li><a href="https://www.tutorialspoint.com/php/index.htm" class="text-blue-800">PHP Tutorial on TutorialsPoint</a></li>
<li><a href="https://www.udemy.com/course/php-for-beginners/" class="text-blue-800">PHP for Beginners on Udemy</a></li>
<li><a href="https://laracasts.com/series/php-for-beginners" class="text-blue-800">PHP for Beginners on Laracasts</a></li>
</ul>
<h2 id="php-hosting" class="text-2xl font-bold text-gray-800 mb-6 mt-8 text-center">PHP Hosting Providers</h2>
<ul class="list-disc pl-5">
<li><a href="https://hetzner.cloud/?ref=ATefpTv4euEL" class="text-blue-800">Hetzner</a></li>
<!-- <li><a href="https://www.digitalocean.com" class="text-blue-800">Digitalocean</a></li>
<li><a href="https://www.inmotionhosting.com" class="text-blue-800">InMotion Hosting</a></li> -->
</ul>
</div>
<footer class="text-center text-gray-500 text-sm mt-8">
© Author <a href="https://gkanev.com" class="text-blue-800">Gabriel Kanev</a>, <script>document.write(new Date().getFullYear());</script> | <a href="https://github.com/MrGKanev/php-fpm-process-calculator" class="text-blue-800">Check out the source code</a>
</footer>
</div>
</div>
</div>
<script src="src/jquery-3.6.0.min.js"></script>
<script src="src/script.js"></script>
</body>
</html>