Editing Resource shortage
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | Sometimes you see strange failures from some programs inside your [[container]]. In some cases it means one of the resources controlled by OpenVZ | + | Sometimes you see a strange failures from some programs inside your [[container]]. In some cases it means one of the resources controlled by OpenVZ hit the limit. |
− | The first thing to do is to check the contents of | + | The first thing to do is to check the contents of /proc/user_beancounters file in your [[container]]. The last column of output is fail counter. Each time a resource hits the limit, the fail counter is increasing. So, if you see non-zero values in failcnt column that means something is wrong. |
There are two ways to fix the situation: reconfigure (in some cases recompile) the application, or change the resource management settings. | There are two ways to fix the situation: reconfigure (in some cases recompile) the application, or change the resource management settings. | ||
Line 7: | Line 7: | ||
== [[UBC]] parameters == | == [[UBC]] parameters == | ||
− | Here is | + | Here is the example of current [[UBC]] values obtained from <code>/proc/user_beancounters</code> file in container 123: |
<pre> | <pre> | ||
# cat /proc/user_beancounters | # cat /proc/user_beancounters | ||
Line 38: | Line 38: | ||
</pre> | </pre> | ||
− | You can see if you hit the | + | You can see if you hit the limits for some [[UBC]] parameters by analyzing the last column (named <code>failcnt</code>). It shows a number of fails for this counter, i.e. a number of times a parameter hit the limit. Usually what you need to do is to increase the parameter in question. But you need to do it carefully, and here is how. |
<ol> | <ol> | ||
− | <li>Get the current values for the parameter's barrier and limit. For example, we want to increase kmemsize values. From <code>/proc/user_beancounters</code> we see that <code>kmemsize</code> barrier is 2752512, and its limit is 2936012. | + | <li>Get the current values for the parameter's barrier and limit. For example, we want to increase kmemsize values from the example at . From <code>/proc/user_beancounters</code> we see that <code>kmemsize</code> barrier is 2752512, and its limit is 2936012. |
</li> | </li> | ||
− | <li>Increase the values. Say, we want to | + | <li>Increase the values. Say, we want to increase <code>kmemsize</code> by 2 times. This is how it can be done using built-in bash arithmetics: |
<pre> | <pre> | ||
# vzctl set 123 --kmemsize $((2752512*2)):$((2936012*2)) --save | # vzctl set 123 --kmemsize $((2752512*2)):$((2936012*2)) --save | ||
</pre> | </pre> | ||
− | By using | + | By using <code>--save</code> flag, we denote we want to both apply the new settings to the running container, and save them in the configuration file (from which they will be taken during next container start). |
</li> | </li> | ||
Line 62: | Line 62: | ||
== Disk quota == | == Disk quota == | ||
− | To check if your [[container]] | + | To check if your [[container]] ran out of its disk quota, use the following commands (inside a container): |
<pre> | <pre> | ||
# df | # df | ||
Line 72: | Line 72: | ||
</pre> | </pre> | ||
− | + | First command shows disk space usage, and second command shows the inodes usage (you can roughly see inodes as a number of files/directories on your system). | |
− | If one of the commands | + | If one of the commands give you usage of 100%, that means you hit one of the disk quota limit. |
− | You can increase the limit from the host system ([[CT0 | + | You can increase the limit from the host system ([[CT0]]) only. This is how: |
<ol> | <ol> | ||
<li>Get the current values for disk quota: | <li>Get the current values for disk quota: | ||
Line 90: | Line 90: | ||
vzctl set 123 --diskspace $(( 1048576*2 )):$(( 1153434*2 )) --save | vzctl set 123 --diskspace $(( 1048576*2 )):$(( 1153434*2 )) --save | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</li> | </li> | ||
Line 111: | Line 99: | ||
</ol> | </ol> | ||
− | + | {{Note|shell does not support floating-point arithmetics, i.e. you can not use expressions like <code>$(( 220000*1.5 ))</code>. To use floating point, try <code>bc</code> instead, something like this: <code><nowiki>$(echo 220000*1.5 | bc)</nowiki></code>.}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {{Note|shell does not support floating-point | ||
== CPU == | == CPU == | ||
− | There are two parameters controlling fair CPU scheduler in OpenVZ: cpuunits and cpulimit | + | There are two parameters controlling fair CPU scheduler in OpenVZ: cpuunits and cpulimit. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | {{Stub}} | |
[[Category: Troubleshooting]] | [[Category: Troubleshooting]] |