{"id":57,"date":"2022-03-25T12:02:00","date_gmt":"2022-03-25T05:02:00","guid":{"rendered":"http:\/\/wp-demo.upfile.vn\/?p=57"},"modified":"2022-03-25T22:59:37","modified_gmt":"2022-03-25T15:59:37","slug":"huong-dan-kiem-tra-memory-tren-linux","status":"publish","type":"post","link":"https:\/\/longvan.net\/cong-dong\/huong-dan-kiem-tra-memory-tren-linux\/","title":{"rendered":"H\u01b0\u1edbng d\u1eabn ki\u1ec3m tra Memory tr\u00ean Linux"},"content":{"rendered":"\n<h5 class=\"wp-block-heading\" id=\"bkmrk-i.-ki%E1%BB%83m-tra-dung-l%C6%B0%E1%BB%A3\">I. Ki\u1ec3m tra :<\/h5>\n\n\n\n<ul class=\"wp-block-list\" id=\"bkmrk-%C4%90%E1%BB%83-ki%E1%BB%83m-tra-memory-v\"><li>\u0110\u1ec3 ki\u1ec3m tra memory v\u00e0 m\u1ee9c \u0111\u1ed9 s\u1eed d\u1ee5ng memory tr\u00ean server, ta s\u1eed d\u1ee5ng l\u1ec7nh:<br><br>free -m<br><br><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"64\" class=\"wp-image-60\" style=\"width: 700px\" src=\"http:\/\/wp-demo.upfile.vn\/wp-content\/uploads\/2022\/03\/image-1642154452949-1.png\" alt=\"\" srcset=\"https:\/\/longvan.net\/cong-dong\/wp-content\/uploads\/2022\/03\/image-1642154452949-1.png 576w, https:\/\/longvan.net\/cong-dong\/wp-content\/uploads\/2022\/03\/image-1642154452949-1-300x33.png 300w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><br><br><a rel=\"noreferrer noopener\" href=\"https:\/\/docs.longvan.net\/uploads\/images\/gallery\/2022-01\/image-1642154452949.png\" target=\"_blank\"><\/a><\/li><li>Trong \u0111\u00f3:<ul><li><strong>total<\/strong> (Mem): t\u1ed5ng dung l\u01b0\u1ee3ng memory trong server.<\/li><li><strong>used<\/strong> (Mem): t\u1ed5ng dung l\u01b0\u1ee3ng memory \u0111\u00e3 s\u1eed d\u1ee5ng cho c\u00e1c \u1ee9ng d\u1ee5ng v\u00e0 kernel trong server.<\/li><li><strong>free<\/strong> (Mem): d\u1ee5ng l\u01b0\u1ee3ng memory c\u00f2n tr\u1ed1ng (ch\u01b0a s\u1eed d\u1ee5ngs.<\/li><li><strong>shared<\/strong> (Mem): \u0111\u00e2y l\u00e0 dung l\u01b0\u1ee3ng memory \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ch\u1ee7 y\u1ebfu cho .<\/li><li><strong>buff\/cache<\/strong> (Mem): t\u1ed5ng dung l\u01b0\u1ee3ng memory \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho c\u1ea3 buffers v\u00e0 cache, v\u1edbi:<ul><li><strong>buffers<\/strong>: l\u00e0 v\u00f9ng l\u01b0u tr\u1eef t\u1ea1m th\u1eddi tr\u01b0\u1edbc khi chuy\u1ec3n v\u00e0o thi\u1ebft b\u1ecb \u0111\u1ea7u v\u00e0o ho\u1eb7c thi\u1ebft b\u1ecb \u0111\u1ea7u ra. B\u1ed9 nh\u1edb buffers th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng trong ti\u1ebfn tr\u00ecnh input\/output nh\u01b0 in \u1ea5n, burn CD,&#8230;<\/li><li><strong>cached<\/strong>: l\u00e0 k\u00edch th\u01b0\u1edbc v\u00f9ng nh\u1edd Linux page cache. Linux th\u1ef1c thi t\u1ea5t c\u1ea3 thao t\u00e1c I\/O th\u00f4ng qua Linux page cache , qua \u0111\u00f3 t\u0103ng t\u1ed1c \u0111\u1ed9 \u0111\u1ecdc ghi.<\/li><\/ul><\/li><li><strong>available<\/strong> (Mem) : \u0111\u00e2y l\u00e0 dung l\u01b0\u1ee3ng memory s\u1eb3n c\u00f3 \u0111\u1ec3 c\u00f3 th\u1ec3 kh\u1edfi ch\u1ea1y m\u1ed9t \u1ee9ng d\u1ee5ng ho\u1eb7c ti\u1ebfn tr\u00ecnh m\u1edbi m\u00e0 kh\u00f4ng c\u1ea7n ho\u00e1n \u0111\u1ed5i (n\u00f3 bao g\u1ed3m h\u1ea7u h\u1ebft b\u1ed9 nh\u1edb memory free ).<\/li><li><strong>total<\/strong> (Swap) : \u0111\u00e2y l\u00e0 t\u1ed5ng dung l\u01b0\u1ee3ng \u1ed5 \u0111\u0129a \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho ph\u1ea7n swap. B\u1ea1n c\u00f3 th\u1ec3 ki\u1ec3m tra th\u00f4ng s\u1ed1 n\u00e0y th\u00f4ng qua l\u1ec7nh <em>swapon -s<\/em> .<\/li><li><strong>used<\/strong> (Swap) : \u0111\u00e2y l\u00e0 dung l\u01b0\u1ee3ng swap \u0111\u00e3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng. L\u1ec7nh <em>swapon -s<\/em> c\u0169ng hi\u1ec3n th\u1ecb k\u1ebft qu\u1ea3 t\u01b0\u01a1ng \u0111\u01b0\u01a1ng.<\/li><li><strong>free<\/strong> (Swap) : dung l\u01b0\u1ee3ng swap hi\u1ec7n kh\u00f4ng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng. N\u00f3 b\u1eb1ng total (swap) &#8211; used (swap).<br><\/li><\/ul><\/li><li>\u1ede v\u00ed d\u1ee5 tr\u00ean h\u00ecnh, th\u00f4ng s\u1ed1 s\u1ebd nh\u01b0 sau:<ul><li>T\u1ed5ng dung l\u01b0\u1ee3ng Memory b\u1eb1ng <strong>1,8 GB<\/strong> (total)<\/li><li>\u0110\u00e3 s\u1eed d\u1ee5ng<strong> 137 MB<\/strong> (used)<\/li><li>Dung l\u01b0\u1ee3ng ch\u01b0a s\u1eed d\u1ee5ng b\u1eb1ng <strong>1,5 GB<\/strong> (free)<\/li><li>Dung l\u01b0\u1ee3ng b\u1ed9 nh\u1edb s\u1eed d\u1ee5ng cho vi\u1ec7c l\u01b0u \u0111\u1ec7m b\u1eb1ng <strong>161 MB<\/strong> (buff\/cache)<\/li><\/ul><\/li><\/ul>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"bkmrk-ii.-t%E1%BA%A1i-sao-dung-l%C6%B0%E1%BB%A3\">II. T\u1ea1i sao dung l\u01b0\u1ee3ng Memory tr\u00ean server nh\u1eadn kh\u00f4ng \u0111\u1ee7.<\/h5>\n\n\n\n<ul class=\"wp-block-list\" id=\"bkmrk-l%E1%BA%A5y-l%E1%BA%A1i-v%C3%AD-d%E1%BB%A5-%E1%BB%9F-tr%C3%AAn\"><li>L\u1ea5y l\u1ea1i v\u00ed d\u1ee5 \u1edf tr\u00ean, server c\u00f3 2 GB RAM b\u1ed9 nh\u1edb nh\u01b0ng khi ki\u1ec3m tra th\u00ec h\u1ec7 \u0111i\u1ec1u h\u00e0nh ch\u1ec9 nh\u1eadn 1.8 GB, nguy\u00ean nh\u00e2n m\u1ed9t ph\u1ea7n Memory \u0111\u00e3 b\u1ecb chi\u1ebfm d\u1ee5ng b\u1edfi nh\u00e2n h\u1ec7 th\u1ed1ng (Linux KernelL.<\/li><li>Nh\u1eadp l\u1ec7nh d\u01b0\u1edbi \u0111\u00e2y \u0111\u1ec3 hi\u1ec3n th\u1ecb th\u00f4ng tin c\u1ee5 th\u1ec3:<br><br>dmeg | grep -i memory<br><br><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"260\" class=\"wp-image-61\" style=\"width: 750px\" src=\"http:\/\/wp-demo.upfile.vn\/wp-content\/uploads\/2022\/03\/image-1642157678434.png\" alt=\"\" srcset=\"https:\/\/longvan.net\/cong-dong\/wp-content\/uploads\/2022\/03\/image-1642157678434.png 672w, https:\/\/longvan.net\/cong-dong\/wp-content\/uploads\/2022\/03\/image-1642157678434-300x116.png 300w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><br><br><a rel=\"noreferrer noopener\" href=\"https:\/\/docs.longvan.net\/uploads\/images\/gallery\/2022-01\/image-1642157678434.png\" target=\"_blank\"><\/a><\/li><li>Trong \u0111\u00f3:<ul><li>(1) l\u00e0 t\u1ed5ng dung l\u01b0\u1ee3ng b\u1ed9 nh\u1edb h\u1ec7 \u0111i\u1ec1u h\u00e0nh Linux \u0111\u00e3 nh\u1eadn \u0111\u01b0\u1ee3c th\u1ef1c s\u1ef1 l\u00e0 2047 MB (System RAM: 2047MB).<\/li><li>(2) t\u1ed5ng dung l\u01b0\u1ee3ng l\u00e0 2 GB (2097152kB) nh\u01b0ng l\u1ea1i ch\u1ec9 s\u1eed d\u1ee5ng \u0111\u01b0\u1ee3c 1,8 GB (1841008k).<\/li><li>(3) gi\u00e1 tr\u1ecb 255620k reserved, gi\u00e1 th\u1ecb th\u1ec3 hi\u1ec7n trong qu\u00e1 tr\u00ecnh kh\u1edfi \u0111\u1ed9ng nh\u00e2n h\u1ec7 \u0111i\u1ec1u h\u00e0nh \u0111\u00e3 s\u1eed d\u1ee5ng 255 MB \u0111\u1ec3 th\u1ef1c hi\u1ec7n m\u1ed9t s\u1ed1 module \u0111\u1eb7c bi\u1ec7t.<\/li><li>N\u1ebfu c\u1ed9ng gi\u00e1 tr\u1ecb 255620k v\u1edbi dung l\u01b0\u1ee3ng b\u1ed9 nh\u1edb c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng 1841008k ch\u00fang ta s\u1ebd \u0111\u01b0\u1ee3c gi\u00e1 tr\u1ecb g\u1ea7n b\u1eb1ng b\u1eb1ng dung l\u01b0\u1ee3ng b\u1ed9 nh\u1edb v\u1eadt l\u00fd c\u1ee7a Server.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I. Ki\u1ec3m tra : \u0110\u1ec3 ki\u1ec3m tra memory v\u00e0 m\u1ee9c \u0111\u1ed9 s\u1eed d\u1ee5ng memory tr\u00ean server, ta s\u1eed d\u1ee5ng l\u1ec7nh: free -m Trong \u0111\u00f3: total (Mem): t\u1ed5ng dung l\u01b0\u1ee3ng memory trong server. used (Mem): t\u1ed5ng dung l\u01b0\u1ee3ng memory \u0111\u00e3 s\u1eed d\u1ee5ng cho c\u00e1c \u1ee9ng d\u1ee5ng v\u00e0 kernel trong server. free (Mem): d\u1ee5ng l\u01b0\u1ee3ng memory c\u00f2n [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_oasis_is_in_workflow":0,"_oasis_original":0,"footnotes":""},"categories":[4],"tags":[27,5,23,24,25],"class_list":["post-57","post","type-post","status-publish","format-standard","hentry","category-linux","tag-kiem-tra-ram","tag-linux","tag-memory","tag-ram","tag-thieu-ram"],"_links":{"self":[{"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/posts\/57","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":2,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"predecessor-version":[{"id":65,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/posts\/57\/revisions\/65"}],"wp:attachment":[{"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/longvan.net\/cong-dong\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}