Running out of memory, fork can't allocate memory
We are getting out of memory frequently, as well fork cannot allocate memory. I did some investigation.
It seems that scripts are not case as I thought before this. I will share information which I get after analyzing.
I have isolated server, so other people cant reach to server. This will show "true" memory usage in this case.
- I have no mysqld and apache started [memory usage ~182mb].
- just started mysqld. no connections made to mysqld [mu ~340mb].
- httpd started [~360mb].
- first request to script. [~630mb]. But!! The most interesting part. Memory doesn't get deallocated. Everything looks OK. Script ended, page loaded successfuly. But it still around ~630mb.
Why one request eats 270MB? Why thats not deallocated after request?
Some stats:
- Server RAM 512 MB guaranteed
- 256 MB burstable
- PHP memory limit: 256MB
httpd.conf
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 50
</IfModule>
linux memory apache-http-server php
add a comment |
We are getting out of memory frequently, as well fork cannot allocate memory. I did some investigation.
It seems that scripts are not case as I thought before this. I will share information which I get after analyzing.
I have isolated server, so other people cant reach to server. This will show "true" memory usage in this case.
- I have no mysqld and apache started [memory usage ~182mb].
- just started mysqld. no connections made to mysqld [mu ~340mb].
- httpd started [~360mb].
- first request to script. [~630mb]. But!! The most interesting part. Memory doesn't get deallocated. Everything looks OK. Script ended, page loaded successfuly. But it still around ~630mb.
Why one request eats 270MB? Why thats not deallocated after request?
Some stats:
- Server RAM 512 MB guaranteed
- 256 MB burstable
- PHP memory limit: 256MB
httpd.conf
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 50
</IfModule>
linux memory apache-http-server php
1
What else is started? ~180MiB RAM after boot into headless system sounds unreasonable. Also, what does that script do? How big is the database backing it up?
– Bobby
Mar 21 '12 at 13:14
What is exactly "memory usage"? How did you measure it? Is it the one from the first line offree
?
– Cristian Ciupitu
Mar 21 '12 at 13:58
Bobby, this is "ps faux" pastebin.com/4yKGBTyj
– Toktik
Mar 21 '12 at 15:39
Cristian, yes, it is from "free" command, also from mediatemple server status, which is the same. Also "cat /proc/user_beancounters" pastebin.com/H9FZkFWj
– Toktik
Mar 21 '12 at 15:39
Looks to me like a bulk of it is going to httpd.
– JeffG
Mar 22 '12 at 1:41
add a comment |
We are getting out of memory frequently, as well fork cannot allocate memory. I did some investigation.
It seems that scripts are not case as I thought before this. I will share information which I get after analyzing.
I have isolated server, so other people cant reach to server. This will show "true" memory usage in this case.
- I have no mysqld and apache started [memory usage ~182mb].
- just started mysqld. no connections made to mysqld [mu ~340mb].
- httpd started [~360mb].
- first request to script. [~630mb]. But!! The most interesting part. Memory doesn't get deallocated. Everything looks OK. Script ended, page loaded successfuly. But it still around ~630mb.
Why one request eats 270MB? Why thats not deallocated after request?
Some stats:
- Server RAM 512 MB guaranteed
- 256 MB burstable
- PHP memory limit: 256MB
httpd.conf
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 50
</IfModule>
linux memory apache-http-server php
We are getting out of memory frequently, as well fork cannot allocate memory. I did some investigation.
It seems that scripts are not case as I thought before this. I will share information which I get after analyzing.
I have isolated server, so other people cant reach to server. This will show "true" memory usage in this case.
- I have no mysqld and apache started [memory usage ~182mb].
- just started mysqld. no connections made to mysqld [mu ~340mb].
- httpd started [~360mb].
- first request to script. [~630mb]. But!! The most interesting part. Memory doesn't get deallocated. Everything looks OK. Script ended, page loaded successfuly. But it still around ~630mb.
Why one request eats 270MB? Why thats not deallocated after request?
Some stats:
- Server RAM 512 MB guaranteed
- 256 MB burstable
- PHP memory limit: 256MB
httpd.conf
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 3
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 50
</IfModule>
linux memory apache-http-server php
linux memory apache-http-server php
edited Mar 21 '12 at 13:36
slhck
159k47441464
159k47441464
asked Mar 21 '12 at 12:26
Toktik
10914
10914
1
What else is started? ~180MiB RAM after boot into headless system sounds unreasonable. Also, what does that script do? How big is the database backing it up?
– Bobby
Mar 21 '12 at 13:14
What is exactly "memory usage"? How did you measure it? Is it the one from the first line offree
?
– Cristian Ciupitu
Mar 21 '12 at 13:58
Bobby, this is "ps faux" pastebin.com/4yKGBTyj
– Toktik
Mar 21 '12 at 15:39
Cristian, yes, it is from "free" command, also from mediatemple server status, which is the same. Also "cat /proc/user_beancounters" pastebin.com/H9FZkFWj
– Toktik
Mar 21 '12 at 15:39
Looks to me like a bulk of it is going to httpd.
– JeffG
Mar 22 '12 at 1:41
add a comment |
1
What else is started? ~180MiB RAM after boot into headless system sounds unreasonable. Also, what does that script do? How big is the database backing it up?
– Bobby
Mar 21 '12 at 13:14
What is exactly "memory usage"? How did you measure it? Is it the one from the first line offree
?
– Cristian Ciupitu
Mar 21 '12 at 13:58
Bobby, this is "ps faux" pastebin.com/4yKGBTyj
– Toktik
Mar 21 '12 at 15:39
Cristian, yes, it is from "free" command, also from mediatemple server status, which is the same. Also "cat /proc/user_beancounters" pastebin.com/H9FZkFWj
– Toktik
Mar 21 '12 at 15:39
Looks to me like a bulk of it is going to httpd.
– JeffG
Mar 22 '12 at 1:41
1
1
What else is started? ~180MiB RAM after boot into headless system sounds unreasonable. Also, what does that script do? How big is the database backing it up?
– Bobby
Mar 21 '12 at 13:14
What else is started? ~180MiB RAM after boot into headless system sounds unreasonable. Also, what does that script do? How big is the database backing it up?
– Bobby
Mar 21 '12 at 13:14
What is exactly "memory usage"? How did you measure it? Is it the one from the first line of
free
?– Cristian Ciupitu
Mar 21 '12 at 13:58
What is exactly "memory usage"? How did you measure it? Is it the one from the first line of
free
?– Cristian Ciupitu
Mar 21 '12 at 13:58
Bobby, this is "ps faux" pastebin.com/4yKGBTyj
– Toktik
Mar 21 '12 at 15:39
Bobby, this is "ps faux" pastebin.com/4yKGBTyj
– Toktik
Mar 21 '12 at 15:39
Cristian, yes, it is from "free" command, also from mediatemple server status, which is the same. Also "cat /proc/user_beancounters" pastebin.com/H9FZkFWj
– Toktik
Mar 21 '12 at 15:39
Cristian, yes, it is from "free" command, also from mediatemple server status, which is the same. Also "cat /proc/user_beancounters" pastebin.com/H9FZkFWj
– Toktik
Mar 21 '12 at 15:39
Looks to me like a bulk of it is going to httpd.
– JeffG
Mar 22 '12 at 1:41
Looks to me like a bulk of it is going to httpd.
– JeffG
Mar 22 '12 at 1:41
add a comment |
1 Answer
1
active
oldest
votes
Why one request eats 270MB?
Likely because it accessed a lot of data or metadata in or about files on disk.
Why thats not deallocated after request?
Because the data might be used again soon. Deallocating it after the request makes the next request expensive. It makes more sense to defer the deallocation until the memory is actually needed for something else.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f403211%2frunning-out-of-memory-fork-cant-allocate-memory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Why one request eats 270MB?
Likely because it accessed a lot of data or metadata in or about files on disk.
Why thats not deallocated after request?
Because the data might be used again soon. Deallocating it after the request makes the next request expensive. It makes more sense to defer the deallocation until the memory is actually needed for something else.
add a comment |
Why one request eats 270MB?
Likely because it accessed a lot of data or metadata in or about files on disk.
Why thats not deallocated after request?
Because the data might be used again soon. Deallocating it after the request makes the next request expensive. It makes more sense to defer the deallocation until the memory is actually needed for something else.
add a comment |
Why one request eats 270MB?
Likely because it accessed a lot of data or metadata in or about files on disk.
Why thats not deallocated after request?
Because the data might be used again soon. Deallocating it after the request makes the next request expensive. It makes more sense to defer the deallocation until the memory is actually needed for something else.
Why one request eats 270MB?
Likely because it accessed a lot of data or metadata in or about files on disk.
Why thats not deallocated after request?
Because the data might be used again soon. Deallocating it after the request makes the next request expensive. It makes more sense to defer the deallocation until the memory is actually needed for something else.
answered Oct 17 '17 at 6:31
David Schwartz
56.3k684128
56.3k684128
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f403211%2frunning-out-of-memory-fork-cant-allocate-memory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What else is started? ~180MiB RAM after boot into headless system sounds unreasonable. Also, what does that script do? How big is the database backing it up?
– Bobby
Mar 21 '12 at 13:14
What is exactly "memory usage"? How did you measure it? Is it the one from the first line of
free
?– Cristian Ciupitu
Mar 21 '12 at 13:58
Bobby, this is "ps faux" pastebin.com/4yKGBTyj
– Toktik
Mar 21 '12 at 15:39
Cristian, yes, it is from "free" command, also from mediatemple server status, which is the same. Also "cat /proc/user_beancounters" pastebin.com/H9FZkFWj
– Toktik
Mar 21 '12 at 15:39
Looks to me like a bulk of it is going to httpd.
– JeffG
Mar 22 '12 at 1:41