How to reduce free memory to certain number for specific time durationHow to configure ubuntu for lightweight low-memory usage?Memory usage doesn't add up over timeDid Ubuntu 12.04 server really eat my RAM?Out of Memory IssueUbuntu 18.04 running slow with 4GB RAM
How do critical hits work with static monster damage?
Isn't any conversation with the US president quid-pro-quo?
Elevator design implementation in C++
Is the genre 'fantasy' still fantasy without magic?
Beautiful planar geometry theorems not encountered in high school
What is the name of the fallacy involving white and black swans?
How can I improve combat so my players don't always use the strategy of collectively focusing fire on one enemy at a time until it's dead?
Are there any dishes that can only be cooked with a microwave?
Stack data structure in python 3
Does toddler keep hands around private parts?
Can I use pavers as a cheap solution to stop rain water erosion?
How to spot dust on lens quickly while doing a shoot outdoors?
How can one "treat writing as a job" even though it doesn't pay?
Can it be viewed as a negative for PhD applications in the US if I have children?
Why has no one requested the tape of the Trump/Ukraine call?
Where does the budget surplus of a conference go?
Is it a mistake to use a password that has previously been used (by anyone ever)?
Is "montäglich" commonly used?
What is the name of this landform?
How to break a equation with a single "summation symbol (sum) " common?
Stalemate situation with all pieces on the board
Surmounting set-theoretical difficulties in algebraic geometry
How to deal with lack of advantages for a character starting at low point total?
how can traditional forms of magic compete against demon magic?
How to reduce free memory to certain number for specific time duration
How to configure ubuntu for lightweight low-memory usage?Memory usage doesn't add up over timeDid Ubuntu 12.04 server really eat my RAM?Out of Memory IssueUbuntu 18.04 running slow with 4GB RAM
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I want to stress memory for certain time duration. I am checking memory usage with vmstat -s
and using tail /dev/zero
command but tail /dev/zero
times out in about 60s and it fills out memory randomly. I want to have available free memory 5% for 180 seconds.
ram memory-usage stress-testing
add a comment
|
I want to stress memory for certain time duration. I am checking memory usage with vmstat -s
and using tail /dev/zero
command but tail /dev/zero
times out in about 60s and it fills out memory randomly. I want to have available free memory 5% for 180 seconds.
ram memory-usage stress-testing
add a comment
|
I want to stress memory for certain time duration. I am checking memory usage with vmstat -s
and using tail /dev/zero
command but tail /dev/zero
times out in about 60s and it fills out memory randomly. I want to have available free memory 5% for 180 seconds.
ram memory-usage stress-testing
I want to stress memory for certain time duration. I am checking memory usage with vmstat -s
and using tail /dev/zero
command but tail /dev/zero
times out in about 60s and it fills out memory randomly. I want to have available free memory 5% for 180 seconds.
ram memory-usage stress-testing
ram memory-usage stress-testing
asked Sep 5 at 19:40
beginner_userbeginner_user
454 bronze badges
454 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
One could use the kernel trace buffer as a way to reduce available memory left for the system and/or user. Example, using my system with 16 gigabytes and 8 CPUs:
First flush memory, giving our starting point (note that I am running as root):
root@s15:/home/doug/temp-k-git/linux# sync
root@s15:/home/doug/temp-k-git/linux# echo 3 > /proc/sys/vm/drop_caches
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15472 1 159 15343
Swap: 16085 35 16050
Now, calculate and allocate the memory to the kernel trace buffer: 5% of 15719 megabytyes is 786 megabytes. Starting from 15472 megabytyes, Then 14686 megabyytes need to be used. The kernel trace buffer is per CPU, in my case 8 CPUs, so 1835 megabytes per CPU. Allocate:
root@s15:/home/doug/temp-k-git/linux# echo 1835000 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 14476 858 1 385 730
Swap: 16085 35 16050
You can observe that it resulted in 5.46% of memory still available (tweek the allocation, if needed). Once you have done whatever testing, then you can de-allocate the kernel trace buffer with (0 does not work):
root@s15:/home/doug/temp-k-git/linux# echo 1 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15470 1 160 15342
Swap: 16085 35 16050
If you want the time to be 180 seconds, then bundle up the above into a script with a 180 second sleep time. However, you will still have to check the available number as your starting point.
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
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/4.0/"u003ecc by-sa 4.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%2faskubuntu.com%2fquestions%2f1171147%2fhow-to-reduce-free-memory-to-certain-number-for-specific-time-duration%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
One could use the kernel trace buffer as a way to reduce available memory left for the system and/or user. Example, using my system with 16 gigabytes and 8 CPUs:
First flush memory, giving our starting point (note that I am running as root):
root@s15:/home/doug/temp-k-git/linux# sync
root@s15:/home/doug/temp-k-git/linux# echo 3 > /proc/sys/vm/drop_caches
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15472 1 159 15343
Swap: 16085 35 16050
Now, calculate and allocate the memory to the kernel trace buffer: 5% of 15719 megabytyes is 786 megabytes. Starting from 15472 megabytyes, Then 14686 megabyytes need to be used. The kernel trace buffer is per CPU, in my case 8 CPUs, so 1835 megabytes per CPU. Allocate:
root@s15:/home/doug/temp-k-git/linux# echo 1835000 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 14476 858 1 385 730
Swap: 16085 35 16050
You can observe that it resulted in 5.46% of memory still available (tweek the allocation, if needed). Once you have done whatever testing, then you can de-allocate the kernel trace buffer with (0 does not work):
root@s15:/home/doug/temp-k-git/linux# echo 1 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15470 1 160 15342
Swap: 16085 35 16050
If you want the time to be 180 seconds, then bundle up the above into a script with a 180 second sleep time. However, you will still have to check the available number as your starting point.
add a comment
|
One could use the kernel trace buffer as a way to reduce available memory left for the system and/or user. Example, using my system with 16 gigabytes and 8 CPUs:
First flush memory, giving our starting point (note that I am running as root):
root@s15:/home/doug/temp-k-git/linux# sync
root@s15:/home/doug/temp-k-git/linux# echo 3 > /proc/sys/vm/drop_caches
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15472 1 159 15343
Swap: 16085 35 16050
Now, calculate and allocate the memory to the kernel trace buffer: 5% of 15719 megabytyes is 786 megabytes. Starting from 15472 megabytyes, Then 14686 megabyytes need to be used. The kernel trace buffer is per CPU, in my case 8 CPUs, so 1835 megabytes per CPU. Allocate:
root@s15:/home/doug/temp-k-git/linux# echo 1835000 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 14476 858 1 385 730
Swap: 16085 35 16050
You can observe that it resulted in 5.46% of memory still available (tweek the allocation, if needed). Once you have done whatever testing, then you can de-allocate the kernel trace buffer with (0 does not work):
root@s15:/home/doug/temp-k-git/linux# echo 1 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15470 1 160 15342
Swap: 16085 35 16050
If you want the time to be 180 seconds, then bundle up the above into a script with a 180 second sleep time. However, you will still have to check the available number as your starting point.
add a comment
|
One could use the kernel trace buffer as a way to reduce available memory left for the system and/or user. Example, using my system with 16 gigabytes and 8 CPUs:
First flush memory, giving our starting point (note that I am running as root):
root@s15:/home/doug/temp-k-git/linux# sync
root@s15:/home/doug/temp-k-git/linux# echo 3 > /proc/sys/vm/drop_caches
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15472 1 159 15343
Swap: 16085 35 16050
Now, calculate and allocate the memory to the kernel trace buffer: 5% of 15719 megabytyes is 786 megabytes. Starting from 15472 megabytyes, Then 14686 megabyytes need to be used. The kernel trace buffer is per CPU, in my case 8 CPUs, so 1835 megabytes per CPU. Allocate:
root@s15:/home/doug/temp-k-git/linux# echo 1835000 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 14476 858 1 385 730
Swap: 16085 35 16050
You can observe that it resulted in 5.46% of memory still available (tweek the allocation, if needed). Once you have done whatever testing, then you can de-allocate the kernel trace buffer with (0 does not work):
root@s15:/home/doug/temp-k-git/linux# echo 1 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15470 1 160 15342
Swap: 16085 35 16050
If you want the time to be 180 seconds, then bundle up the above into a script with a 180 second sleep time. However, you will still have to check the available number as your starting point.
One could use the kernel trace buffer as a way to reduce available memory left for the system and/or user. Example, using my system with 16 gigabytes and 8 CPUs:
First flush memory, giving our starting point (note that I am running as root):
root@s15:/home/doug/temp-k-git/linux# sync
root@s15:/home/doug/temp-k-git/linux# echo 3 > /proc/sys/vm/drop_caches
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15472 1 159 15343
Swap: 16085 35 16050
Now, calculate and allocate the memory to the kernel trace buffer: 5% of 15719 megabytyes is 786 megabytes. Starting from 15472 megabytyes, Then 14686 megabyytes need to be used. The kernel trace buffer is per CPU, in my case 8 CPUs, so 1835 megabytes per CPU. Allocate:
root@s15:/home/doug/temp-k-git/linux# echo 1835000 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 14476 858 1 385 730
Swap: 16085 35 16050
You can observe that it resulted in 5.46% of memory still available (tweek the allocation, if needed). Once you have done whatever testing, then you can de-allocate the kernel trace buffer with (0 does not work):
root@s15:/home/doug/temp-k-git/linux# echo 1 > /sys/kernel/debug/tracing/buffer_size_kb
And check it:
root@s15:/home/doug/temp-k-git/linux# free -m
total used free shared buff/cache available
Mem: 15719 88 15470 1 160 15342
Swap: 16085 35 16050
If you want the time to be 180 seconds, then bundle up the above into a script with a 180 second sleep time. However, you will still have to check the available number as your starting point.
answered Sep 6 at 15:20
Doug SmythiesDoug Smythies
8,4383 gold badges20 silver badges32 bronze badges
8,4383 gold badges20 silver badges32 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f1171147%2fhow-to-reduce-free-memory-to-certain-number-for-specific-time-duration%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