-
KpunTo
howdy folks, i've git cloned and build xmrrig miner on linux, is there some simple way for me to cap how much CPU it uses on the box?
-
moneromooo
I assume you checked --help. If there's nothing, then namespaces I guess.
-
cohcho
`u=$(whoami); limit_pct=50; cg=xmrig_cpu; sudo cgcreate -t $u:$u -a $u:$u -g cpu:$cg; echo $(( $limit_pct / 100 * 100000 )) | sudo tee /sys/fs/cgroup/cpu/$cg/cpu.cfs_quota_us; cgexec --sticky -g cpu:$cg xmrig --algo rx/0 --url=stratum+tcp://donate.v2.xmrig.com:3333 -u '0000000000000000000000000000000000000000000000000000000000000000' --no-color`
-
cohcho
change limit_pct to whatever you want, and install libcgroup
-
KpunTo
thanks cohcho
-
cohcho
use --threads in case if you're ok with discrete values of limit
-
KpunTo
randomx is the default CPU algo at the moment?
-
cohcho
There is no such thing as default algo I suppose
-
cohcho
I don't know
-
hyc
comparator should yield strict ordering, since lookups use binary search
-
hyc
and can fail if not strictly ordered
-
jtgrassie
hyc, my tests seemed to work with the less strict comparator. I just needed a way to do an append of exact duplicates and with the comparator returning -1 or 1 (not 0) the append works.
-
jtgrassie
I can't see any other way to have duplicate KV items (MDB_DUPSORT needed for dup keys, MDB_APPEND needs sorted keys and MDB_APPENDDUP needs sorted data). Return 0 in a comparator and MDB_KEYEXIST occurs.
-
jtgrassie
The 1/-1 comperator only occurs for data (mdb_set_dupsort), I'm still using strict comperators for keys.
-
vtnerd
jtgrassie : I would expect the -1 / 1 (not 0) comparator to fail on lookup though
-
vtnerd
although searching with MDB_SET_RANGE should still work
-
jtgrassie
vtnerd: you mean lookup based on data value right? because i'm not doing that. it' all itterating based on key (which has strict comp).
-
jtgrassie
e.g. MDB_SET and MDB_NEXT_DUP
-
hyc
ah if you're only iterating with NEXT_DUP then binary search is irrelevant, so you should be safe
-
jtgrassie
cool, thanks for confirming
-
jtgrassie
so yes, all calls are either MDB_SET->MDB_NEXT_DUP or MDB_FIRST->MDB_NEXT when itterating
-
jtgrassie
then there are either appends (using MDB_APPENDDUP)
-
jtgrassie
of overwriting current (MDB_CURRENT)
-
jtgrassie
When I have a change that necessitates a db migrate, I'll revert the data comparators and migrate the data items to be unique.
-
cohcho
jtgrassie: src/webui.c:start_web_ui() uses MHD_USE_SELECT_INTERNALLY, why not EPOLL?
-
jtgrassie
It's what's recommended in the docs when using a single thread.
-
cohcho
Api requests doesn't work as soon as many clients connected or many connect/disconnect occured.
-
cohcho
I've changed to MHD_USE_EPOLL_INTERNAL_THREAD in order to have working api.
-
jtgrassie
I recommend using a proxy (ala apache/nginx) for the api. That's what I use on the reference pool.
-
jtgrassie
That then is set to cache responses.
-
cohcho
I need realtime stats from monero-pool, don't see any need cache something here.
-
jtgrassie
I'm talking about like 15 seconds cache, not a huge timeout.
-
cohcho
Have you tested monero-pool with > 256 clients?
-
cohcho
Api connection will just get fd > FD_SETSIZE and nothing will be able to use api.
-
cohcho
caching will not help, unless it's using persistent socket
-
jtgrassie
api or pool?
-
jtgrassie
pool yes, over 10k tested
-
jtgrassie
api uses apache front-end with cache
paste.debian.net/1124412
-
jtgrassie
I do think using epoll probably makes sense, I assume the docs just suggest MHD_USE_SELECT_INTERNALLY for portability.
-
jtgrassie
either way, really should cache and proxy web api
-
jtgrassie
and thats not the job of the pool.
-
cohcho
Answer simple question: Is it possible that new connection to webui port will have socket fd always > FD_SETSIZE if number of active clients is > FD_SETSIZE + some_margin?
-
cohcho
I don't probability of this event but it occurred here few times in a row.
-
cohcho
don't know*
-
cohcho
persistent connection to webui port established at the beginning works without any problem; then this issue probably doesn't matter outside of my environment
-
jtgrassie
as I say, you really gotta use a proxy and cache for the webui. It's the most efficient way to allow pool to have lots of connections and the webui to not affect pool performance.
-
jtgrassie
MHD_USE_EPOLL_LINUX_ONLY would definitely help on Linux, but not other platforms.
-
hyc
FD_SETSIZE isn't a valid constant anymore, should be using getdtblsize()
-
hyc
number of descriptors depends on nfiles ulimit anyway
-
cohcho
BUGS section of `man 2 select` says about 1024 limit for select(); getdtablesize() equals to `ulimit -n` here which is really high 999999; the error i've never had 999999 active sockets so 1024 looks like a realistic limit at least for select().
-
cohcho
s/the error//
-
jtgrassie
and the webui defers to MHD (it doesn't even look at FD_SETSIZE). and if MHD is behind a caching proxy this is all redundant talk anyway.
-
cohcho
microhttpd lib will fails somewhere inside it after each try to start select() with fd > FD_SETSIZE
-
cohcho
your code will not report anything
-
jtgrassie
the pool does look at FD_SETSIZE though, so yes, per hyc's point I sould change this at least.
-
cohcho
no need to change for libevent listener since it uses the best available poller, epoll in my case
-
cohcho
but webui is using select() since you've set it explicitely
-
jtgrassie
w.r.t. MHD, I could feature test EPOLL and only use that if available for the webui, I just never bothered because I always intended webui to be behind a cacheing proxy.
-
cohcho
It will be portable and fix my issue, good
-
jtgrassie
ok I'll make the change, but please, use a proxy cache, they are better suited for the webui needs.
-
cohcho
I need api mostly to monitor what's going on with workers
-
cohcho
It isn't exposed to others
-
cohcho
Also i've added few methods to get worker stats
-
cohcho
my environment is too dynamic to have caching timeout > 1 second
-
jtgrassie
You speak of lots of changes you are making. Can you show/share?
-
cohcho
They are ugly but works
-
cohcho
I'll after some testing