{"id":131167,"date":"2026-10-20T12:48:15","date_gmt":"2026-10-20T05:48:15","guid":{"rendered":"https:\/\/tino.vn\/blog\/?p=131167"},"modified":"2026-10-20T13:01:53","modified_gmt":"2026-10-20T06:01:53","slug":"fix-loi-out-of-memory","status":"publish","type":"post","link":"https:\/\/tino.vn\/blog\/fix-loi-out-of-memory\/","title":{"rendered":"H\u01b0\u1edbng d\u1eabn fix l\u1ed7i Out of Memory (OOM) khi ch\u1ea1y AI Agent tr\u00ean VPS\u00a0"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>\u0110\u1ec3 fix l\u1ed7i Out of Memory (OOM) khi ch\u1ea1y <a href=\"https:\/\/tino.vn\/blog\/cach-ly-sandbox-cho-ai-agent-tren-vps\/\" target=\"_blank\" data-type=\"post\" data-id=\"130077\" rel=\"noreferrer noopener\">AI Agent tr\u00ean VPS<\/a>, b\u1ea1n c\u1ea7n ki\u1ec3m tra dung l\u01b0\u1ee3ng RAM, x\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh ti\u00eau th\u1ee5 b\u1ed9 nh\u1edb v\u00e0 \u0111i\u1ec1u ch\u1ec9nh t\u00e0i nguy\u00ean ph\u00f9 h\u1ee3p. Trong nhi\u1ec1u tr\u01b0\u1eddng h\u1ee3p, t\u1ea1o th\u00eam Swap ho\u1eb7c gi\u1ea3m s\u1ed1 t\u00e1c v\u1ee5 ch\u1ea1y \u0111\u1ed3ng th\u1eddi c\u00f3 th\u1ec3 gi\u00fap AI Agent ho\u1ea1t \u0111\u1ed9ng \u1ed5n \u0111\u1ecbnh h\u01a1n m\u00e0 ch\u01b0a c\u1ea7n n\u00e2ng c\u1ea5p VPS. B\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y s\u1ebd h\u01b0\u1edbng d\u1eabn c\u00e1ch t\u00ecm nguy\u00ean nh\u00e2n v\u00e0 kh\u1eafc ph\u1ee5c l\u1ed7i b\u1eb1ng nh\u1eefng thao t\u00e1c Linux c\u01a1 b\u1ea3n, ph\u00f9 h\u1ee3p ngay c\u1ea3 v\u1edbi ng\u01b0\u1eddi m\u1edbi s\u1eed d\u1ee5ng VPS.&nbsp;<\/strong><\/p>\n\n\n\n<h2 id=\"L\u1ed7i_Out_of_Memory_(OOM)_tr\u00ean_VPS_l\u00e0_g\u00ec?\"><strong>L\u1ed7i Out of Memory (OOM) tr\u00ean VPS l\u00e0 g\u00ec?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Out of Memory (OOM)<\/strong> l\u00e0 t\u00ecnh tr\u1ea1ng h\u1ec7 th\u1ed1ng ho\u1eb7c m\u1ed9t \u1ee9ng d\u1ee5ng kh\u00f4ng c\u00f2n \u0111\u1ee7 b\u1ed9 nh\u1edb \u0111\u01b0\u1ee3c ph\u00e9p s\u1eed d\u1ee5ng \u0111\u1ec3 ti\u1ebfp t\u1ee5c ho\u1ea1t \u0111\u1ed9ng b\u00ecnh th\u01b0\u1eddng.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tr\u00ean VPS Linux, khi b\u1ed9 nh\u1edb c\u1ea1n ki\u1ec7t v\u00e0 h\u1ec7 th\u1ed1ng kh\u00f4ng th\u1ec3 thu h\u1ed3i \u0111\u1ee7 t\u00e0i nguy\u00ean, c\u01a1 ch\u1ebf OOM Killer c\u00f3 th\u1ec3 k\u1ebft th\u00fac m\u1ed9t ho\u1eb7c nhi\u1ec1u ti\u1ebfn tr\u00ecnh nh\u1eb1m gi\u1ea3i ph\u00f3ng RAM, h\u1ea1n ch\u1ebf \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn to\u00e0n b\u1ed9 m\u00e1y ch\u1ee7.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">L\u1ed7i OOM c\u00f3 th\u1ec3 x\u1ea3y ra theo hai tr\u01b0\u1eddng h\u1ee3p:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>H\u1ebft b\u1ed9 nh\u1edb to\u00e0n h\u1ec7 th\u1ed1ng: <\/strong>VPS kh\u00f4ng c\u00f2n \u0111\u1ee7 b\u1ed9 nh\u1edb kh\u1ea3 d\u1ee5ng \u0111\u1ec3 \u0111\u00e1p \u1ee9ng nhu c\u1ea7u c\u1ee7a c\u00e1c ti\u1ebfn tr\u00ecnh.<\/li>\n\n\n\n<li><strong>V\u01b0\u1ee3t gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb c\u1ee7a \u1ee9ng d\u1ee5ng:<\/strong> AI Agent ch\u1ea1y trong Docker ho\u1eb7c m\u1ed9t nh\u00f3m ti\u1ebfn tr\u00ecnh b\u1ecb gi\u1edbi h\u1ea1n RAM, d\u00f9 VPS v\u1eabn c\u00f2n b\u1ed9 nh\u1edb tr\u1ed1ng.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/docs.docker.com\/engine\/containers\/resource_constraints\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/docs.docker.com\/engine\/containers\/resource_constraints\" rel=\"noreferrer noopener nofollow\">Theo t\u00e0i li\u1ec7u Docker<\/a>, container c\u00f3 th\u1ec3 g\u1eb7p OOM khi ch\u1ea1m gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh ri\u00eang, kh\u00f4ng nh\u1ea5t thi\u1ebft ph\u1ea3i \u0111\u1ee3i to\u00e0n b\u1ed9 VPS h\u1ebft RAM.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-1-1.png\" alt=\"\" class=\"wp-image-131202\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-1-1.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-1-1-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n<\/div>\n\n\n<h2 id=\"D\u1ea5u_hi\u1ec7u_v\u00e0_nguy\u00ean_nh\u00e2n_khi\u1ebfn_AI_Agent_b\u1ecb_l\u1ed7i_OOM\"><strong>D\u1ea5u hi\u1ec7u v\u00e0 nguy\u00ean nh\u00e2n khi\u1ebfn AI Agent b\u1ecb l\u1ed7i OOM<\/strong><\/h2>\n\n\n\n<h3 id=\"D\u1ea5u_hi\u1ec7u_nh\u1eadn_bi\u1ebft_l\u1ed7i_OOM\"><strong>D\u1ea5u hi\u1ec7u nh\u1eadn bi\u1ebft l\u1ed7i OOM<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Khi AI Agent g\u1eb7p s\u1ef1 c\u1ed1 li\u00ean quan \u0111\u1ebfn b\u1ed9 nh\u1edb, b\u1ea1n c\u00f3 th\u1ec3 nh\u1eadn th\u1ea5y:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>AI Agent \u0111ang x\u1eed l\u00fd c\u00f4ng vi\u1ec7c th\u00ec ng\u1eebng ph\u1ea3n h\u1ed3i.<\/li>\n\n\n\n<li>Dashboard ho\u1eb7c giao di\u1ec7n qu\u1ea3n l\u00fd \u0111\u1ed9t ng\u1ed9t m\u1ea5t k\u1ebft n\u1ed1i.<\/li>\n\n\n\n<li>VPS ph\u1ea3n h\u1ed3i ch\u1eadm, thao t\u00e1c SSH b\u1ecb gi\u00e1n \u0111o\u1ea1n.<\/li>\n\n\n\n<li>Container Docker t\u1ef1 d\u1eebng ho\u1eb7c li\u00ean t\u1ee5c kh\u1edfi \u0111\u1ed9ng l\u1ea1i.<\/li>\n\n\n\n<li>Nh\u1eadt k\u00fd h\u1ec7 th\u1ed1ng xu\u1ea5t hi\u1ec7n Out of memory, Killed process ho\u1eb7c oom-kill.<\/li>\n\n\n\n<li>Ti\u1ebfn tr\u00ecnh k\u1ebft th\u00fac v\u1edbi m\u00e3 137 ho\u1eb7c hi\u1ec3n th\u1ecb tr\u1ea1ng th\u00e1i OOMKilled.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>L\u01b0u \u00fd:<\/strong> Exit Code 137 cho bi\u1ebft ti\u1ebfn tr\u00ecnh b\u1ecb k\u1ebft th\u00fac b\u1eb1ng t\u00edn hi\u1ec7u SIGKILL. \u0110\u00e2y l\u00e0 d\u1ea5u hi\u1ec7u c\u1ea7n ki\u1ec3m tra, nh\u01b0ng ch\u01b0a \u0111\u1ee7 \u0111\u1ec3 kh\u1eb3ng \u0111\u1ecbnh nguy\u00ean nh\u00e2n ch\u1eafc ch\u1eafn l\u00e0 h\u1ebft RAM.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-2.png\" alt=\"D\u1ea5u hi\u1ec7u v\u00e0 nguy\u00ean nh\u00e2n khi\u1ebfn AI Agent b\u1ecb l\u1ed7i OOM\" class=\"wp-image-131203\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-2.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-2-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>D\u1ea5u hi\u1ec7u v\u00e0 nguy\u00ean nh\u00e2n khi\u1ebfn AI Agent b\u1ecb l\u1ed7i OOM<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 id=\"Nh\u1eefng_nguy\u00ean_nh\u00e2n_ph\u1ed5_bi\u1ebfn\"><strong>Nh\u1eefng nguy\u00ean nh\u00e2n ph\u1ed5 bi\u1ebfn<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">M\u1ed9t s\u1ed1 nguy\u00ean nh\u00e2n th\u01b0\u1eddng g\u1eb7p khi v\u1eadn h\u00e0nh AI Agent tr\u00ean VPS bao g\u1ed3m:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>RAM qu\u00e1 th\u1ea5p: T\u1ed5ng b\u1ed9 nh\u1edb kh\u00f4ng \u0111\u00e1p \u1ee9ng \u0111\u01b0\u1ee3c nhu c\u1ea7u c\u1ee7a AI Agent v\u00e0 nh\u1eefng d\u1ecbch v\u1ee5 ch\u1ea1y c\u00f9ng m\u00e1y ch\u1ee7.<\/li>\n\n\n\n<li>Nhi\u1ec1u t\u00e1c v\u1ee5 ch\u1ea1y \u0111\u1ed3ng th\u1eddi: C\u00e1c Agent, c\u00f4ng vi\u1ec7c t\u1ef1 \u0111\u1ed9ng ho\u1eb7c ti\u1ebfn tr\u00ecnh x\u1eed l\u00fd n\u1ec1n c\u00f9ng ti\u00eau th\u1ee5 RAM.<\/li>\n\n\n\n<li>X\u1eed l\u00fd d\u1eef li\u1ec7u l\u1edbn: AI Agent c\u1ea7n \u0111\u1ecdc t\u00e0i li\u1ec7u d\u00e0i, x\u1eed l\u00fd h\u00ecnh \u1ea3nh, s\u1eed d\u1ee5ng tr\u00ecnh duy\u1ec7t ho\u1eb7c th\u1ef1c hi\u1ec7n nhi\u1ec1u thao t\u00e1c li\u00ean ti\u1ebfp.<\/li>\n\n\n\n<li>Gi\u1edbi h\u1ea1n RAM trong Docker: Container ch\u1ec9 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng m\u1ed9t ph\u1ea7n b\u1ed9 nh\u1edb, th\u1ea5p h\u01a1n nhu c\u1ea7u th\u1ef1c t\u1ebf.<\/li>\n\n\n\n<li>Ch\u1ea1y m\u00f4 h\u00ecnh AI tr\u1ef1c ti\u1ebfp tr\u00ean VPS: Ollama ho\u1eb7c c\u00e1c c\u00f4ng c\u1ee5 suy lu\u1eadn AI c\u1ee5c b\u1ed9 c\u00f3 th\u1ec3 c\u1ea7n l\u01b0\u1ee3ng RAM \u0111\u00e1ng k\u1ec3 t\u00f9y m\u00f4 h\u00ecnh v\u00e0 c\u1ea5u h\u00ecnh.<\/li>\n\n\n\n<li>R\u00f2 r\u1ec9 b\u1ed9 nh\u1edb: \u1ee8ng d\u1ee5ng ho\u1eb7c th\u00e0nh ph\u1ea7n m\u1edf r\u1ed9ng ti\u1ebfp t\u1ee5c t\u0103ng m\u1ee9c s\u1eed d\u1ee5ng RAM trong th\u1eddi gian d\u00e0i m\u00e0 kh\u00f4ng gi\u1ea3i ph\u00f3ng t\u01b0\u01a1ng \u1ee9ng.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Ngo\u00e0i ra, n\u1ebfu VPS ch\u1ea1y \u0111\u1ed3ng th\u1eddi AI Agent, n8n, PostgreSQL, Redis ho\u1eb7c c\u00e1c \u1ee9ng d\u1ee5ng kh\u00e1c, t\u1ed5ng nhu c\u1ea7u RAM c\u00f3 th\u1ec3 v\u01b0\u1ee3t qu\u00e1 t\u00e0i nguy\u00ean s\u1eb5n c\u00f3.<\/p>\n\n\n\n<h2 id=\"H\u01b0\u1edbng_d\u1eabn_fix_l\u1ed7i_Out_of_Memory_khi_ch\u1ea1y_AI_Agent_tr\u00ean_VPS\"><strong>H\u01b0\u1edbng d\u1eabn fix l\u1ed7i Out of Memory khi ch\u1ea1y AI Agent tr\u00ean VPS<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ec3 kh\u1eafc ph\u1ee5c l\u1ed7i OOM, b\u1ea1n n\u00ean th\u1ef1c hi\u1ec7n theo th\u1ee9 t\u1ef1: <strong>ki\u1ec3m tra RAM \u2192 x\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh g\u00e2y l\u1ed7i \u2192 xem nh\u1eadt k\u00fd h\u1ec7 th\u1ed1ng \u2192 b\u1ed5 sung Swap ho\u1eb7c \u0111i\u1ec1u ch\u1ec9nh gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb \u2192 ki\u1ec3m tra l\u1ea1i AI Agent<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">H\u01b0\u1edbng d\u1eabn d\u01b0\u1edbi \u0111\u00e2y s\u1eed d\u1ee5ng VPS Ubuntu Linux v\u00e0 thao t\u00e1c th\u00f4ng qua SSH b\u1eb1ng Xshell ho\u1eb7c \u1ee9ng d\u1ee5ng Terminal t\u01b0\u01a1ng t\u1ef1. V\u1edbi Debian, nhi\u1ec1u c\u00e2u l\u1ec7nh c\u0169ng c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng tr\u1ef1c ti\u1ebfp.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>L\u01b0u \u00fd tr\u01b0\u1edbc khi b\u1eaft \u0111\u1ea7u: <\/strong>N\u1ebfu \u0111ang v\u1eadn h\u00e0nh AI Agent ph\u1ee5c v\u1ee5 c\u00f4ng vi\u1ec7c th\u1ef1c t\u1ebf, h\u00e3y sao l\u01b0u c\u1ea5u h\u00ecnh v\u00e0 d\u1eef li\u1ec7u quan tr\u1ecdng tr\u01b0\u1edbc khi thay \u0111\u1ed5i gi\u1edbi h\u1ea1n t\u00e0i nguy\u00ean ho\u1eb7c kh\u1edfi \u0111\u1ed9ng l\u1ea1i d\u1ecbch v\u1ee5.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_1:_Ki\u1ec3m_tra_dung_l\u01b0\u1ee3ng_RAM_v\u00e0_Swap\"><strong>B\u01b0\u1edbc 1: Ki\u1ec3m tra dung l\u01b0\u1ee3ng RAM v\u00e0 Swap<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Tr\u01b0\u1edbc ti\u00ean, \u0111\u0103ng nh\u1eadp VPS qua SSH v\u00e0 ch\u1ea1y l\u1ec7nh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>free -h<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">L\u1ec7nh n\u00e0y hi\u1ec3n th\u1ecb th\u00f4ng tin RAM v\u00e0 Swap hi\u1ec7n t\u1ea1i.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"858\" height=\"249\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_1-13.png\" alt=\"Ki\u1ec3m tra dung l\u01b0\u1ee3ng RAM v\u00e0 Swap\" class=\"wp-image-131169\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_1-13.png 858w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_1-13-300x87.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_1-13-768x223.png 768w\" sizes=\"(max-width: 858px) 100vw, 858px\" \/><figcaption class=\"wp-element-caption\"><strong>Ki\u1ec3m tra dung l\u01b0\u1ee3ng RAM v\u00e0 Swap<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Trong k\u1ebft qu\u1ea3, h\u00e3y ch\u00fa \u00fd:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Th\u00f4ng s\u1ed1<\/strong><\/td><td><strong>\u00dd ngh\u0129a<\/strong><\/td><\/tr><tr><td>total<\/td><td>T\u1ed5ng dung l\u01b0\u1ee3ng b\u1ed9 nh\u1edb<\/td><\/tr><tr><td>used<\/td><td>B\u1ed9 nh\u1edb \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng<\/td><\/tr><tr><td>free<\/td><td>B\u1ed9 nh\u1edb ch\u01b0a \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng<\/td><\/tr><tr><td>available<\/td><td>B\u1ed9 nh\u1edb \u01b0\u1edbc t\u00ednh c\u00f2n kh\u1ea3 d\u1ee5ng cho \u1ee9ng d\u1ee5ng<\/td><\/tr><tr><td>Swap<\/td><td>Dung l\u01b0\u1ee3ng b\u1ed9 nh\u1edb ho\u00e1n \u0111\u1ed5i<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Quan tr\u1ecdng: <\/strong>H\u00e3y ch\u00fa \u00fd c\u1ed9t <strong>available<\/strong> thay v\u00ec ch\u1ec9 d\u1ef1a v\u00e0o free, v\u00ec Linux s\u1eed d\u1ee5ng m\u1ed9t ph\u1ea7n RAM \u0111\u1ec3 l\u01b0u b\u1ed9 nh\u1edb \u0111\u1ec7m c\u00f3 th\u1ec3 thu h\u1ed3i.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">V\u00ed d\u1ee5, n\u1ebfu VPS c\u00f3 2 GB RAM v\u00e0 dung l\u01b0\u1ee3ng available li\u00ean t\u1ee5c gi\u1ea3m xu\u1ed1ng m\u1ee9c r\u1ea5t th\u1ea5p khi AI Agent ho\u1ea1t \u0111\u1ed9ng, \u0111\u00e2y c\u00f3 th\u1ec3 l\u00e0 d\u1ea5u hi\u1ec7u thi\u1ebfu b\u1ed9 nh\u1edb.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ec3 ki\u1ec3m tra ri\u00eang Swap, nh\u1eadp:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>swapon --show<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu k\u1ebft qu\u1ea3 kh\u00f4ng hi\u1ec3n th\u1ecb th\u00f4ng tin, h\u1ec7 th\u1ed1ng c\u00f3 th\u1ec3 ch\u01b0a k\u00edch ho\u1ea1t Swap.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_2:_X\u00e1c_\u0111\u1ecbnh_ti\u1ebfn_tr\u00ecnh_g\u00e2y_tr\u00e0n_RAM\"><strong>B\u01b0\u1edbc 2: X\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh g\u00e2y tr\u00e0n RAM<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ti\u1ebfp theo, s\u1eed d\u1ee5ng l\u1ec7nh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>top<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">H\u1ec7 th\u1ed1ng s\u1ebd hi\u1ec3n th\u1ecb danh s\u00e1ch ti\u1ebfn tr\u00ecnh \u0111ang ho\u1ea1t \u0111\u1ed9ng.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"606\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_2-12-1024x606.png\" alt=\"X\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh g\u00e2y tr\u00e0n RAM\" class=\"wp-image-131170\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_2-12-1024x606.png 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_2-12-300x178.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_2-12-767x454.png 767w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_2-12.png 1299w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>X\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh g\u00e2y tr\u00e0n RAM<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">B\u1ea1n c\u1ea7n quan s\u00e1t hai c\u1ed9t:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>%MEM:<\/strong> T\u1ef7 l\u1ec7 RAM \u0111\u01b0\u1ee3c ti\u1ebfn tr\u00ecnh s\u1eed d\u1ee5ng.<\/li>\n\n\n\n<li><strong>RES: <\/strong>Dung l\u01b0\u1ee3ng b\u1ed9 nh\u1edb v\u1eadt l\u00fd m\u00e0 ti\u1ebfn tr\u00ecnh \u0111ang chi\u1ebfm gi\u1eef.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Nh\u1ea5n <strong>ph\u00edm q <\/strong>\u0111\u1ec3 tho\u00e1t.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ngo\u00e0i ra, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng l\u1ec7nh sau \u0111\u1ec3 hi\u1ec3n th\u1ecb nhanh 10 ti\u1ebfn tr\u00ecnh s\u1eed d\u1ee5ng nhi\u1ec1u RAM nh\u1ea5t:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ps aux --sort=-%mem | head -n 11<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu danh s\u00e1ch xu\u1ea5t hi\u1ec7n nh\u1eefng ti\u1ebfn tr\u00ecnh nh\u01b0 node, python, chrome ho\u1eb7c ollama, h\u00e3y ki\u1ec3m tra xem ti\u1ebfn tr\u00ecnh n\u00e0o thu\u1ed9c AI Agent v\u00e0 c\u00f3 \u0111ang ti\u00eau th\u1ee5 b\u1ed9 nh\u1edb b\u1ea5t th\u01b0\u1eddng hay kh\u00f4ng.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"147\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_3-9-1024x147.png\" alt=\"X\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh g\u00e2y tr\u00e0n RAM\" class=\"wp-image-131171\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_3-9-1024x147.png 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_3-9-300x43.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_3-9-768x110.png 768w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_3-9-1536x220.png 1536w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_3-9.png 1807w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>X\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh g\u00e2y tr\u00e0n RAM<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Kh\u00f4ng n\u00ean k\u1ebft th\u00fac ti\u1ebfn tr\u00ecnh ch\u1ec9 d\u1ef1a v\u00e0o t\u00ean ho\u1eb7c t\u1ef7 l\u1ec7 RAM cao. M\u1ed9t s\u1ed1 ti\u1ebfn tr\u00ecnh c\u00f3 th\u1ec3 \u0111ang th\u1ef1c hi\u1ec7n c\u00f4ng vi\u1ec7c c\u1ea7n thi\u1ebft cho h\u1ec7 th\u1ed1ng.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_3:_Ki\u1ec3m_tra_nh\u1eadt_k\u00fd_OOM_tr\u00ean_VPS\"><strong>B\u01b0\u1edbc 3: Ki\u1ec3m tra nh\u1eadt k\u00fd OOM tr\u00ean VPS<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u00e2y l\u00e0 b\u01b0\u1edbc quan tr\u1ecdng \u0111\u1ec3 x\u00e1c \u0111\u1ecbnh VPS c\u00f3 th\u1ef1c s\u1ef1 g\u1eb7p l\u1ed7i Out of Memory hay kh\u00f4ng.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nh\u1eadp l\u1ec7nh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo journalctl -k --since \"24 hours ago\" --no-pager | grep -Ei 'out of memory|oom-kill|killed process'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">L\u1ec7nh s\u1ebd t\u00ecm nh\u1eefng th\u00f4ng b\u00e1o li\u00ean quan \u0111\u1ebfn OOM trong nh\u1eadt k\u00fd kernel c\u1ee7a 24 gi\u1edd g\u1ea7n nh\u1ea5t.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">V\u00ed d\u1ee5, n\u1ebfu xu\u1ea5t hi\u1ec7n th\u00f4ng b\u00e1o d\u1ea1ng:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Out of memory: Killed process 1234 (node)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110i\u1ec1u n\u00e0y cho bi\u1ebft kernel \u0111\u00e3 k\u1ebft th\u00fac m\u1ed9t ti\u1ebfn tr\u00ecnh Node.js \u0111\u1ec3 gi\u1ea3i ph\u00f3ng b\u1ed9 nh\u1edb.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu kh\u00f4ng t\u00ecm th\u1ea5y th\u00f4ng b\u00e1o, b\u1ea1n c\u00f3 th\u1ec3 th\u1eed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dmesg -T | grep -Ei 'out of memory|oom-kill|killed process'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Tr\u01b0\u1eddng h\u1ee3p VPS v\u1eeba kh\u1edfi \u0111\u1ed9ng l\u1ea1i, c\u00f3 th\u1ec3 ki\u1ec3m tra nh\u1eadt k\u00fd l\u1ea7n kh\u1edfi \u0111\u1ed9ng tr\u01b0\u1edbc b\u1eb1ng:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo journalctl -k -b -1 --no-pager | grep -Ei 'out of memory|oom-kill|killed process'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">L\u1ec7nh cu\u1ed1i ch\u1ec9 c\u00f3 t\u00e1c d\u1ee5ng khi nh\u1eadt k\u00fd c\u1ee7a l\u1ea7n kh\u1edfi \u0111\u1ed9ng tr\u01b0\u1edbc c\u00f2n \u0111\u01b0\u1ee3c l\u01b0u.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>L\u01b0u \u00fd: <\/strong>Kh\u00f4ng t\u00ecm th\u1ea5y th\u00f4ng b\u00e1o ch\u01b0a \u0111\u1ee7 \u0111\u1ec3 lo\u1ea1i tr\u1eeb l\u1ed7i OOM. B\u1ea1n v\u1eabn c\u1ea7n ki\u1ec3m tra gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb trong Docker ho\u1eb7c nh\u1eadt k\u00fd ri\u00eang c\u1ee7a \u1ee9ng d\u1ee5ng.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_4:_T\u1ea1o_th\u00eam_Swap_cho_VPS\"><strong>B\u01b0\u1edbc 4: T\u1ea1o th\u00eam Swap cho VPS<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Swap l\u00e0 m\u1ed9t v\u00f9ng l\u01b0u tr\u1eef tr\u00ean \u1ed5 \u0111\u0129a \u0111\u01b0\u1ee3c Linux s\u1eed d\u1ee5ng \u0111\u1ec3 h\u1ed7 tr\u1ee3 qu\u1ea3n l\u00fd b\u1ed9 nh\u1edb khi RAM ch\u1ecbu \u00e1p l\u1ef1c. B\u1ed5 sung Swap c\u00f3 th\u1ec3 gi\u00fap gi\u1ea3m nguy c\u01a1 ti\u1ebfn tr\u00ecnh b\u1ecb k\u1ebft th\u00fac do thi\u1ebfu b\u1ed9 nh\u1edb trong m\u1ed9t s\u1ed1 tr\u01b0\u1eddng h\u1ee3p.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">V\u00ed d\u1ee5 d\u01b0\u1edbi \u0111\u00e2y h\u01b0\u1edbng d\u1eabn t\u1ea1o Swap 2 GB tr\u00ean VPS Ubuntu s\u1eed d\u1ee5ng h\u1ec7 th\u1ed1ng t\u1ec7p th\u00f4ng d\u1ee5ng nh\u01b0 ext4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ch\u1ec9 th\u1ef1c hi\u1ec7n khi VPS c\u00f2n \u0111\u1ee7 dung l\u01b0\u1ee3ng \u1ed5 \u0111\u0129a v\u00e0 ch\u01b0a c\u00f3 Swap ph\u00f9 h\u1ee3p. C\u00e1c h\u1ec7 th\u1ed1ng t\u1ec7p nh\u01b0 Btrfs, ZFS ho\u1eb7c VPS d\u00f9ng c\u01a1 ch\u1ebf qu\u1ea3n l\u00fd b\u1ed9 nh\u1edb \u0111\u1eb7c bi\u1ec7t c\u00f3 th\u1ec3 c\u1ea7n quy tr\u00ecnh ri\u00eang.<\/p>\n\n\n\n<h4 id=\"1._Ki\u1ec3m_tra_dung_l\u01b0\u1ee3ng_\u1ed5_\u0111\u0129a\"><strong>1. Ki\u1ec3m tra dung l\u01b0\u1ee3ng \u1ed5 \u0111\u0129a<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df -h \/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ea3m b\u1ea3o ph\u00e2n v\u00f9ng c\u00f2n \u0111\u1ee7 dung l\u01b0\u1ee3ng \u0111\u1ec3 t\u1ea1o t\u1ec7p Swap 2 GB v\u00e0 v\u1eabn c\u00f3 kh\u00f4ng gian cho h\u1ec7 \u0111i\u1ec1u h\u00e0nh.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"120\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_4-10-1024x120.png\" alt=\"T\u1ea1o th\u00eam Swap cho VPS\" class=\"wp-image-131172\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_4-10-1024x120.png 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_4-10-300x35.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_4-10-768x90.png 768w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_4-10.png 1224w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>T\u1ea1o th\u00eam Swap cho VPS<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Ki\u1ec3m tra xem t\u00ean t\u1ec7p d\u1ef1 ki\u1ebfn \u0111\u00e3 t\u1ed3n t\u1ea1i hay ch\u01b0a:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls -lh \/swapfile-ai<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu h\u1ec7 th\u1ed1ng b\u00e1o kh\u00f4ng t\u00ecm th\u1ea5y t\u1ec7p, b\u1ea1n c\u00f3 th\u1ec3 ti\u1ebfp t\u1ee5c.<\/p>\n\n\n\n<h4 id=\"2._T\u1ea1o_t\u1ec7p_Swap_2_GB\"><strong>2. T\u1ea1o t\u1ec7p Swap 2 GB<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dd if=\/dev\/zero of=\/swapfile-ai bs=1M count=2048 status=progress<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ch\u1edd qu\u00e1 tr\u00ecnh ghi ho\u00e0n t\u1ea5t. Kh\u00f4ng ch\u1ea1y l\u1ea1i l\u1ec7nh t\u1ea1o t\u1ec7p khi \/swapfile-ai \u0111\u00e3 t\u1ed3n t\u1ea1i.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"945\" height=\"128\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_5-15.png\" alt=\"T\u1ea1o t\u1ec7p Swap 2 GB\" class=\"wp-image-131173\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_5-15.png 945w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_5-15-300x41.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_5-15-768x104.png 768w\" sizes=\"(max-width: 945px) 100vw, 945px\" \/><figcaption class=\"wp-element-caption\"><strong>T\u1ea1o t\u1ec7p Swap 2 GB<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h4 id=\"3._Thi\u1ebft_l\u1eadp_quy\u1ec1n_truy_c\u1eadp\"><strong>3. Thi\u1ebft l\u1eadp quy\u1ec1n truy c\u1eadp<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod 600 \/swapfile-ai<\/code><\/pre>\n\n\n\n<h4 id=\"4._\u0110\u1ecbnh_d\u1ea1ng_t\u1ec7p_th\u00e0nh_Swap\"><strong>4. \u0110\u1ecbnh d\u1ea1ng t\u1ec7p th\u00e0nh Swap<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkswap \/swapfile-ai<\/code><\/pre>\n\n\n\n<h4 id=\"5._K\u00edch_ho\u1ea1t_Swap\"><strong>5. K\u00edch ho\u1ea1t Swap<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo swapon \/swapfile-ai<\/code><\/pre>\n\n\n\n<h4 id=\"6._Ki\u1ec3m_tra_k\u1ebft_qu\u1ea3\"><strong>6. Ki\u1ec3m tra k\u1ebft qu\u1ea3<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">free -h<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu th\u1ef1c hi\u1ec7n th\u00e0nh c\u00f4ng, dung l\u01b0\u1ee3ng Swap c\u1ee7a h\u1ec7 th\u1ed1ng s\u1ebd t\u0103ng th\u00eam kho\u1ea3ng 2 GB.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"888\" height=\"200\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_6-13.png\" alt=\"T\u1ea1o t\u1ec7p Swap 2 GB\" class=\"wp-image-131174\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_6-13.png 888w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_6-13-300x68.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_6-13-768x173.png 768w\" sizes=\"(max-width: 888px) 100vw, 888px\" \/><figcaption class=\"wp-element-caption\"><strong>T\u1ea1o t\u1ec7p Swap 2 GB<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h4 id=\"7._Thi\u1ebft_l\u1eadp_Swap_t\u1ef1_k\u00edch_ho\u1ea1t_khi_VPS_kh\u1edfi_\u0111\u1ed9ng\"><strong>7. Thi\u1ebft l\u1eadp Swap t\u1ef1 k\u00edch ho\u1ea1t khi VPS kh\u1edfi \u0111\u1ed9ng<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tr\u01b0\u1edbc ti\u00ean, sao l\u01b0u c\u1ea5u h\u00ecnh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp \/etc\/fstab \/etc\/fstab.bak-oom<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sau \u0111\u00f3, th\u00eam c\u1ea5u h\u00ecnh Swap:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo '\/swapfile-ai none swap sw 0 0' | sudo tee -a \/etc\/fstab<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ch\u1ec9 th\u00eam d\u00f2ng c\u1ea5u h\u00ecnh m\u1ed9t l\u1ea7n, tr\u00e1nh t\u1ea1o c\u00e1c m\u1ee5c tr\u00f9ng l\u1eb7p.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>L\u01b0u \u00fd quan tr\u1ecdng:<\/strong> Swap kh\u00f4ng ph\u1ea3i RAM v\u1eadt l\u00fd. Vi\u1ec7c \u0111\u1ecdc v\u00e0 ghi tr\u00ean \u1ed5 \u0111\u0129a th\u01b0\u1eddng ch\u1eadm h\u01a1n RAM, v\u00ec v\u1eady b\u1ed5 sung Swap ch\u1ec9 l\u00e0 gi\u1ea3i ph\u00e1p h\u1ed7 tr\u1ee3. N\u1ebfu AI Agent li\u00ean t\u1ee5c s\u1eed d\u1ee5ng l\u01b0\u1ee3ng l\u1edbn Swap, hi\u1ec7u su\u1ea5t c\u00f3 th\u1ec3 gi\u1ea3m \u0111\u00e1ng k\u1ec3.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_5:_X\u1eed_l\u00fd_gi\u1edbi_h\u1ea1n_RAM_n\u1ebfu_ch\u1ea1y_AI_Agent_b\u1eb1ng_Docker\"><strong>B\u01b0\u1edbc 5: X\u1eed l\u00fd gi\u1edbi h\u1ea1n RAM n\u1ebfu ch\u1ea1y AI Agent b\u1eb1ng Docker<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu AI Agent \u0111\u01b0\u1ee3c tri\u1ec3n khai b\u1eb1ng Docker, b\u1ea1n c\u1ea7n ki\u1ec3m tra gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb c\u1ee7a container, b\u1edfi VPS c\u00f2n RAM kh\u00f4ng \u0111\u1ed3ng ngh\u0129a container v\u1eabn c\u00f2n t\u00e0i nguy\u00ean \u0111\u01b0\u1ee3c ph\u00e9p s\u1eed d\u1ee5ng.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tr\u01b0\u1edbc ti\u00ean, li\u1ec7t k\u00ea container:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker ps -a<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">X\u00e1c \u0111\u1ecbnh t\u00ean container \u0111ang ch\u1ea1y AI Agent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ti\u1ebfp theo, ki\u1ec3m tra t\u00e0i nguy\u00ean:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker stats --no-stream<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Trong k\u1ebft qu\u1ea3, c\u1ed9t <strong>MEM USAGE \/ LIMIT<\/strong> hi\u1ec3n th\u1ecb b\u1ed9 nh\u1edb container \u0111ang s\u1eed d\u1ee5ng v\u00e0 gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb t\u01b0\u01a1ng \u1ee9ng.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"176\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_7-12-1024x176.png\" alt=\"X\u1eed l\u00fd gi\u1edbi h\u1ea1n RAM n\u1ebfu ch\u1ea1y AI Agent b\u1eb1ng Docker\" class=\"wp-image-131175\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_7-12-1024x176.png 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_7-12-300x52.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_7-12-768x132.png 768w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_7-12.png 1471w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>X\u1eed l\u00fd gi\u1edbi h\u1ea1n RAM n\u1ebfu ch\u1ea1y AI Agent b\u1eb1ng Docker<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">B\u1ea1n c\u00f3 th\u1ec3 ki\u1ec3m tra th\u00f4ng tin OOM b\u1eb1ng l\u1ec7nh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker inspect --format '{{.State.OOMKilled}}' TEN_CONTAINER<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Thay <strong>TEN_CONTAINER<\/strong> b\u1eb1ng t\u00ean th\u1ef1c t\u1ebf.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>true: <\/strong>Docker ghi nh\u1eadn container b\u1ecb k\u1ebft th\u00fac do OOM.<\/li>\n\n\n\n<li><strong>false: <\/strong>Tr\u1ea1ng th\u00e1i hi\u1ec7n t\u1ea1i kh\u00f4ng ghi nh\u1eadn OOM; v\u1eabn c\u1ea7n xem nh\u1eadt k\u00fd n\u1ebfu container \u0111\u00e3 \u0111\u01b0\u1ee3c kh\u1edfi \u0111\u1ed9ng l\u1ea1i.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"188\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_8-10-1024x188.png\" alt=\"X\u1eed l\u00fd gi\u1edbi h\u1ea1n RAM n\u1ebfu ch\u1ea1y AI Agent b\u1eb1ng Docker\" class=\"wp-image-131176\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_8-10-1024x188.png 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_8-10-300x55.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_8-10-768x141.png 768w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_8-10.png 1436w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>X\u1eed l\u00fd gi\u1edbi h\u1ea1n RAM n\u1ebfu ch\u1ea1y AI Agent b\u1eb1ng Docker<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ec3 xem gi\u1edbi h\u1ea1n RAM \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker inspect --format '{{.HostConfig.Memory}}' TEN_CONTAINER<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Gi\u00e1 tr\u1ecb \u0111\u01b0\u1ee3c tr\u1ea3 v\u1ec1 theo byte. Gi\u00e1 tr\u1ecb <strong>0<\/strong> th\u01b0\u1eddng c\u00f3 ngh\u0129a container kh\u00f4ng \u0111\u01b0\u1ee3c thi\u1ebft l\u1eadp gi\u1edbi h\u1ea1n RAM ri\u00eang b\u1eb1ng t\u00f9y ch\u1ecdn Docker t\u01b0\u01a1ng \u1ee9ng.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"926\" height=\"147\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_9-10.png\" alt=\"X\u1eed l\u00fd gi\u1edbi h\u1ea1n RAM n\u1ebfu ch\u1ea1y AI Agent b\u1eb1ng Docker\" class=\"wp-image-131177\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_9-10.png 926w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_9-10-300x48.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/Screenshot_9-10-768x122.png 768w\" sizes=\"(max-width: 926px) 100vw, 926px\" \/><figcaption class=\"wp-element-caption\"><strong>X\u1eed l\u00fd gi\u1edbi h\u1ea1n RAM n\u1ebfu ch\u1ea1y AI Agent b\u1eb1ng Docker<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>N\u1ebfu container b\u1ecb gi\u1edbi h\u1ea1n RAM qu\u00e1 th\u1ea5p th\u00ec x\u1eed l\u00fd th\u1ebf n\u00e0o?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">B\u1ea1n c\u00f3 th\u1ec3 t\u0103ng gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb, nh\u01b0ng ch\u1ec9 khi VPS c\u00f3 \u0111\u1ee7 t\u00e0i nguy\u00ean \u0111\u1ec3 c\u1ea5p ph\u00e1t th\u00eam.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">V\u00ed d\u1ee5, v\u1edbi m\u1ed9t VPS 4 GB RAM c\u00f3 \u0111\u1ee7 dung l\u01b0\u1ee3ng kh\u1ea3 d\u1ee5ng, l\u1ec7nh sau minh h\u1ecda c\u00e1ch \u0111\u1eb7t gi\u1edbi h\u1ea1n RAM container th\u00e0nh 2 GB, t\u1ed5ng RAM v\u00e0 Swap th\u00e0nh 3 GB:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker update --memory 2g --memory-swap 3g TEN_CONTAINER<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u00e2y ch\u1ec9 l\u00e0 v\u00ed d\u1ee5 c\u1ea5u h\u00ecnh, kh\u00f4ng ph\u1ea3i th\u00f4ng s\u1ed1 ph\u00f9 h\u1ee3p cho m\u1ecdi VPS. C\u1ea7n t\u00ednh c\u1ea3 b\u1ed9 nh\u1edb c\u1ee7a h\u1ec7 \u0111i\u1ec1u h\u00e0nh v\u00e0 c\u00e1c d\u1ecbch v\u1ee5 kh\u00e1c. N\u1ebfu \u1ee9ng d\u1ee5ng \u0111\u01b0\u1ee3c qu\u1ea3n l\u00fd b\u1eb1ng Docker Compose, h\u00e3y \u0111\u1ed3ng b\u1ed9 thay \u0111\u1ed5i trong t\u1ec7p Compose \u0111\u1ec3 tr\u00e1nh m\u1ea5t c\u1ea5u h\u00ecnh khi t\u1ea1o l\u1ea1i container.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">V\u1edbi Docker Compose, thu\u1ed9c t\u00ednh <strong>mem_limit<\/strong> c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng trong c\u1ea5u h\u00ecnh c\u1ee7a service. Ch\u1eb3ng h\u1ea1n:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n\n&nbsp;&nbsp;ai-agent:\n\n&nbsp;&nbsp;&nbsp;&nbsp;mem_limit: 2g<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>\u0110o\u1ea1n YAML tr\u00ean ch\u1ec9 minh h\u1ecda ph\u1ea7n c\u1ea5u h\u00ecnh b\u1ed9 nh\u1edb. Kh\u00f4ng thay th\u1ebf to\u00e0n b\u1ed9 t\u1ec7p compose.yaml b\u1eb1ng v\u00ed d\u1ee5 n\u00e0y.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sau khi ch\u1ec9nh s\u1eeda c\u1ea5u h\u00ecnh Compose th\u1ef1c t\u1ebf, ki\u1ec3m tra c\u00fa ph\u00e1p b\u1eb1ng:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose config<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu h\u1ee3p l\u1ec7, th\u1ef1c hi\u1ec7n c\u1eadp nh\u1eadt trong th\u01b0 m\u1ee5c d\u1ef1 \u00e1n:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose up -d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">L\u1ec7nh c\u00f3 th\u1ec3 t\u1ea1o l\u1ea1i container, v\u00ec v\u1eady c\u1ea7n sao l\u01b0u c\u1ea5u h\u00ecnh v\u00e0 d\u1eef li\u1ec7u li\u00ean quan tr\u01b0\u1edbc khi tri\u1ec3n khai.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu \u0111ang s\u1eed d\u1ee5ng VPS AI Agent c\u00f3 s\u1eb5n giao di\u1ec7n qu\u1ea3n l\u00fd do nh\u00e0 cung c\u1ea5p tri\u1ec3n khai, b\u1ea1n n\u00ean ki\u1ec3m tra c\u01a1 ch\u1ebf qu\u1ea3n l\u00fd Docker tr\u01b0\u1edbc khi t\u1ef1 \u00fd thay \u0111\u1ed5i gi\u1edbi h\u1ea1n container.<\/p>\n\n\n\n<h3 id=\"B\u01b0\u1edbc_6:_Ki\u1ec3m_tra_l\u1ea1i_ho\u1ea1t_\u0111\u1ed9ng_c\u1ee7a_AI_Agent\"><strong>B\u01b0\u1edbc 6: Ki\u1ec3m tra l\u1ea1i ho\u1ea1t \u0111\u1ed9ng c\u1ee7a AI Agent<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sau khi \u00e1p d\u1ee5ng gi\u1ea3i ph\u00e1p ph\u00f9 h\u1ee3p, h\u00e3y ki\u1ec3m tra l\u1ea1i h\u1ec7 th\u1ed1ng b\u1eb1ng c\u00e1c thao t\u00e1c sau:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ki\u1ec3m tra RAM v\u00e0 Swap:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>free -h<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ki\u1ec3m tra ti\u1ebfn tr\u00ecnh s\u1eed d\u1ee5ng b\u1ed9 nh\u1edb:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>top<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu s\u1eed d\u1ee5ng Docker:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker stats --no-stream<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu c\u00e0i \u0111\u1eb7t OpenClaw b\u1eb1ng d\u1ecbch v\u1ee5 systemd user ti\u00eau chu\u1ea9n, b\u1ea1n c\u00f3 th\u1ec3 ki\u1ec3m tra th\u00eam:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl --user status openclaw-gateway.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">L\u1ec7nh n\u00e0y c\u1ea7n ch\u1ea1y b\u1eb1ng \u0111\u00fang t\u00e0i kho\u1ea3n Linux s\u1edf h\u1eefu d\u1ecbch v\u1ee5 OpenClaw. C\u00e1ch c\u00e0i \u0111\u1eb7t kh\u00e1c c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng t\u00ean ho\u1eb7c ph\u01b0\u01a1ng th\u1ee9c qu\u1ea3n l\u00fd d\u1ecbch v\u1ee5 kh\u00e1c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Cu\u1ed1i c\u00f9ng, h\u00e3y g\u1eedi m\u1ed9t y\u00eau c\u1ea7u \u0111\u01a1n gi\u1ea3n cho AI Agent, sau \u0111\u00f3 ch\u1ea1y l\u1ea1i m\u1ed9t t\u00e1c v\u1ee5 t\u1eebng g\u1eb7p l\u1ed7i.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu AI Agent ph\u1ea3n h\u1ed3i b\u00ecnh th\u01b0\u1eddng, b\u1ed9 nh\u1edb kh\u00f4ng ti\u1ebfp t\u1ee5c t\u0103ng b\u1ea5t th\u01b0\u1eddng v\u00e0 kh\u00f4ng xu\u1ea5t hi\u1ec7n th\u00eam s\u1ef1 ki\u1ec7n OOM trong qu\u00e1 tr\u00ecnh theo d\u00f5i, gi\u1ea3i ph\u00e1p c\u00f3 th\u1ec3 \u0111\u00e3 ph\u00e1t huy hi\u1ec7u qu\u1ea3.<\/p>\n\n\n\n<h2 id=\"C\u00e1ch_h\u1ea1n_ch\u1ebf_l\u1ed7i_OOM_khi_v\u1eadn_h\u00e0nh_AI_Agent\"><strong>C\u00e1ch h\u1ea1n ch\u1ebf l\u1ed7i OOM khi v\u1eadn h\u00e0nh AI Agent<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ngo\u00e0i x\u1eed l\u00fd s\u1ef1 c\u1ed1, b\u1ea1n n\u00ean \u00e1p d\u1ee5ng m\u1ed9t s\u1ed1 bi\u1ec7n ph\u00e1p nh\u1eb1m gi\u1ea3m nguy c\u01a1 tr\u00e0n RAM trong qu\u00e1 tr\u00ecnh s\u1eed d\u1ee5ng l\u00e2u d\u00e0i.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gi\u1edbi h\u1ea1n s\u1ed1 t\u00e1c v\u1ee5 \u0111\u1ed3ng th\u1eddi: Tr\u00e1nh ch\u1ea1y qu\u00e1 nhi\u1ec1u AI Agent, sub-agent ho\u1eb7c c\u00f4ng vi\u1ec7c t\u1ef1 \u0111\u1ed9ng c\u00f9ng l\u00fac tr\u00ean VPS nh\u1ecf.<\/li>\n\n\n\n<li>Ph\u00e2n chia c\u00f4ng vi\u1ec7c h\u1ee3p l\u00fd: V\u1edbi t\u00e1c v\u1ee5 x\u1eed l\u00fd d\u1eef li\u1ec7u l\u1edbn, n\u00ean chia th\u00e0nh nh\u1eefng ph\u1ea7n nh\u1ecf thay v\u00ec th\u1ef1c hi\u1ec7n to\u00e0n b\u1ed9 trong m\u1ed9t l\u1ea7n.<\/li>\n\n\n\n<li>H\u1ea1n ch\u1ebf d\u1ecbch v\u1ee5 kh\u00f4ng c\u1ea7n thi\u1ebft: Ki\u1ec3m tra c\u00e1c container, tr\u00ecnh duy\u1ec7t, c\u00f4ng c\u1ee5 x\u1eed l\u00fd n\u1ec1n ho\u1eb7c d\u1ecbch v\u1ee5 ph\u1ee5 \u0111ang chi\u1ebfm RAM.<\/li>\n\n\n\n<li>Theo d\u00f5i b\u1ed9 nh\u1edb \u0111\u1ecbnh k\u1ef3: S\u1eed d\u1ee5ng free, top, docker stats ho\u1eb7c h\u1ec7 th\u1ed1ng gi\u00e1m s\u00e1t m\u00e1y ch\u1ee7 \u0111\u1ec3 ph\u00e1t hi\u1ec7n m\u1ee9c ti\u00eau th\u1ee5 b\u1ea5t th\u01b0\u1eddng.<\/li>\n\n\n\n<li>Ki\u1ec3m tra Plugin v\u00e0 Skill: Nh\u1eefng th\u00e0nh ph\u1ea7n m\u1edf r\u1ed9ng ch\u1ea1y th\u00eam ti\u1ebfn tr\u00ecnh ho\u1eb7c tr\u00ecnh duy\u1ec7t c\u00f3 th\u1ec3 l\u00e0m t\u0103ng nhu c\u1ea7u RAM.<\/li>\n\n\n\n<li>S\u1eed d\u1ee5ng m\u00f4 h\u00ecnh AI qua API khi ph\u00f9 h\u1ee3p: N\u1ebfu VPS ch\u1ec9 c\u1ea7n v\u1eadn h\u00e0nh AI Agent, vi\u1ec7c s\u1eed d\u1ee5ng m\u00f4 h\u00ecnh t\u1eeb nh\u00e0 cung c\u1ea5p b\u00ean ngo\u00e0i c\u00f3 th\u1ec3 tr\u00e1nh ph\u1ea3i l\u01b0u v\u00e0 ch\u1ea1y to\u00e0n b\u1ed9 m\u00f4 h\u00ecnh ng\u00f4n ng\u1eef tr\u1ef1c ti\u1ebfp tr\u00ean m\u00e1y ch\u1ee7.<\/li>\n\n\n\n<li>C\u1eadp nh\u1eadt \u1ee9ng d\u1ee5ng c\u00f3 ki\u1ec3m so\u00e1t: Theo d\u00f5i c\u00e1c b\u1ea3n s\u1eeda l\u1ed7i hi\u1ec7u n\u0103ng ho\u1eb7c b\u1ed9 nh\u1edb, sao l\u01b0u tr\u01b0\u1edbc khi n\u00e2ng c\u1ea5p v\u00e0 ki\u1ec3m tra t\u01b0\u01a1ng th\u00edch.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ed1i v\u1edbi OpenClaw, t\u00e0i li\u1ec7u ch\u00ednh th\u1ee9c c\u0169ng \u0111\u1ec1 c\u1eadp vi\u1ec7c gi\u1ea3m t\u00e1c v\u1ee5 \u0111\u1ed3ng th\u1eddi, t\u0103ng gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb ho\u1eb7c s\u1eed d\u1ee5ng c\u01a1 ch\u1ebf ki\u1ec3m so\u00e1t t\u00e0i nguy\u00ean khi VPS li\u00ean t\u1ee5c g\u1eb7p OOM.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Kh\u00f4ng n\u00ean t\u1eaft OOM Killer \u0111\u1ec3 x\u1eed l\u00fd thi\u1ebfu RAM. Docker c\u1ea3nh b\u00e1o r\u1eb1ng vi\u1ec7c v\u00f4 hi\u1ec7u h\u00f3a c\u01a1 ch\u1ebf b\u1ea3o v\u1ec7 khi t\u00e0i nguy\u00ean kh\u00f4ng \u0111\u01b0\u1ee3c ki\u1ec3m so\u00e1t \u0111\u00fang c\u00e1ch c\u00f3 th\u1ec3 khi\u1ebfn to\u00e0n b\u1ed9 m\u00e1y ch\u1ee7 g\u1eb7p s\u1ef1 c\u1ed1 nghi\u00eam tr\u1ecdng.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-3.png\" alt=\"C\u00e1ch h\u1ea1n ch\u1ebf l\u1ed7i OOM khi v\u1eadn h\u00e0nh AI Agent\" class=\"wp-image-131204\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-3.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/fix-loi-out-of-memory-3-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>C\u00e1ch h\u1ea1n ch\u1ebf l\u1ed7i OOM khi v\u1eadn h\u00e0nh AI Agent<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 id=\"Khi_n\u00e0o_c\u1ea7n_n\u00e2ng_c\u1ea5p_RAM_VPS?\"><strong>Khi n\u00e0o c\u1ea7n n\u00e2ng c\u1ea5p RAM VPS?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">B\u1ea1n n\u00ean c\u00e2n nh\u1eafc n\u00e2ng c\u1ea5p RAM khi c\u00e1c gi\u1ea3i ph\u00e1p gi\u1ea3m t\u1ea3i, c\u1ea5u h\u00ecnh l\u1ea1i gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb v\u00e0 b\u1ed5 sung Swap kh\u00f4ng c\u00f2n \u0111\u00e1p \u1ee9ng \u0111\u01b0\u1ee3c nhu c\u1ea7u v\u1eadn h\u00e0nh.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">M\u1ed9t s\u1ed1 d\u1ea5u hi\u1ec7u \u0111\u00e1ng ch\u00fa \u00fd:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>RAM kh\u1ea3 d\u1ee5ng li\u00ean t\u1ee5c \u1edf m\u1ee9c r\u1ea5t th\u1ea5p trong gi\u1edd ho\u1ea1t \u0111\u1ed9ng b\u00ecnh th\u01b0\u1eddng.<\/li>\n\n\n\n<li>AI Agent th\u01b0\u1eddng xuy\u00ean g\u1eb7p OOM khi th\u1ef1c hi\u1ec7n c\u00e1c t\u00e1c v\u1ee5 c\u1ea7n thi\u1ebft.<\/li>\n\n\n\n<li>H\u1ec7 th\u1ed1ng s\u1eed d\u1ee5ng Swap nhi\u1ec1u, k\u00e9o theo t\u1ed1c \u0111\u1ed9 x\u1eed l\u00fd ch\u1eadm.<\/li>\n\n\n\n<li>VPS ch\u1ea1y nhi\u1ec1u \u1ee9ng d\u1ee5ng c\u00f9ng l\u00fac v\u00e0 kh\u00f4ng th\u1ec3 gi\u1ea3m th\u00eam s\u1ed1 ti\u1ebfn tr\u00ecnh.<\/li>\n\n\n\n<li>Nhu c\u1ea7u s\u1eed d\u1ee5ng m\u00f4 h\u00ecnh AI c\u1ee5c b\u1ed9, nhi\u1ec1u Agent ho\u1eb7c c\u00e1c c\u00f4ng c\u1ee5 x\u1eed l\u00fd d\u1eef li\u1ec7u ng\u00e0y c\u00e0ng t\u0103ng.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Kh\u00f4ng c\u00f3 m\u1ed9t m\u1ee9c RAM c\u1ed1 \u0111\u1ecbnh ph\u00f9 h\u1ee3p v\u1edbi m\u1ecdi AI Agent. C\u1ea5u h\u00ecnh c\u1ea7n thi\u1ebft ph\u1ee5 thu\u1ed9c v\u00e0o n\u1ec1n t\u1ea3ng, s\u1ed1 l\u01b0\u1ee3ng t\u00e1c v\u1ee5 \u0111\u1ed3ng th\u1eddi, th\u00e0nh ph\u1ea7n m\u1edf r\u1ed9ng, m\u00f4 h\u00ecnh AI v\u00e0 c\u00e1c d\u1ecbch v\u1ee5 ch\u1ea1y c\u00f9ng VPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do \u0111\u00f3, n\u00ean l\u1ef1a ch\u1ecdn dung l\u01b0\u1ee3ng RAM d\u1ef1a tr\u00ean m\u1ee9c s\u1eed d\u1ee5ng th\u1ef1c t\u1ebf v\u00e0 nhu c\u1ea7u m\u1edf r\u1ed9ng, thay v\u00ec n\u00e2ng c\u1ea5p ch\u1ec9 v\u00ec th\u1ea5y ch\u1ec9 s\u1ed1 RAM \u0111\u00e3 d\u00f9ng \u1edf m\u1ee9c cao t\u1ea1i m\u1ed9t th\u1eddi \u0111i\u1ec3m.<\/p>\n\n\n\n<h2 id=\"K\u1ebft_lu\u1eadn\"><strong>K\u1ebft lu\u1eadn<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">L\u1ed7i Out of Memory khi ch\u1ea1y AI Agent tr\u00ean VPS th\u01b0\u1eddng li\u00ean quan \u0111\u1ebfn thi\u1ebfu b\u1ed9 nh\u1edb kh\u1ea3 d\u1ee5ng, gi\u1edbi h\u1ea1n t\u00e0i nguy\u00ean ho\u1eb7c m\u1ee9c ti\u00eau th\u1ee5 RAM qu\u00e1 cao. \u0110\u1ec3 kh\u1eafc ph\u1ee5c hi\u1ec7u qu\u1ea3, b\u1ea1n n\u00ean ki\u1ec3m tra nh\u1eadt k\u00fd OOM, x\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh g\u00e2y l\u1ed7i v\u00e0 l\u1ef1a ch\u1ecdn gi\u1ea3i ph\u00e1p ph\u00f9 h\u1ee3p nh\u01b0 gi\u1ea3m t\u00e1c v\u1ee5 \u0111\u1ed3ng th\u1eddi, b\u1ed5 sung Swap ho\u1eb7c \u0111i\u1ec1u ch\u1ec9nh c\u1ea5u h\u00ecnh Docker.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">N\u1ebfu t\u00ecnh tr\u1ea1ng thi\u1ebfu b\u1ed9 nh\u1edb v\u1eabn th\u01b0\u1eddng xuy\u00ean x\u1ea3y ra, n\u00e2ng c\u1ea5p RAM VPS s\u1ebd l\u00e0 h\u01b0\u1edbng x\u1eed l\u00fd b\u1ec1n v\u1eefng h\u01a1n, \u0111\u1eb7c bi\u1ec7t khi AI Agent c\u1ea7n ho\u1ea1t \u0111\u1ed9ng li\u00ean t\u1ee5c v\u00e0 x\u1eed l\u00fd nhi\u1ec1u c\u00f4ng vi\u1ec7c.<\/p>\n\n\n\n<h2 id=\"Nh\u1eefng_c\u00e2u_h\u1ecfi_th\u01b0\u1eddng_g\u1eb7p\"><strong>Nh\u1eefng c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p<\/strong><\/h2>\n\n\n\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Kh\u1edfi_\u0111\u1ed9ng_l\u1ea1i_VPS_c\u00f3_gi\u00fap_x\u1eed_l\u00fd_l\u1ed7i_Out_of_Memory_kh\u00f4ng?\">Kh\u1edfi \u0111\u1ed9ng l\u1ea1i VPS c\u00f3 gi\u00fap x\u1eed l\u00fd l\u1ed7i Out of Memory kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">Kh\u1edfi \u0111\u1ed9ng l\u1ea1i c\u00f3 th\u1ec3 gi\u1ea3i ph\u00f3ng b\u1ed9 nh\u1edb \u0111ang \u0111\u01b0\u1ee3c c\u00e1c ti\u1ebfn tr\u00ecnh s\u1eed d\u1ee5ng v\u00e0 gi\u00fap h\u1ec7 th\u1ed1ng ho\u1ea1t \u0111\u1ed9ng tr\u1edf l\u1ea1i t\u1ea1m th\u1eddi. Tuy nhi\u00ean, n\u1ebfu nguy\u00ean nh\u00e2n xu\u1ea5t ph\u00e1t t\u1eeb thi\u1ebfu RAM, gi\u1edbi h\u1ea1n container ho\u1eb7c r\u00f2 r\u1ec9 b\u1ed9 nh\u1edb, s\u1ef1 c\u1ed1 c\u00f3 th\u1ec3 ti\u1ebfp di\u1ec5n. B\u1ea1n n\u00ean ki\u1ec3m tra nh\u1eadt k\u00fd tr\u01b0\u1edbc khi kh\u1edfi \u0111\u1ed9ng l\u1ea1i n\u1ebfu v\u1eabn c\u00f3 th\u1ec3 truy c\u1eadp m\u00e1y ch\u1ee7.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"V\u00ec_sao_Docker_b\u1ecb_OOMKilled_d\u00f9_VPS_v\u1eabn_c\u00f2n_RAM_tr\u1ed1ng?\">V\u00ec sao Docker b\u1ecb OOMKilled d\u00f9 VPS v\u1eabn c\u00f2n RAM tr\u1ed1ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">Nguy\u00ean nh\u00e2n ph\u1ed5 bi\u1ebfn l\u00e0 container \u0111ang b\u1ecb gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb ri\u00eang. Khi m\u1ee9c s\u1eed d\u1ee5ng v\u01b0\u1ee3t ng\u01b0\u1ee1ng cho ph\u00e9p, ti\u1ebfn tr\u00ecnh c\u00f3 th\u1ec3 b\u1ecb k\u1ebft th\u00fac d\u00f9 h\u1ec7 th\u1ed1ng v\u1eabn c\u00f2n RAM kh\u1ea3 d\u1ee5ng. H\u00e3y ki\u1ec3m tra c\u1ea5u h\u00ecnh Docker, gi\u1edbi h\u1ea1n memory cgroup v\u00e0 c\u00e1c s\u1ef1 ki\u1ec7n OOM tr\u01b0\u1edbc khi quy\u1ebft \u0111\u1ecbnh t\u0103ng dung l\u01b0\u1ee3ng RAM cho VPS.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Ch\u1ea1y_AI_Agent_b\u1eb1ng_API_c\u00f3_c\u1ea7n_VPS_nhi\u1ec1u_RAM_kh\u00f4ng?\">Ch\u1ea1y AI Agent b\u1eb1ng API c\u00f3 c\u1ea7n VPS nhi\u1ec1u RAM kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">V\u1eabn c\u1ea7n RAM \u0111\u1ec3 v\u1eadn h\u00e0nh AI Agent, qu\u1ea3n l\u00fd phi\u00ean l\u00e0m vi\u1ec7c, ch\u1ea1y c\u00f4ng c\u1ee5 v\u00e0 x\u1eed l\u00fd d\u1eef li\u1ec7u. Tuy nhi\u00ean, n\u1ebfu m\u00f4 h\u00ecnh AI \u0111\u01b0\u1ee3c x\u1eed l\u00fd tr\u00ean m\u00e1y ch\u1ee7 c\u1ee7a nh\u00e0 cung c\u1ea5p API, VPS th\u01b0\u1eddng kh\u00f4ng ph\u1ea3i t\u1ea3i to\u00e0n b\u1ed9 tr\u1ecdng s\u1ed1 m\u00f4 h\u00ecnh v\u00e0o b\u1ed9 nh\u1edb. Nhu c\u1ea7u RAM th\u1ef1c t\u1ebf ph\u1ee5 thu\u1ed9c v\u00e0o c\u00e1c t\u00e1c v\u1ee5 v\u00e0 c\u00f4ng c\u1ee5 \u0111i k\u00e8m.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Exit_Code_137_c\u00f3_ch\u1eafc_ch\u1eafn_l\u00e0_l\u1ed7i_Out_of_Memory_kh\u00f4ng?\">Exit Code 137 c\u00f3 ch\u1eafc ch\u1eafn l\u00e0 l\u1ed7i Out of Memory kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">Kh\u00f4ng. Exit Code 137 th\u1ec3 hi\u1ec7n ti\u1ebfn tr\u00ecnh b\u1ecb k\u1ebft th\u00fac b\u1eb1ng t\u00edn hi\u1ec7u SIGKILL. Ngo\u00e0i l\u1ed7i OOM, t\u00edn hi\u1ec7u n\u00e0y c\u00f2n c\u00f3 th\u1ec3 ph\u00e1t sinh t\u1eeb thao t\u00e1c k\u1ebft th\u00fac ti\u1ebfn tr\u00ecnh ho\u1eb7c nh\u1eefng t\u00ecnh hu\u1ed1ng qu\u1ea3n l\u00fd container kh\u00e1c. C\u1ea7n k\u1ebft h\u1ee3p nh\u1eadt k\u00fd kernel, tr\u1ea1ng th\u00e1i Docker v\u00e0 d\u1eef li\u1ec7u s\u1eed d\u1ee5ng RAM \u0111\u1ec3 x\u00e1c \u0111\u1ecbnh nguy\u00ean nh\u00e2n.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\n<script type=\"application\/ld+json\">\n\t{\n\t\t\"@context\": \"https:\/\/schema.org\",\n\t\t\"@type\": \"FAQPage\",\n\t\t\"mainEntity\": [\n\t\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Kh\u1edfi \u0111\u1ed9ng l\u1ea1i VPS c\u00f3 gi\u00fap x\u1eed l\u00fd l\u1ed7i Out of Memory kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Kh\u1edfi \u0111\u1ed9ng l\u1ea1i c\u00f3 th\u1ec3 gi\u1ea3i ph\u00f3ng b\u1ed9 nh\u1edb \u0111ang \u0111\u01b0\u1ee3c c\u00e1c ti\u1ebfn tr\u00ecnh s\u1eed d\u1ee5ng v\u00e0 gi\u00fap h\u1ec7 th\u1ed1ng ho\u1ea1t \u0111\u1ed9ng tr\u1edf l\u1ea1i t\u1ea1m th\u1eddi. Tuy nhi\u00ean, n\u1ebfu nguy\u00ean nh\u00e2n xu\u1ea5t ph\u00e1t t\u1eeb thi\u1ebfu RAM, gi\u1edbi h\u1ea1n container ho\u1eb7c r\u00f2 r\u1ec9 b\u1ed9 nh\u1edb, s\u1ef1 c\u1ed1 c\u00f3 th\u1ec3 ti\u1ebfp di\u1ec5n. B\u1ea1n n\u00ean ki\u1ec3m tra nh\u1eadt k\u00fd tr\u01b0\u1edbc khi kh\u1edfi \u0111\u1ed9ng l\u1ea1i n\u1ebfu v\u1eabn c\u00f3 th\u1ec3 truy c\u1eadp m\u00e1y ch\u1ee7.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"V\u00ec sao Docker b\u1ecb OOMKilled d\u00f9 VPS v\u1eabn c\u00f2n RAM tr\u1ed1ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Nguy\u00ean nh\u00e2n ph\u1ed5 bi\u1ebfn l\u00e0 container \u0111ang b\u1ecb gi\u1edbi h\u1ea1n b\u1ed9 nh\u1edb ri\u00eang. Khi m\u1ee9c s\u1eed d\u1ee5ng v\u01b0\u1ee3t ng\u01b0\u1ee1ng cho ph\u00e9p, ti\u1ebfn tr\u00ecnh c\u00f3 th\u1ec3 b\u1ecb k\u1ebft th\u00fac d\u00f9 h\u1ec7 th\u1ed1ng v\u1eabn c\u00f2n RAM kh\u1ea3 d\u1ee5ng. H\u00e3y ki\u1ec3m tra c\u1ea5u h\u00ecnh Docker, gi\u1edbi h\u1ea1n memory cgroup v\u00e0 c\u00e1c s\u1ef1 ki\u1ec7n OOM tr\u01b0\u1edbc khi quy\u1ebft \u0111\u1ecbnh t\u0103ng dung l\u01b0\u1ee3ng RAM cho VPS.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Ch\u1ea1y AI Agent b\u1eb1ng API c\u00f3 c\u1ea7n VPS nhi\u1ec1u RAM kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>V\u1eabn c\u1ea7n RAM \u0111\u1ec3 v\u1eadn h\u00e0nh AI Agent, qu\u1ea3n l\u00fd phi\u00ean l\u00e0m vi\u1ec7c, ch\u1ea1y c\u00f4ng c\u1ee5 v\u00e0 x\u1eed l\u00fd d\u1eef li\u1ec7u. Tuy nhi\u00ean, n\u1ebfu m\u00f4 h\u00ecnh AI \u0111\u01b0\u1ee3c x\u1eed l\u00fd tr\u00ean m\u00e1y ch\u1ee7 c\u1ee7a nh\u00e0 cung c\u1ea5p API, VPS th\u01b0\u1eddng kh\u00f4ng ph\u1ea3i t\u1ea3i to\u00e0n b\u1ed9 tr\u1ecdng s\u1ed1 m\u00f4 h\u00ecnh v\u00e0o b\u1ed9 nh\u1edb. Nhu c\u1ea7u RAM th\u1ef1c t\u1ebf ph\u1ee5 thu\u1ed9c v\u00e0o c\u00e1c t\u00e1c v\u1ee5 v\u00e0 c\u00f4ng c\u1ee5 \u0111i k\u00e8m.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Exit Code 137 c\u00f3 ch\u1eafc ch\u1eafn l\u00e0 l\u1ed7i Out of Memory kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Kh\u00f4ng. Exit Code 137 th\u1ec3 hi\u1ec7n ti\u1ebfn tr\u00ecnh b\u1ecb k\u1ebft th\u00fac b\u1eb1ng t\u00edn hi\u1ec7u SIGKILL. Ngo\u00e0i l\u1ed7i OOM, t\u00edn hi\u1ec7u n\u00e0y c\u00f2n c\u00f3 th\u1ec3 ph\u00e1t sinh t\u1eeb thao t\u00e1c k\u1ebft th\u00fac ti\u1ebfn tr\u00ecnh ho\u1eb7c nh\u1eefng t\u00ecnh hu\u1ed1ng qu\u1ea3n l\u00fd container kh\u00e1c. C\u1ea7n k\u1ebft h\u1ee3p nh\u1eadt k\u00fd kernel, tr\u1ea1ng th\u00e1i Docker v\u00e0 d\u1eef li\u1ec7u s\u1eed d\u1ee5ng RAM \u0111\u1ec3 x\u00e1c \u0111\u1ecbnh nguy\u00ean nh\u00e2n.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t]\n\t}\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>\u0110\u1ec3 fix l\u1ed7i Out of Memory (OOM) khi ch\u1ea1y AI Agent tr\u00ean VPS, b\u1ea1n c\u1ea7n ki\u1ec3m tra dung l\u01b0\u1ee3ng RAM, x\u00e1c \u0111\u1ecbnh ti\u1ebfn tr\u00ecnh ti\u00eau th\u1ee5 b\u1ed9 nh\u1edb v\u00e0 \u0111i\u1ec1u ch\u1ec9nh t\u00e0i nguy\u00ean ph\u00f9 h\u1ee3p. Trong nhi\u1ec1u tr\u01b0\u1eddng h\u1ee3p, t\u1ea1o th\u00eam Swap ho\u1eb7c gi\u1ea3m s\u1ed1 t\u00e1c v\u1ee5 ch\u1ea1y \u0111\u1ed3ng th\u1eddi c\u00f3 th\u1ec3 gi\u00fap AI Agent [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":131205,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7724],"tags":[7734],"class_list":["post-131167","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-agent","tag-out-of-memory"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/131167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=131167"}],"version-history":[{"count":6,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/131167\/revisions"}],"predecessor-version":[{"id":131208,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/131167\/revisions\/131208"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/131205"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=131167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/categories?post=131167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=131167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}