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)