Increase File Descriptors (Sockets)
📈 How to Increase File Descriptors (Sockets) Limit
To ensure your bot can handle a high number of file descriptors (e.g., 100,000 sockets), follow this guide. It covers both temporary (session-specific) and permanent (system-wide) changes.
🔧 Temporary Limit Adjustment (Session-Specific)
Note: This change only applies to the current terminal session and will reset after a reboot.
✅ Steps:
Stop the bot Ensure your bot is not running.
Delete the current screen session
Set the new file descriptor limit
Replace
100000
with your desired limit.Start a new screen session
Run the bot
💡 Notes:
A limit of
100000
file descriptors typically requires ~1 GB RAM.ulimit -n
affects only the current terminal session.Skipping any step may prevent the limit from applying correctly.
🛠️ Permanent Limit Adjustment (System-Wide)
Use this method to make the limit persistent across reboots.
✅ Steps:
Edit
/etc/security/limits.conf
Add the following lines (adjust the number as needed):Edit PAM configuration files Add the following line to both:
/etc/pam.d/common-session
/etc/pam.d/common-session-noninteractive
Apply changes
Restart your session or reboot the server
Verify with:
✅ Summary
Temporary
❌
ulimit -n
❌
Permanent
✅
config files
✅
By increasing the file descriptor limit, your bot will be better equipped to handle high concurrency, improving stability and performance.
Last updated