Tag Info

Hot answers tagged

9

While it can be an abuse for memory, it isn't for CPU: when a CPU is idle, a running process (by "running", I mean that the process isn't waiting for I/O or something else) will take 100% CPU time by default. And there's no reason to enforce a limit. Now, you can set up priorities thanks to nice. If you want them to apply to all processes for a given user, ...


9

iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 15 --connlimit-mask 32 -j REJECT --reject-with tcp-reset will reject connections above 15 from one source IP. sudo iptables -A INPUT -m state --state RELATED,ESTABLISHED -m limit --limit 150/second --limit-burst 160 -j ACCEPT In this 160 new connections (packets really) are ...


5

There is big difference between them. ulimit -e only set the RLIMIT_NICE, which is a upper bound value to which the process's nice value can be set using setpriority or nice. renice alters the priority of running process. Doing strace: $ cat test.sh #!/bin/bash ulimit -e 19 Then: $ strace ./test.sh ................................................... ...


5

He's saying it's bound by a 64-bit type, which has a maximum value of (2 ^ 64) - 1 unsigned, or (2 ^ 63) - 1 signed (1 bit holds the sign, +/-). The type is not FILE; it's what the implementation uses to track the offset into the file, namely off_t, which is a typedef for a signed 64-bit type.1 (2 ^ 63) - 1 = 9223372036854775807. If a terabyte is 1000 ^ ...


5

You would not necessarily see error messages in your systems log, when chromium is overstepping some limits. Try starting chromium from a terminal (rather than clicking on icon), so that you can see any potential error messages in the terminal. What you are describing seems to be similar to this bugreport. The solution should be to increase the limits ...


4

The value can only be extended up to a theoretical maximum of 32768 for 32 bit systems or 4194304 for 64 bit.


4

Did you look at cgroups? There is some information on the Arch Wiki about them. Read the section about cpu.shares, it looks like it's doing what you need, and they can operate on a user-level, so you can limit all user processes at once.


4

The settings specified in /etc/security/limits.conf are applied by pam_limits.so (man 8 pam_limits). The pam stack is only involved during the creation of a new session (login). Thus you need to log out and back in for the settings to take effect.


4

As someone who is using a btrfs filesystem with Arch Linux for almost 2 years now I can safely say that there does not seem to be a practical limit on the number of snapshots that can be easily reached. There are some caveats though. btrfs filesystem can lead to fragmentation. It is therefore advisable to use the online defragmentation feature built into ...


4

Increase hard/soft limit. /etc/security/limits.conf Thus far a limit of 8192 seems to be enough. 4096 have proven to be to small. Optionally only increase hard limit (if needed) and do: ulimit -Sn 8192 from shell in which Chrome is started. Note that the use of (the somewhat wide spread) way: sudo sh -c "ulimit -n 8192 && exec su -i ...


3

pv doesn't know about the system power states. All it sees is that the clock changed by a very large amount at some point. My guess is that pv doesn't care if the amount of time between two clock readouts suddenly gets large and just calculates the throughput based on the time interval. Since the interval is very large, it appears that the throughput is ...


3

You need to use the connlimit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). /sbin/iptables -I INPUT -p tcp --syn --dport 80 -m connlimit \ --connlimit-above 10 -j DROP


3

On Linux you can configure it via limits.conf, e.g. via # cd /etc/security # echo debian-transmission - nofile 8192 > limits.d/transmission.conf (which sets both the hard and soft limit for processes started under the user debian-transmission to 8192) You can verify the change via: # sudo -u debian-transmission bash -c "ulimit -a" [..] open files ...


3

While I don't know of a way to limit the number of processes by name, you may be able to accomplish your overall goal via pam_limits by limiting the number of user logins. An entry in /etc/security/limits such as @remotes hard maxlogins 5 will ensure that the users of the remotes group cannot have more than 5 login sessions on the ...


2

No, it is not possible to limit by process name, because the process name can be changed easily. So that limit could easily be evaded. (It can even be changed at runtime I think.)


2

