-1

My website is always receiving 522 Connection timeout. I upgraded my vps to dedicated server but it still the same.

So i found this solution online: PHP-FPM tuning. What will happen if i increase it to the very maximum?

This is my configuration: PHP-FPM Pool Options Max Requests 1000000000000000 Process Idle Timeout 1000000000000000 Max Children 1000000000000000

Cyberlicious
  • 49
  • 1
  • 5
  • Please study this page first: https://www.php.net/manual/en/install.fpm.configuration.php How do you want to spawn 1000000000000000 child processes if your server can't handle even less? Letting a child process run for 1000000000000000 requests will make your response very very slow after 1000000 requests ;-) – Daniel W. Sep 02 '20 at 13:08
  • So if i spawn 1000000000000000 processes my server will be laggy? Btw, i just want to know what will happen if i set that number. My current configuration of child processes is 10000, The default is 5. The difference is high right? – Cyberlicious Sep 02 '20 at 13:14
  • 1
    OP should seek help, he needs to figure out why he's actually getting the 522's (and it probably isn't server resources), and this question belongs on... either superuser.com -or- serverfault.com (i'm not sure which), not stackoverflow, this isn't a programming question – hanshenrik Sep 02 '20 at 19:53
  • @hanshenrik full ack, the default values are good to go in 99% of all cases and not part of the problem. With a bit of improvement, this question could fit on any of the platforms, fair enough. – Daniel W. Sep 02 '20 at 20:03

1 Answers1

1

Limitations

The maximum value for those fields are integer values.

The number of processes is limited by the kernel, to roughly 25.000 to 50.000

What happens when you set ridiculous high values?

Depending on other amouont of traffic, you might be happy with the server for hours, weeks, or months. After a time, the server will probably get unresponsive. The exact behaviour highly depends on many factors and might be totally unpredictable.

What should you do?

There are basic direction towards what the settings should go, like spawning around cores*2 (think hyperthreading) processes and so on.

The suggested values are just an orientation, not an advice that fits all needs.

The settings highly depend on your code. How much memory does it use, how much cpu time, how much memory leaking, ...

522 Connection timeout

Various issues can lead to a connection timeoout. Your PHP application might

  • experience fatal errors (seg faults)
  • might have run into infinite loops
  • might itself be waiting on locks or responses
  • bad configured network / firewall.

Try to use a debugger on your code and watch the error log closely.

Daniel W.
  • 31,164
  • 13
  • 93
  • 151
  • So what would be the correct settings of php-fpm? I am getting 7 million traffic per month. The specs of my dedicated server are: Memory: 32GB Storage: 2×450GB SSD NVMe Public bandwidth: 500 Mbps 4 cores, 8 threads – Cyberlicious Sep 03 '20 at 03:19