DEV Community

Cover image for 17.Process Limit Adjustment
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

17.Process Limit Adjustment

Lab Information

In the Stratos Datacenter, our Storage server is encountering performance degradation due to excessive processes held by the nfsuser user. To mitigate this issue, we need to enforce limitations on its maximum processes. Please set the maximum process limits as specified below:

a. Set the soft limit to 1025

b. Set the hard limit to 2025

Lab Solutions

🧭 Part 1: Lab Step-by-Step Guidelines

πŸ”Ή Step 1: Log in to Jump Host
ssh thor@jump_host.stratos.xfusioncorp.com

Password:

mjolnir123

πŸ”Ή Step 2: SSH into Storage Server

ssh natasha@ststor01.stratos.xfusioncorp.com

Password:

Bl@kW

πŸ”Ή Step 3: Switch to root

sudo -i
Enter fullscreen mode Exit fullscreen mode

βš™ Configure Process Limits

Process limits are controlled via:

/etc/security/limits.conf

πŸ”Ή Step 4: Edit limits configuration

Open the file:

vi /etc/security/limits.conf
Enter fullscreen mode Exit fullscreen mode

Add the following lines at the end:

nfsuser soft nproc 1025
nfsuser hard nproc 2025
Enter fullscreen mode Exit fullscreen mode

Save and exit.

πŸ”Ή Step 5: Verify entries

grep nfsuser /etc/security/limits.conf
Enter fullscreen mode Exit fullscreen mode

Expected output:

nfsuser soft nproc 1025
nfsuser hard nproc 2025

βœ… Final Checklist

βœ” Modified /etc/security/limits.conf
βœ” Soft limit set to 1025
βœ” Hard limit set to 2025
βœ” Applied to user nfsuser only
βœ” Completed on Storage Server only


🧠 Part 2: Simple Step-by-Step Explanation (Beginner Friendly)

πŸ”Ή What is the issue?

User nfsuser is running too many processes, which impacts performance.

We must limit how many processes that user can create.

πŸ”Ή What is nproc?

nproc = number of processes.

We are limiting:

Soft limit β†’ warning threshold (1025)

Hard limit β†’ absolute maximum (2025)

πŸ”Ή What is the difference between soft and hard limits?

Limit Type Meaning
Soft Default limit applied
Hard Maximum possible limit

The soft limit can be increased up to the hard limit.

πŸ”Ή Why modify /etc/security/limits.conf?

This file controls user resource limits via PAM.

It applies limits when the user logs in.

πŸ” Real-World Context

Process limits prevent:

Fork bombs

Resource exhaustion

Service instability

Accidental runaway scripts

This is common in production storage and application servers.


Resources & Next Steps
πŸ“¦ Full Code Repository: KodeKloud Learning Labs
πŸ“– More Deep Dives: Whispering Cloud Insights - Read other technical articles
πŸ’¬ Join Discussion: DEV Community - Share your thoughts and questions
πŸ’Ό Let's Connect: LinkedIn - I'd love to connect with you

Credits
β€’ All labs are from: KodeKloud
β€’ I sincerely appreciate your provision of these valuable resources.

Top comments (0)