Tuesday, October 6, 2015
150K customers and up on a single UNIX node
Each session whether you allow SocketIO or REST in long polling consumes a file descriptor. UNIXes are configured with a limited number of file descriptors per user. This default configuration limits the number of open sessions for your customer's applications preventing a flexible scalability.To overcome this issue, UNIXes may be configured to allow a scalability that goes over 150K clients. For a given user and its group (rights allocated for your server), the best approach consists in increasing only this user and group limits.
First, we start by checking the current limitations with the following command:
ulimit -aThe line
-n
describes the maximum number of opened file descriptor. Usually, this value is set to 1024.To increase this really low value for a user 'server' and its associated group, edit your file
/etc/security/limits.conf
with root privileges and add or modify the following values:server soft nofile 150000
server hard nofile 200000
Now, you must add a new security policy by adding the following line to your file
/etc/pam.d/common-session
, editing it with root privileges:session required pam_limits.soFor taking this new value into account, a reboot of your server is necessary. Use the
ulimit
command to check if your new value has been properly set. Note on NodeJS
The current status of NodeJS limits the heap memory to 1.4 GB per processus. Therefore, vertical scalability is limited to 250 K connections depending on your server's consumptions. There is 2 methods to overcome this issue:
- Modify the V8 code source used for NodeJS and compile your own custom application server.
- Scale horizontally your server (use multiple processus or multiple UNIX nodes) and make them communicate using ZeroMQ, for instance.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment