pjoshi Posted July 13, 2009 Share Posted July 13, 2009 Hi, We have a server and several thin clients attached to this in our Office. The OS is RedHat Linux. Whenever n number of applications/programs are opened on each thin client the performance of the server degrades. Is there any way to restrict the number of programs that can be opened by each client or any other way that I can increase the performance of the server. Pls help Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/ Share on other sites More sharing options...
trq Posted July 13, 2009 Share Posted July 13, 2009 Plenty of ways to do it but it would entirely depend on your setup. One simple method would simply be to create a lockfile when an application starts and not to let another copy of said application start while the lockfile exists. Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-874413 Share on other sites More sharing options...
pjoshi Posted July 15, 2009 Author Share Posted July 15, 2009 Thanks thorpe for the suggestion. But it would be great if you could tell me how to create a lockfile as I'm very new to such concepts. Lets take an example of creating a lockfile for restricting one instance of the following applications. 1) Open Office 3.0 2) Acrobat Reader 5.0 3) Mozilla Firefox Please help Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-875576 Share on other sites More sharing options...
pjoshi Posted July 25, 2009 Author Share Posted July 25, 2009 Hi All, Any help on this would be greatly appreciated as this is one of the burming issue for me. Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-882500 Share on other sites More sharing options...
steviewdr Posted July 25, 2009 Share Posted July 25, 2009 See http://www.cyberciti.biz/tips/linux-limiting-user-process.html -steve Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-882728 Share on other sites More sharing options...
pjoshi Posted July 28, 2009 Author Share Posted July 28, 2009 Hi Steve, I went through the How To posted on http://www.cyberciti.biz/tips/linux-limiting-user-process.html as suggested by you. As mentioned in the post I configured my /etc/security/limits.conf file. There are around 70+ users connected on the server and there were around 2700+ processes opened. I added the line pjoshi hard nproc 5 to the limits.conf file (pjoshi is one of the username connected to the server). Thinking that it would allow pjoshi to open maximum 5 processes. I saved and closed the file and then executed the command : (){ :|:& };: on the prompt. But, to my surprise this resulted in big havoc. All the users were processes were stopped and were disconnected from the server. And even as a administrator I was unable to connect to the server until I restarted it. I want to know what went wrong? Why other users processes got affected when I had added the line to restrict only the processes of the user – pjoshi. Also please guide me how can I achieve this? Please feel free to ask any more questions in case of doubts to solve my problem. Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-884617 Share on other sites More sharing options...
pjoshi Posted August 4, 2009 Author Share Posted August 4, 2009 Hi Steve, Any help on this would be greatly appreciated as this is one of the burming issue for me. Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-890329 Share on other sites More sharing options...
steviewdr Posted August 5, 2009 Share Posted August 5, 2009 Why did you run a fork bomb? Of course that killed your server, albeit it shouldn't have if you done the config on the previous page correct. Try creating a few processes for the pjoshi user yourself and see how it goes. I suggest you read every bit of that page. Here is one of the comments you might want to look at: ####### @Robert Delahunt: While I am on Ubuntu 9.04, your suggestion was the only one that worked. For me setting hard and soft limits for users in /etc/security/limits/conf had no effect. I had to place ulimit -u NUM in /etc/profile for it to stick. Thanks! ########## I suggest you contact the author of that blog post to ask them about their config. -steve Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-891283 Share on other sites More sharing options...
pjoshi Posted August 6, 2009 Author Share Posted August 6, 2009 Steve, I have gone through the page throughly and have also tried putting ulimit -u NUM in /etc/profile but nothing is working for me. Let me explain this in detail. On the server I modified the file /etc/security/limits/conf by inserting a line backup hard nproc 100 and also inserted the line ulimit -u 100 in /etc/profile file. After modifying the files I restarted the server. Then I logged in as backup and was able to open more than 100 processes. I don't know what's going wrong. pls help ..... Thanks, Prasad Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-891998 Share on other sites More sharing options...
steviewdr Posted August 9, 2009 Share Posted August 9, 2009 Well it works perfectly for me on Centos5. I done this: 1. As root: vi /etc/security/limits.conf #add the following line, where steve is the user: steve hard nproc 3 #save and close the text editor. 2. su - steve steve@volcano:~$ ps -eaf | grep steve | more -bash: fork: Resource temporarily unavailable Try replicating this. ############## On debian / ubuntu, I done: 1. As root: vi /etc/security/limits.conf #add the following line, where steve is the user: sburke hard nproc 5 #save and close the text editor. 2. ssh sburke@localhost ps -eaf | grep sburke | ls /var/tmp | less -bash: fork: Resource temporarily unavailable I did not have anything else to do. I did not have to reboot the server. I did not have to edit any other files. In the case of debian, su - sburke was insufficient. I had to ssh sburke@server, and then the limits kicked in. -steve Quote Link to comment https://forums.phpfreaks.com/topic/165760-restricting-the-number-of-programs/#findComment-894193 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.