cms
cms copied to clipboard
Automatically increase resource limits
Some system resources may be limited, like the maximum number of open file descriptors. This particular limit could be easily reached by services like RWS that keep many open connections to make long-polling HTTP requests. It's possible to increase this limit up to a certain hard limit by calling ulimit -n <value> before executing RWS. Yet, RWS could change this limit itself, by making
import resource
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
resource.setrlimit(resource.RLIMIT_NOFILE, (hard, hard))
Is this code really equivalent to the ulimit call? Does it make sense to execute it at startup?
I do not think this should be handled by CMS itself. Just write a simple service file for systemd, which starts CMS with all limits set properly.