drop_cache 가 일회성인가요? 아니면 그 설정이 유지되는 것인가요?

astzlra955의 이미지

안녕하세요.

drop_cache를 사용하려고 하는데 한가지 궁금한 점이 있어서 질문드립니다.

echo 3 > /proc/sys/vm/drop_caches

1. 이런 명령을 입력했을때, 이게 일회성으로 저 명령을 내린 순간 page cache, dentry, inode 를 비우고 그 다음부터는 다시 캐싱을 하는 것인가요?

2. 아니면 drop_cache를 3으로 해 놓으면, 그 이후로 계속 page cache, dentry, inode등을 캐싱하지 않고 system이 동작하는 것인가요?

저는 1번으로 알고있었는데, 2번이라고 하시는 분들이 계셔서 어느것이 맞는지 잘 모르겠습니다.

추가로 사용하는 kernel 버전은 3.1 버전과 3.10 버전입니다.
( 혹시 버전업 하면서 변경된 것인가 해서 사용버전을 알려드립니다. )

좋은 하루 보내세요.

김정균의 이미지

제가 알고 있기로는 1번으로 알고 있습니다. 코드를 본 것은 아니지만

shell> cat /proc/sys/vm/drop_caches
3

상태에서 free로 page cache가 늘어나는 것은 확인이 되며, 또한, 3 상태에서 다시

 sync
shell> echo 3 > /proc/sys/vm/drop_caches

를 했을 경우에 다시 page cache가 비워지는 것은 free 명령으로 확인을 할 수 있기 때문입니다.

그리고, 문서상에 보면 drop_cache는 cache를 파괴(?)하는 것이 아니라 현재 사용하지 않는 cache를 free하는 것이라 되어 있습니다. 그러므로 코드를 직접 봐서 확인한 것은 아니지만, 1번이 맞지 않을까 생각합니다. 또한, dirty buffer는 건드리지 않기 때문에 확실하게 하려면 sync 명령을 실행한 후에 위의 명령을 실행하라고 합니다.

다만, 제 경우에는 제가 확실하게 코드를 확인한 것은 아니고 또 확인하기 귀찮아서 그냥 다음과 사용 후 초기화를 다시 해 버립니다.

shell> sync
shell> echo 3> /proc/sys/vm/drop_caches
shell> echo 0> /proc/sys/vm/drop_caches
astzlra955의 이미지

답변 감사드립니다.
말씀해주신 대로 TEST해 보니 동일한 결과가 나오는군요.
사용하고 있던대로 하면 되겠네요

다시 한번 감사드립니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.