cazala / coin-hive-stratum

use CoinHive's JavaScript miner on any stratum pool
http://npmjs.com/package/coin-hive-stratum
416 stars 465 forks source link

Connections failure #135

Open vsystech opened 6 years ago

vsystech commented 6 years ago

Dear Cazala,

I'm use 100 connection limit, but yesterday 1900 visitor, 19 connection, ok. today 1000 visitor and 19 connection. the connection not closed. only if i'm restart the server but visitors go back 500 - 450~ no hashrate drop.

cdn1 | 1082 | 19 cdn2 | 1095 | 19 cdn3 | 1095 | 19 cdn4 | 1057 | 19 cdn5 | 1050 | 20 cdn6 | 0 | 0

Look my stat.

vsystech commented 6 years ago

Today:

cdn0 | 212 | 4 cdn1 | 780 | 19 cdn2 | 857 | 19 cdn3 | 809 | 18 cdn4 | 811 | 19 cdn5 | 682 | 10 cdn6 | 520 | 8

againt the connection numbers is higher then users connection. and i have other problem yesterday all servers write ~ 1400-1500~ connection and no more users. what is the problem ? why can't connect more than 2-3-4k users / server

vsystech commented 6 years ago

All hashrate: 15.41 KH/s, now restart all server, now:

cdn1 | 495 | 5 cdn2 | 311 | 4 cdn3 | 346 | 4 cdn4 | 294 | 4 cdn5 | 204 | 3 cdn6 | 158 | 2

and the hashrate now: 15.07 KH/s - 15.46 KH/s - 15.82 KH/s and goes up slowly. but if looking the stat after restart 50% less users, i try keepalive = 30 but not changes.

Worldand commented 6 years ago

which are the specs of your server ? which pool are you using ?

vsystech commented 6 years ago

pool.supportxmr.com: 3333

model name : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz 16 gb ram, sata3 hdd debian

2 from this and 1 one 2 gb vps. now: 17.09 KH/s with all 2409 users.

Worldand commented 6 years ago

You can try vphelipe method If you have many miners, use forever without logs, and run in multiple cores. Then create a crontab to restart every 6 hours.

And set maxMinersPerConnection to 50.

That way it gets more stable.

vsystech commented 6 years ago

Okay, can you explain this for me ?

What is the vphelipe, how can start without logs (currently not loging, and running on the background, how can run in multiple cores ?

coin-hive-stratum 8892 --host=pool.supportxmr.com --port=3333 --max-miners-per-connection=100 > /dev/null 2>&1 &

Worldand commented 6 years ago

Here https://github.com/cazala/coin-hive-stratum/issues/126

Yes. In path "/coin-hive-stratum/bin/" create file "cluster.js" and paste this code:

var cluster = require("cluster"); var numCPUs = require("os").cpus().length;

if (cluster.isMaster) { for (var i = 0; i < numCPUs; i++) { cluster.fork(); } cluster.on("exit", function(deadWorker, code, signal) { var worker = cluster.fork(); var newPID = worker.process.pid; var oldPID = deadWorker.process.pid; }); } else { require("./coin-hive-stratum"); }

And exec forever without logs:

forever start -a -l /dev/null -o /dev/null -r /dev/null cluster.js

Now you need install crontab on your server, and exec:

crontab -e

Now you paste this line and save:

0 /6 nvm use 6.9.2 && /usr/bin/forever restartall

vsystech commented 6 years ago

I'm try this,

root: /usr/lib/node_modules/coin-hive-stratum/bin# forever start -a -l /dev/null -o /dev/null -r /dev/null cluster.js warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms info: Forever processing file: cluster.js

starting but the server not working on 8892 port.

i'm start manualy the server with coin-hive-stratum 8892 --host=pool.supportxmr.com --port=3333 but not looking any changes.

vsystech commented 6 years ago

Dear Cazala, i found another information check tcp connections.

root@unassigned-hostname:~# netstat -an | grep :8892 | wc -l 1802 root@unassigned-hostname:~# netstat -an | grep :8792 | wc -l 1866

but :8892/stats | 1241 online :8792/stats | 1298 online

so to manny users i think not connected to server,

i'm check some time all connection, and not looking to goes up 1500-1600 on each server.

i think is really low. 2x more visitor on the sites.

vsystech commented 6 years ago

root@unassigned-hostname:~# netstat -an | grep :8892 | grep TIME_WAIT | wc -l 586

root@unassigned-hostname:~# netstat -an | grep :8892 | grep ESTABLISHED | wc -l 1317

this is my problem.

neverknoww commented 6 years ago

I am only using a vps (8GB, 2 Cores) from OVH. 4629 miners and 24 connections. Making 19K h/s. What OS are you using? Which location? Have you set the maxMinersPerConnection?

Also sometimes you need to tweak the read files setting? nlimit? Depends, but currently I am using the default setting and everything is working fine

vsystech commented 6 years ago

Dear neverknoww, use 8 core, 16 gb ram, germany, gigabit network, debian 9 max minerperconnection 100,

what is nlimit ?

neverknoww commented 6 years ago

sorry, i mean ulimit.

https://serverfault.com/questions/48717/practical-maximum-open-file-descriptors-ulimit-n-for-a-high-volume-system

vsystech commented 6 years ago

Yes setup to /etc/sysctl.conf

fs.file-max = 5000000 net.core.netdev_max_backlog = 400000 net.core.optmem_max = 10000000 net.core.rmem_default = 10000000 net.core.rmem_max = 10000000 net.core.somaxconn = 100000 net.core.wmem_default = 10000000 net.core.wmem_max = 10000000 net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1 net.ipv4.ip_local_port_range = 1024 65535 net.ipv4.tcp_ecn = 0 net.ipv4.netfilter.ip_conntrack_max = 196608 net.ipv4.tcp_max_syn_backlog = 12000 net.ipv4.tcp_max_tw_buckets = 2000000 net.ipv4.tcp_mem = 30000000 30000000 30000000 net.ipv4.tcp_rmem = 30000000 30000000 30000000 net.ipv4.tcp_sack = 1 net.ipv4.tcp_syncookies = 0 net.ipv4.tcp_timestamps = 1 net.ipv4.tcp_wmem = 30000000 30000000 30000000 net.ipv4.tcp_tw_reuse = 1

but not solve my problem.