All values is correct and have different meanings./proc/sys/kernel/pid_max is maximum value for PID, ulimit -u is maximum value for number of processes. From man 5 proc: /proc/sys/kernel/pid_max (since Linux 2.5.34) This file specifies the value at which PIDs wrap around (i.e., the value in this file is one greater than the ...


2

There is something kind of what you describe: there is a feature to limit the amount of RAM used by a process (RAM, as opposed to virtual memory). The RLIMIT_RSS limit sets an upper bound a program's resident set size, i.e. the part of the memory of that process which is resident in memory (as opposed to swapped out). However, it is not implemented on Linux. ...


2

You want the following rules in your iptables to answer both requirements in your question: iptables -t filter -I INPUT -p tcp --dport 80 -j ACCEPT iptables -t filter -I INPUT -p tcp --dport 80 -m state \ --state RELATED,ESTABLISHED -j ACCEPT # Adjust "--connlimit-above NN" to limit the maximum connections per IP # that you need. iptables -t filter -I ...


2

I am not sure if this answers your question, but I found this perl script that claims to do exactly what you are looking for. The script implements its own system for enforcing the limits by waking up and checking the resource usage of the process and its children. It seems to be well documented and explained, and has been updated recently. As slm said in ...


2

For memory, what you are looking for is ulimit -v. Note that ulimit is inherited by child processes, so if you apply it to the login shell of the user at the time of login, it applies to all his processes. If your users all use bash as login shell, putting the following line in /etc/profile should cause all user processes to have a hard limit of 1 gigabyte ...


2

You should probably take a look inside /etc/pam.d/sudo file and check if pam_limits.so is required in it or in any of the other files it includes. For example, the /etc/pam.d/sudo file in my system looks like below. #%PAM-1.0 auth required pam_env.so readenv=1 user_readenv=0 auth required pam_env.so readenv=1 envfile=/etc/default/locale ...


2

I am not aware of any size limits for here-doc. I'm running kernel 3.9.1 and I've been experiencing the same issue here: when pasting large chunks of text in terminal some lines are truncated or missing. I found out (after some googling) that if you turn off line editing, pasting works fine (discussion here: Pasting large amounts of text into ...


2

You need to complete some more steps to increase max open files in ubuntu. Edit /etc/pam.d/common-session and append below line session required pam_limits.so Restart your system to apply the changes. You can set limits to all users on system by adding below lines. * soft nofile 10000 * hard nofile 30000 And reboot the ...


2

scp itself has no such feature. With GNU parallel you can use the sem command (from semaphore) to arbitrarily limit concurrent processes: sem --id scp -j 50 scp ... For all processes started with the same --id, this applies a limit of 50 concurrent instances. An attempt to start a 51st process will wait (indefinitely) until one of the other processes ...


1

Thanks to @hrv for the insight. I've confirmed after a quick experiment: when the /etc/pam.d/sudo included pam_limits.so, then running sudo did set them, and when the /etc/pam.d/sudo did not include them, then running sudo didn't set them. I checked a couple of different machines and one of them did include pam_limits.so within /etc/pam.d/sudo while the ...


1

The solution you found was correct: iptables -A OUTPUT -m limit --limit 10/s -j ACCEPT But it is assuming a default policy of DROP or REJECT which is not usual for OUTPUT. You need to add: iptables -A OUTPUT -j REJECT Be sure to add this rule after the ACCEPT one. Either execute them in this order, or use -I instead of -A for the ACCEPT. Also, ...


1

There are two settings that limit the number of open files: a per-process limit, and a system-wide limit. The system-wide limit is set by the fs.file-max sysctl, which can be configured in /etc/sysctl.conf (read at boot time) or set on the fly with the sysctl command or by writing to /proc/sys/fs/file-max. The per-process limit is set by ulimit -n. The ...


1

Since you are stating that cpulimit would not be practical in your case, then I suggest you look at nice, renice, and taskset, which may come close to what you want to achieve, although taskset allows to set a processes’s CPU affinity, so it might be not immediately helpful in your case.


1

In order to make your CPU use less battery, you need it to run slower. The total amount of CPU instructions needed to execute your program do not depend on the speed at which it runs, so limiting the proportion of CPU time used by your program would make it use more CPU, not less. When your CPU is doing nothing instead of running your program, it's still ...



Only top voted, non community-wiki answers of a minimum length are eligible