because wildfly sometimes stops for unknown reasons on cntos7,
I checked the log shown that mongo connection record might be a reason,
after some searching of documentation,
this is how to make ulimits setting works as following.
step 1:
if you wish to modify the system services, go to /usr/lib/systemd/system,
find your service, for example, mongod.service
modify that file, under the [service] tag,
adding lines include:
# open files
LimitNOFILE=32000
# processes/threads
LimitNPROC=32000
step 2:
systemctl daemon-reload && systemctl restart mongod
then the change of ulimits took effect.
if you wish to modify some process other than system services, like wildfly
make a new file under /etc/security/limits.d/
named a file after that process, like 100-wildfly.conf, the number shown in front of a file indicated its group numeratically,
adding lines below:
wildfly soft nproc 32000
wildfly hard nproc 32000
wildfly soft nofile 32000
wildfly hard nofile 32000
then restart your process to take effect on that modification.
notice: you can enlarge the number over examples above, maybe for 64000, if your system has more physical memories to work with it.