Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MySQL / MariaDB / MongoDB option #157

Open
mooleshacat opened this issue Nov 4, 2018 · 3 comments
Open

Add MySQL / MariaDB / MongoDB option #157

mooleshacat opened this issue Nov 4, 2018 · 3 comments
Labels
Bug Something isn't working Critical Priority Enhancement Enhancement or Improvement Help Wanted Looking for help! Redis Bug Redis related errors Security Issue v1.1.4 finalization Makes it for v1.1.4

Comments

@mooleshacat
Copy link
Collaborator

mooleshacat commented Nov 4, 2018

I run NOMP on a VPS which has limited memory, and has SWAP mounted to /dev/null

Either init.js or Redis is causing memory to be full.

Can we add in either MySQL / MariaDB / MongoDB option please? It is not good to only have Redis because it is a cache program, NOT a database.

Also there are problems with saving data for reboot. "redis-cli save" does not seem to work. It may be with the way the server just kills the redis process, I will look into it further and post back here.

Easiest fix is to enable more DB options.

Duplicates:
https://github.com/foxer666/node-open-mining-portal/issues/150
zone117x/node-open-mining-portal#644
#140

Thanks

@mooleshacat mooleshacat added Enhancement Enhancement or Improvement Help Wanted Looking for help! Feature Request Request for feature v1.1.4 finalization Makes it for v1.1.4 Redis Bug Redis related errors Critical Priority Bug Something isn't working labels Nov 4, 2018
@mooleshacat
Copy link
Collaborator Author

mooleshacat commented Nov 4, 2018

Enabled AOF (google redis persistance) which causes data to persist across reboots.

Turns out the RDB just starts at low memory (< 5MB) and as shares are submitted, the memory fills up -- this is a security issue, DoS can be achieved by mining enough shares to fill memory.

This is bad design from the beginning, to stuff everything into the memory which most people are limited. Memory has some limit, and thus we should not be using Redis Memory Cache in this way.

Proper database is severely needed.

@mooleshacat
Copy link
Collaborator Author

mooleshacat commented Nov 5, 2018

redis-tables

Data Sample:

{"time":1541380048,"global":{"workers":2,"hashrate":0},"algos":{"neoscrypt":{"workers":2,"hashrate":744548.4673870506,"hashrateString":"744.55 KH/s"},"x16r":{"workers":0,"hashrate":0,"hashrateString":"0 H/s"}},"pools":{"mogwaicoin":{"name":"mogwaicoin","explorerGetBlock":"http://explorer.mogwaicoin.org/block/","explorerGetBlockJSON":"http://explorer.mogwaicoin.org/api/getblock?hash=","explorerGetTX":"http://explorer.mogwaicoin.org/tx/","symbol":"MOG","algorithm":"neoscrypt","rewardRecipients":{},"poolStats":{"validShares":"1671","validBlocks":"1","invalidShares":0,"totalPaid":0,"networkBlocks":"87763","networkSols":"29564337.28829854","networkSolsString":"29.56 MH/s","networkDiff":"0.8685194020356234","networkConnections":"37","networkVersion":"/Mogwai Core:0.12.2.4/","networkProtocolVersion":"70209"},"blocks":{"pending":1,"confirmed":0,"confirmedData":[],"orphaned":0},"pending":{"blocks":[],"confirms":{}},"confirmed":{"blocks":[]},"payments":[],"currentRoundShares":{"MAKrZXqxfmuzscgsZMknSjMK3Fx2xfhEZc.BOX0":"26569.97493844999999091","MAKrZXqxfmuzscgsZMknSjMK3Fx2xfhEZc.BOX1":"337.42414621000000005"},"workers":{"MAKrZXqxfmuzscgsZMknSjMK3Fx2xfhEZc.BOX1":{"shares":34.211876649999994,"diff":32432,"invalidshares":0,"currRoundShares":337.42414621,"currRoundTime":0,"hashrateString":"14.95 KH/s","luckDays":"824121.677","luckHours":"19778920.245","hashrate":14947.396987562664},"MAKrZXqxfmuzscgsZMknSjMK3Fx2xfhEZc.BOX0":{"shares":1669.92432495,"diff":1954289,"invalidshares":0,"currRoundShares":26569.97493845,"currRoundTime":0,"hashrateString":"729.60 KH/s","luckDays":"16883.848","luckHours":"405212.362","hashrate":729601.070399488}},"hashrate":744548.4673870506,"luckDays":"16544.892","luckHours":"397077.404","workerCount":2,"hashrateString":"744.55 KH/s"},"ravencoin":{"name":"ravencoin","explorerGetBlock":"http://rvnhodl.com/block/","blockTime":60,"explorerGetBlockJSON":"http://rvnhodl.com/api/getrawtransaction?decrypt=1&txid=","explorerGetTX":"http://rvnhodl.com/tx/","symbol":"RVN","algorithm":"x16r","rewardRecipients":{},"poolStats":{"validShares":0,"validBlocks":0,"invalidShares":0,"totalPaid":0,"networkBlocks":"434686","networkSols":"8123667518403.457","networkSolsString":"8.12 TH/s","networkDiff":"104746.0371192352","networkConnections":"8","networkVersion":"/Ravencoin:2.1.0/","networkProtocolVersion":"70016"},"blocks":{"pending":0,"confirmed":0,"confirmedData":[],"orphaned":0},"pending":{"blocks":[],"confirms":{}},"confirmed":{"blocks":[]},"payments":[],"currentRoundShares":{},"workers":{},"hashrate":0,"luckDays":"Infinity","luckHours":"Infinity","workerCount":0,"hashrateString":"0 H/s"}}}

Judging by the amount of, and structure of the table and the data, NOMP should have used a proper database from the beginning. All this share data will eat up limited system memory in no time.

I am just learning NodeJS, but I will look into this for v1.1.4 if not yet completed by someone else. I have a PHP & MySQL background, this should help. Only need to learn how to access MySQL from NodeJS (Google will help)

Adding MySQL and doing a performance/efficiency audit is recommended as others have reported performance issues and this is likely to be the cause.

This is another feature which I will eventually push to NOMP/BootNOMP repos for all to use :)

@mooleshacat mooleshacat removed the Feature Request Request for feature label Nov 5, 2018
@mooleshacat
Copy link
Collaborator Author

moved to #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Critical Priority Enhancement Enhancement or Improvement Help Wanted Looking for help! Redis Bug Redis related errors Security Issue v1.1.4 finalization Makes it for v1.1.4
Projects
None yet
Development

No branches or pull requests

1 participant