How to see buffered and cached data
~$ free
total used free shared buffers cached
Mem: 3891076 1044972 2846104 0 82744 463876
-/+ buffers/cache: 498352 3392724
Swap: 4035580 0 4035580
- How to investigate what kind of data is
bufferedandcached.(not answered yet) - How to clear
buffersandcached? (answered)
EDIT
This command provided by Chris did the trick:
sudo bash -c 'echo 3 > /proc/sys/vm/drop_caches && sleep 2 && free'
linux memory
add a comment |
~$ free
total used free shared buffers cached
Mem: 3891076 1044972 2846104 0 82744 463876
-/+ buffers/cache: 498352 3392724
Swap: 4035580 0 4035580
- How to investigate what kind of data is
bufferedandcached.(not answered yet) - How to clear
buffersandcached? (answered)
EDIT
This command provided by Chris did the trick:
sudo bash -c 'echo 3 > /proc/sys/vm/drop_caches && sleep 2 && free'
linux memory
possible duplicate of real memory usage
– strugee
Dec 24 '13 at 9:05
1
@strugee Not a duplicate imo. The linked question just explains what the terms mean. It does not address any of the two questions.
– Bernhard
Dec 24 '13 at 10:05
add a comment |
~$ free
total used free shared buffers cached
Mem: 3891076 1044972 2846104 0 82744 463876
-/+ buffers/cache: 498352 3392724
Swap: 4035580 0 4035580
- How to investigate what kind of data is
bufferedandcached.(not answered yet) - How to clear
buffersandcached? (answered)
EDIT
This command provided by Chris did the trick:
sudo bash -c 'echo 3 > /proc/sys/vm/drop_caches && sleep 2 && free'
linux memory
~$ free
total used free shared buffers cached
Mem: 3891076 1044972 2846104 0 82744 463876
-/+ buffers/cache: 498352 3392724
Swap: 4035580 0 4035580
- How to investigate what kind of data is
bufferedandcached.(not answered yet) - How to clear
buffersandcached? (answered)
EDIT
This command provided by Chris did the trick:
sudo bash -c 'echo 3 > /proc/sys/vm/drop_caches && sleep 2 && free'
linux memory
linux memory
edited Dec 24 '13 at 13:37
asked Dec 24 '13 at 8:55
user55072
possible duplicate of real memory usage
– strugee
Dec 24 '13 at 9:05
1
@strugee Not a duplicate imo. The linked question just explains what the terms mean. It does not address any of the two questions.
– Bernhard
Dec 24 '13 at 10:05
add a comment |
possible duplicate of real memory usage
– strugee
Dec 24 '13 at 9:05
1
@strugee Not a duplicate imo. The linked question just explains what the terms mean. It does not address any of the two questions.
– Bernhard
Dec 24 '13 at 10:05
possible duplicate of real memory usage
– strugee
Dec 24 '13 at 9:05
possible duplicate of real memory usage
– strugee
Dec 24 '13 at 9:05
1
1
@strugee Not a duplicate imo. The linked question just explains what the terms mean. It does not address any of the two questions.
– Bernhard
Dec 24 '13 at 10:05
@strugee Not a duplicate imo. The linked question just explains what the terms mean. It does not address any of the two questions.
– Bernhard
Dec 24 '13 at 10:05
add a comment |
1 Answer
1
active
oldest
votes
The memory represented by "buffers/cache" in free is your disk and filesystem cache, respectively, which Linux caches to speed up reading data from your disk, as hitting the disk is generally a fairly slow way to access data repeatedly. As such, they are cached in memory, and transparently served from there if available.
You can see which blocks are currently in your cache by using fincore. Here is an example from the project page:
# fincore --pages=false --summarize --only-cached *
stats for CLUSTER_LOG_2010_05_21.MYI: file size=93840384 , total pages=22910 , cached pages=1 , cached size=4096, cached perc=0.004365
stats for CLUSTER_LOG_2010_05_22.MYI: file size=417792 , total pages=102 , cached pages=1 , cached size=4096, cached perc=0.980392
stats for CLUSTER_LOG_2010_05_23.MYI: file size=826368 , total pages=201 , cached pages=1 , cached size=4096, cached perc=0.497512
stats for CLUSTER_LOG_2010_05_24.MYI: file size=192512 , total pages=47 , cached pages=1 , cached size=4096, cached perc=2.127660
stats for CLUSTER_LOG_2010_06_03.MYI: file size=345088 , total pages=84 , cached pages=43 , cached size=176128, cached perc=51.190476
As for how to clear them, from man 5 proc:
/proc/sys/vm/drop_caches (since Linux 2.6.16)
Writing to this file causes the kernel to drop clean caches, dentries, and inodes from memory, causing that memory to become free. This can be useful for memory management testing and performing reproducible filesystem benchmarks. Because writing to this file causes the benefits of caching to be lost, it can degrade overall system performance.
- To free pagecache, use:
echo 1 > /proc/sys/vm/drop_caches
- To free dentries and inodes, use:
echo 2 > /proc/sys/vm/drop_caches
- To free pagecache, dentries and inodes, use:
echo 3 > /proc/sys/vm/drop_caches
Because writing to this file is a nondestructive operation and dirty objects are not freeable, the user should run sync(8) first.
You generally don't want to flush the cache, as its entire purpose is to improve performance, but for debugging purposes you can do so by using drop_caches like so (note: you must be root to use drop_caches, but sync can be done as any user):
# sync && echo 3 > /proc/sys/vm/drop_caches
sudo tee /proc/sys/vm/drop_caches >/dev/null <<< 3no output as well.
– user55072
Dec 24 '13 at 10:41
let us continue this discussion in chat
– user55072
Dec 24 '13 at 10:42
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f106478%2fhow-to-see-buffered-and-cached-data%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
The memory represented by "buffers/cache" in free is your disk and filesystem cache, respectively, which Linux caches to speed up reading data from your disk, as hitting the disk is generally a fairly slow way to access data repeatedly. As such, they are cached in memory, and transparently served from there if available.
You can see which blocks are currently in your cache by using fincore. Here is an example from the project page:
# fincore --pages=false --summarize --only-cached *
stats for CLUSTER_LOG_2010_05_21.MYI: file size=93840384 , total pages=22910 , cached pages=1 , cached size=4096, cached perc=0.004365
stats for CLUSTER_LOG_2010_05_22.MYI: file size=417792 , total pages=102 , cached pages=1 , cached size=4096, cached perc=0.980392
stats for CLUSTER_LOG_2010_05_23.MYI: file size=826368 , total pages=201 , cached pages=1 , cached size=4096, cached perc=0.497512
stats for CLUSTER_LOG_2010_05_24.MYI: file size=192512 , total pages=47 , cached pages=1 , cached size=4096, cached perc=2.127660
stats for CLUSTER_LOG_2010_06_03.MYI: file size=345088 , total pages=84 , cached pages=43 , cached size=176128, cached perc=51.190476
As for how to clear them, from man 5 proc:
/proc/sys/vm/drop_caches (since Linux 2.6.16)
Writing to this file causes the kernel to drop clean caches, dentries, and inodes from memory, causing that memory to become free. This can be useful for memory management testing and performing reproducible filesystem benchmarks. Because writing to this file causes the benefits of caching to be lost, it can degrade overall system performance.
- To free pagecache, use:
echo 1 > /proc/sys/vm/drop_caches
- To free dentries and inodes, use:
echo 2 > /proc/sys/vm/drop_caches
- To free pagecache, dentries and inodes, use:
echo 3 > /proc/sys/vm/drop_caches
Because writing to this file is a nondestructive operation and dirty objects are not freeable, the user should run sync(8) first.
You generally don't want to flush the cache, as its entire purpose is to improve performance, but for debugging purposes you can do so by using drop_caches like so (note: you must be root to use drop_caches, but sync can be done as any user):
# sync && echo 3 > /proc/sys/vm/drop_caches
sudo tee /proc/sys/vm/drop_caches >/dev/null <<< 3no output as well.
– user55072
Dec 24 '13 at 10:41
let us continue this discussion in chat
– user55072
Dec 24 '13 at 10:42
add a comment |
The memory represented by "buffers/cache" in free is your disk and filesystem cache, respectively, which Linux caches to speed up reading data from your disk, as hitting the disk is generally a fairly slow way to access data repeatedly. As such, they are cached in memory, and transparently served from there if available.
You can see which blocks are currently in your cache by using fincore. Here is an example from the project page:
# fincore --pages=false --summarize --only-cached *
stats for CLUSTER_LOG_2010_05_21.MYI: file size=93840384 , total pages=22910 , cached pages=1 , cached size=4096, cached perc=0.004365
stats for CLUSTER_LOG_2010_05_22.MYI: file size=417792 , total pages=102 , cached pages=1 , cached size=4096, cached perc=0.980392
stats for CLUSTER_LOG_2010_05_23.MYI: file size=826368 , total pages=201 , cached pages=1 , cached size=4096, cached perc=0.497512
stats for CLUSTER_LOG_2010_05_24.MYI: file size=192512 , total pages=47 , cached pages=1 , cached size=4096, cached perc=2.127660
stats for CLUSTER_LOG_2010_06_03.MYI: file size=345088 , total pages=84 , cached pages=43 , cached size=176128, cached perc=51.190476
As for how to clear them, from man 5 proc:
/proc/sys/vm/drop_caches (since Linux 2.6.16)
Writing to this file causes the kernel to drop clean caches, dentries, and inodes from memory, causing that memory to become free. This can be useful for memory management testing and performing reproducible filesystem benchmarks. Because writing to this file causes the benefits of caching to be lost, it can degrade overall system performance.
- To free pagecache, use:
echo 1 > /proc/sys/vm/drop_caches
- To free dentries and inodes, use:
echo 2 > /proc/sys/vm/drop_caches
- To free pagecache, dentries and inodes, use:
echo 3 > /proc/sys/vm/drop_caches
Because writing to this file is a nondestructive operation and dirty objects are not freeable, the user should run sync(8) first.
You generally don't want to flush the cache, as its entire purpose is to improve performance, but for debugging purposes you can do so by using drop_caches like so (note: you must be root to use drop_caches, but sync can be done as any user):
# sync && echo 3 > /proc/sys/vm/drop_caches
sudo tee /proc/sys/vm/drop_caches >/dev/null <<< 3no output as well.
– user55072
Dec 24 '13 at 10:41
let us continue this discussion in chat
– user55072
Dec 24 '13 at 10:42
add a comment |
The memory represented by "buffers/cache" in free is your disk and filesystem cache, respectively, which Linux caches to speed up reading data from your disk, as hitting the disk is generally a fairly slow way to access data repeatedly. As such, they are cached in memory, and transparently served from there if available.
You can see which blocks are currently in your cache by using fincore. Here is an example from the project page:
# fincore --pages=false --summarize --only-cached *
stats for CLUSTER_LOG_2010_05_21.MYI: file size=93840384 , total pages=22910 , cached pages=1 , cached size=4096, cached perc=0.004365
stats for CLUSTER_LOG_2010_05_22.MYI: file size=417792 , total pages=102 , cached pages=1 , cached size=4096, cached perc=0.980392
stats for CLUSTER_LOG_2010_05_23.MYI: file size=826368 , total pages=201 , cached pages=1 , cached size=4096, cached perc=0.497512
stats for CLUSTER_LOG_2010_05_24.MYI: file size=192512 , total pages=47 , cached pages=1 , cached size=4096, cached perc=2.127660
stats for CLUSTER_LOG_2010_06_03.MYI: file size=345088 , total pages=84 , cached pages=43 , cached size=176128, cached perc=51.190476
As for how to clear them, from man 5 proc:
/proc/sys/vm/drop_caches (since Linux 2.6.16)
Writing to this file causes the kernel to drop clean caches, dentries, and inodes from memory, causing that memory to become free. This can be useful for memory management testing and performing reproducible filesystem benchmarks. Because writing to this file causes the benefits of caching to be lost, it can degrade overall system performance.
- To free pagecache, use:
echo 1 > /proc/sys/vm/drop_caches
- To free dentries and inodes, use:
echo 2 > /proc/sys/vm/drop_caches
- To free pagecache, dentries and inodes, use:
echo 3 > /proc/sys/vm/drop_caches
Because writing to this file is a nondestructive operation and dirty objects are not freeable, the user should run sync(8) first.
You generally don't want to flush the cache, as its entire purpose is to improve performance, but for debugging purposes you can do so by using drop_caches like so (note: you must be root to use drop_caches, but sync can be done as any user):
# sync && echo 3 > /proc/sys/vm/drop_caches
The memory represented by "buffers/cache" in free is your disk and filesystem cache, respectively, which Linux caches to speed up reading data from your disk, as hitting the disk is generally a fairly slow way to access data repeatedly. As such, they are cached in memory, and transparently served from there if available.
You can see which blocks are currently in your cache by using fincore. Here is an example from the project page:
# fincore --pages=false --summarize --only-cached *
stats for CLUSTER_LOG_2010_05_21.MYI: file size=93840384 , total pages=22910 , cached pages=1 , cached size=4096, cached perc=0.004365
stats for CLUSTER_LOG_2010_05_22.MYI: file size=417792 , total pages=102 , cached pages=1 , cached size=4096, cached perc=0.980392
stats for CLUSTER_LOG_2010_05_23.MYI: file size=826368 , total pages=201 , cached pages=1 , cached size=4096, cached perc=0.497512
stats for CLUSTER_LOG_2010_05_24.MYI: file size=192512 , total pages=47 , cached pages=1 , cached size=4096, cached perc=2.127660
stats for CLUSTER_LOG_2010_06_03.MYI: file size=345088 , total pages=84 , cached pages=43 , cached size=176128, cached perc=51.190476
As for how to clear them, from man 5 proc:
/proc/sys/vm/drop_caches (since Linux 2.6.16)
Writing to this file causes the kernel to drop clean caches, dentries, and inodes from memory, causing that memory to become free. This can be useful for memory management testing and performing reproducible filesystem benchmarks. Because writing to this file causes the benefits of caching to be lost, it can degrade overall system performance.
- To free pagecache, use:
echo 1 > /proc/sys/vm/drop_caches
- To free dentries and inodes, use:
echo 2 > /proc/sys/vm/drop_caches
- To free pagecache, dentries and inodes, use:
echo 3 > /proc/sys/vm/drop_caches
Because writing to this file is a nondestructive operation and dirty objects are not freeable, the user should run sync(8) first.
You generally don't want to flush the cache, as its entire purpose is to improve performance, but for debugging purposes you can do so by using drop_caches like so (note: you must be root to use drop_caches, but sync can be done as any user):
# sync && echo 3 > /proc/sys/vm/drop_caches
edited 22 mins ago
answered Dec 24 '13 at 8:59
Chris DownChris Down
80.9k14189203
80.9k14189203
sudo tee /proc/sys/vm/drop_caches >/dev/null <<< 3no output as well.
– user55072
Dec 24 '13 at 10:41
let us continue this discussion in chat
– user55072
Dec 24 '13 at 10:42
add a comment |
sudo tee /proc/sys/vm/drop_caches >/dev/null <<< 3no output as well.
– user55072
Dec 24 '13 at 10:41
let us continue this discussion in chat
– user55072
Dec 24 '13 at 10:42
sudo tee /proc/sys/vm/drop_caches >/dev/null <<< 3 no output as well.– user55072
Dec 24 '13 at 10:41
sudo tee /proc/sys/vm/drop_caches >/dev/null <<< 3 no output as well.– user55072
Dec 24 '13 at 10:41
let us continue this discussion in chat
– user55072
Dec 24 '13 at 10:42
let us continue this discussion in chat
– user55072
Dec 24 '13 at 10:42
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f106478%2fhow-to-see-buffered-and-cached-data%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
possible duplicate of real memory usage
– strugee
Dec 24 '13 at 9:05
1
@strugee Not a duplicate imo. The linked question just explains what the terms mean. It does not address any of the two questions.
– Bernhard
Dec 24 '13 at 10:05