easycryptomining / ecmgui

A web based GUI to monitor and control your Monero XMR-STAK mining rigs, Netgear Arlo wireless security camera, Belkin Wemo switch / insight and Philips Hue.
http://www.easycryptomining.com
Other
1 stars 3 forks source link

Dashboard Error 504 & 502 #4

Open MoneroCrusher opened 6 years ago

MoneroCrusher commented 6 years ago

Hi,

I have 12 RX 550 GPUs per rig. I added 10+ rigs to the dashboard and it got really slow and laggy, sometimes wouldn't load. I then increase default children to 100 and it improved the situation a little bit. I then put 27 rigs (324 GPUs) to the dashboard and then I got an erro 504. I then tried to increase children even more to 200 and did a service nginx restart & rebooted my server. I then got a straight Error 502 and I'm not able to fix it. I then tried to remove php and reinstall everything but php7-fpm broke my system and I had to do a fresh install because I didn't know what else to do.

This time I tried the same but had children all the way up to 800, I then added my workers and the exact same thing happened. tail -f var/log/nginx/error.log error is this:

[crit] 1216#1216: *21 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.x.x.x, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "192.y.y.y"

Can you tell me what to do so the php dashboard can take as many rigs as I put to it without lagging? And how do I fix the error? I'd prefer to not reinstall ubuntu again ;p

easycryptomining commented 6 years ago

Hi, First of all, thanks for your feedback on such amount of rigs/gpu. Honestly i knew that would be a problem for big farmers.

Your 504 issue is probably not link to child spawn, but to dashboard load time because of php taking to long to do the work. Have you see this in your log before increasing the childs ? : "seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning xx children, there are yy idle, and zz total children" "server reached pm.max_children setting (xx), consider raising it"

  1. Increase php execution time to 5 minutes and memory limit (depend on your machine amount of memory and what run on it, say 1024M available memory for php for the example) :

    • vi /etc/php/7.0/fpm/php.ini
    • max_execution_time = 300
    • memory_limit = 1024M
  2. Increase timeout of nginx to read php answer :

    • vi /etc/nginx/sites-available/default
    • under "fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;", add : fastcgi_read_timeout 600;
  3. Don't grow php child process without calculating ;) On my small server with this command i see i use 80Mb per child : ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | grep php-fpm 800 childs * 80Mb = 64000Mb = 64G You haven't specify your server specs that run the dashboard but i doubt you have more than 64G of ram in it...

Here a page i've found to explain : https://myshell.co.uk/blog/2012/07/adjusting-child-processes-for-php-fpm-nginx/

  1. For your 502 error and the log, i would say that php-fpm is probably not running because you try to allocate to php more ram than the machine have...

Another link : https://www.datadoghq.com/blog/nginx-502-bad-gateway-errors-php-fpm/

  1. "rebooted my server" and "php7-fpm broke my system and I had to do a fresh install" --> come on buddy it's Linux not windows, everything is repairable without a fresh install ;)