aionnetwork / aion_pool2

aion pool implementation with c# core.
13 stars 15 forks source link

Db prune & pageSize api restrictions #19

Open equ1miner opened 5 years ago

equ1miner commented 5 years ago

Due to the high number of blocks a database pruning function and request limitations on pagesize values appears to be a good idea to prevent incremental api request floods on the master and maintain a healthier db size for all pools.

equ1miner commented 5 years ago

I'd like to point out if 200k aion blocks were mined on a pool the database can get requests of large pageSizes

Aion has 60x the number of blocks a day produced compared to traditional 10min blockchains and pools are likely to build databases much more quickly than other chains and are subject to master load exploints.

Pruning and api pagesize limits would reduce the cost of the of hosting the master and create improved stability and faster performance for all pool owners during incremental api request floods!

An example solution would be to limit the possible calls on pagesizes. I am sorry I don't have time to review the source code at this time!

For example only allow ?pageSize=10000 or ?pagesize=100 Caching the responses by nginx, cloudflaire results in minincore only receiving one forwarded request until the the cache expiry time is reached.

Requests of incremental pageSizes such as 99999 then 100000 flood as each request isn't cached thus can load the DB server up even as the DB grows with a rate limit of 5 requests/second.

dipeshnuco commented 5 years ago

@easy-mine-crypto thanks for putting up this issue. I have added it to the backlog for the pool software and we will analyze this feature request in more detail

equ1miner commented 5 years ago

Thank you!