{"id":116924,"date":"2025-07-16T18:44:37","date_gmt":"2025-07-16T11:44:37","guid":{"rendered":"https:\/\/tino.vn\/blog\/?p=116924"},"modified":"2026-10-23T18:54:35","modified_gmt":"2026-10-23T11:54:35","slug":"kinh-nghiem-toi-uu-hieu-suat-self-host-n8n","status":"publish","type":"post","link":"https:\/\/tino.vn\/blog\/kinh-nghiem-toi-uu-hieu-suat-self-host-n8n\/","title":{"rendered":"Kinh nghi\u1ec7m t\u1ed1i \u01b0u hi\u1ec7u su\u1ea5t n8n self-host: database, execution, queue mode"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Mu\u1ed1n n8n self-host ch\u1ea1y nhanh v\u00e0 \u1ed5n \u0111\u1ecbnh, h\u00e3y l\u00e0m theo th\u1ee9 t\u1ef1: chuy\u1ec3n database sang PostgreSQL, b\u1eadt t\u1ef1 d\u1ecdn d\u1eef li\u1ec7u execution c\u0169, gi\u1edbi h\u1ea1n s\u1ed1 l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi, l\u01b0u file nh\u1ecb ph\u00e2n ra \u1ed5 \u0111\u0129a, r\u1ed3i m\u1edbi t\u00e1ch queue mode v\u1edbi Redis v\u00e0 worker khi m\u1ed9t ti\u1ebfn tr\u00ecnh kh\u00f4ng c\u00f2n \u0111\u1ee7.<\/strong> M\u1ed7i b\u01b0\u1edbc \u0111\u1ec1u c\u00f3 bi\u1ebfn m\u00f4i tr\u01b0\u1eddng ch\u00ednh th\u1ee9c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">B\u00e0i n\u00e0y d\u00e0nh cho <a href=\"https:\/\/tino.vn\/blog\/n8n-la-gi\/\">n8n<\/a> \u0111\u00e3 <a href=\"https:\/\/tino.vn\/blog\/cach-cai-dat-n8n-tren-vps\/\">c\u00e0i \u0111\u1eb7t tr\u00ean VPS<\/a> b\u1eb1ng Docker. N\u1ebfu b\u1ea1n \u0111ang t\u00ecm kh\u00e1i ni\u1ec7m self host v\u00e0 c\u00e1ch ch\u1ecdn gi\u1eefa t\u1ef1 host v\u1edbi n8n Cloud, xem <a href=\"https:\/\/tino.vn\/blog\/so-sanh-n8n-self-host-va-n8n-cloud\/\">so s\u00e1nh n8n self-host v\u00e0 n8n Cloud<\/a>.<\/p>\n\n\n\n<h2 id=\"V\u00ec_sao_n8n_self-host_ch\u1ea1y_ch\u1eadm?\">V\u00ec sao n8n self-host ch\u1ea1y ch\u1eadm?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">n8n self-host th\u01b0\u1eddng ch\u1eadm v\u00ec b\u1ed1n nh\u00f3m nguy\u00ean nh\u00e2n: m\u00e1y ch\u1ee7 thi\u1ebfu RAM ho\u1eb7c \u1ed5 \u0111\u0129a ch\u1eadm, database SQLite ph\u00ecnh to v\u00ec gi\u1eef qu\u00e1 nhi\u1ec1u d\u1eef li\u1ec7u execution, qu\u00e1 nhi\u1ec1u workflow ch\u1ea1y c\u00f9ng l\u00fac trong m\u1ed9t ti\u1ebfn tr\u00ecnh, v\u00e0 workflow x\u1eed l\u00fd d\u1eef li\u1ec7u l\u1edbn h\u01a1n m\u1ee9c c\u1ea7n. Bi\u1ebft nh\u00f3m nguy\u00ean nh\u00e2n tr\u01b0\u1edbc gi\u00fap b\u1ea1n kh\u00f4ng n\u00e2ng c\u1ea5p VPS khi l\u1ed7i n\u1eb1m \u1edf workflow.<\/p>\n\n\n\n<h3 id=\"C\u1ea5u_h\u00ecnh_ph\u1ea7n_c\u1ee9ng_m\u00e1y_ch\u1ee7\">C\u1ea5u h\u00ecnh ph\u1ea7n c\u1ee9ng m\u00e1y ch\u1ee7<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>CPU:<\/strong> s\u1ed1 l\u00f5i v\u00e0 t\u1ed1c \u0111\u1ed9 CPU \u1ea3nh h\u01b0\u1edfng tr\u1ef1c ti\u1ebfp \u0111\u1ebfn t\u1ed1c \u0111\u1ed9 ch\u1ea1y workflow ph\u1ee9c t\u1ea1p ho\u1eb7c x\u1eed l\u00fd nhi\u1ec1u d\u1eef li\u1ec7u.<\/li>\n\n\n<li><strong>RAM:<\/strong> workflow nhi\u1ec1u b\u01b0\u1edbc, d\u1eef li\u1ec7u l\u1edbn ho\u1eb7c nhi\u1ec1u l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi ti\u00eau t\u1ed1n nhi\u1ec1u RAM. Theo t\u00e0i li\u1ec7u n8n, b\u1ed9 nh\u1edb d\u00f9ng ph\u1ee5 thu\u1ed9c l\u01b0\u1ee3ng d\u1eef li\u1ec7u, s\u1ed1 node v\u00e0 s\u1ed1 l\u01b0\u1ee3t ch\u1ea1y c\u00f9ng l\u00fac, n\u00ean n8n kh\u00f4ng c\u00f4ng b\u1ed1 m\u1ee9c RAM t\u1ed1i thi\u1ec3u c\u1ed1 \u0111\u1ecbnh (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/scaling\/fix-memory-issues\" target=\"_blank\" rel=\"noopener nofollow\">Memory-related errors<\/a>).<\/li>\n\n\n<li><strong>\u1ed4 c\u1ee9ng:<\/strong> t\u1ed1c \u0111\u1ed9 \u0111\u1ecdc ghi \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn database (SQLite ho\u1eb7c PostgreSQL) v\u00e0 file t\u1ea1m. SSD ho\u1eb7c NVMe nhanh h\u01a1n r\u00f5 r\u1ec7t so v\u1edbi HDD.<\/li>\n\n\n<li><strong>M\u1ea1ng:<\/strong> workflow g\u1ecdi API b\u00ean ngo\u00e0i ho\u1eb7c t\u1ea3i file l\u1edbn ph\u1ee5 thu\u1ed9c b\u0103ng th\u00f4ng v\u00e0 \u0111\u1ed9 tr\u1ec5 m\u1ea1ng.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"C\u1ea5u_h\u00ecnh_ph\u1ea7n_m\u1ec1m_n8n_v\u00e0_m\u00f4i_tr\u01b0\u1eddng\">C\u1ea5u h\u00ecnh ph\u1ea7n m\u1ec1m n8n v\u00e0 m\u00f4i tr\u01b0\u1eddng<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Database:<\/strong> m\u1eb7c \u0111\u1ecbnh n8n d\u00f9ng SQLite, ph\u00f9 h\u1ee3p c\u00e0i \u0111\u1eb7t nh\u1ecf. Khi l\u01b0\u1ee3ng execution l\u1edbn, SQLite d\u1ec5 th\u00e0nh \u0111i\u1ec3m ngh\u1ebdn.<\/li>\n\n\n<li><strong>Ch\u1ebf \u0111\u1ed9 ch\u1ea1y:<\/strong> m\u1eb7c \u0111\u1ecbnh <code>regular<\/code>, m\u1ecdi th\u1ee9 ch\u1ea1y trong m\u1ed9t ti\u1ebfn tr\u00ecnh; <code>queue<\/code> t\u00e1ch ph\u1ea7n th\u1ef1c thi sang c\u00e1c worker.<\/li>\n\n\n<li><strong>D\u1eef li\u1ec7u execution:<\/strong> n8n l\u01b0u k\u1ebft qu\u1ea3 t\u1eebng l\u1ea7n ch\u1ea1y; gi\u1eef qu\u00e1 l\u00e2u l\u00e0m database ph\u00ecnh to v\u00e0 ch\u1eadm.<\/li>\n\n\n<li><strong>Phi\u00ean b\u1ea3n n8n:<\/strong> b\u1ea3n m\u1edbi th\u01b0\u1eddng c\u00f3 c\u1ea3i ti\u1ebfn hi\u1ec7u n\u0103ng v\u00e0 b\u1ea3n v\u00e1; n\u00ean c\u1eadp nh\u1eadt \u0111\u1ecbnh k\u1ef3.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"Thi\u1ebft_k\u1ebf_workflow\">Thi\u1ebft k\u1ebf workflow<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u0110\u1ed9 ph\u1ee9c t\u1ea1p:<\/strong> c\u00e0ng nhi\u1ec1u node, v\u00f2ng l\u1eb7p, nh\u00e1nh \u0111i\u1ec1u ki\u1ec7n th\u00ec c\u00e0ng t\u1ed1n t\u00e0i nguy\u00ean v\u00e0 th\u1eddi gian.<\/li>\n\n\n<li><strong>K\u00edch th\u01b0\u1edbc d\u1eef li\u1ec7u:<\/strong> x\u1eed l\u00fd file l\u1edbn ho\u1eb7c danh s\u00e1ch d\u00e0i trong m\u1ed9t l\u1ea7n ch\u1ea1y l\u00e0m t\u0103ng RAM.<\/li>\n\n\n<li><strong>S\u1ed1 l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi v\u00e0 t\u1ea7n su\u1ea5t:<\/strong> trigger qu\u00e1 d\u00e0y (m\u1ed7i gi\u00e2y) ho\u1eb7c nhi\u1ec1u webhook c\u00f9ng l\u00fac d\u1ec5 g\u00e2y qu\u00e1 t\u1ea3i.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"Gi\u00e1m_s\u00e1t_v\u00e0_b\u1ea3o_tr\u00ec\">Gi\u00e1m s\u00e1t v\u00e0 b\u1ea3o tr\u00ec<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Thi\u1ebfu gi\u00e1m s\u00e1t:<\/strong> kh\u00f4ng theo d\u00f5i CPU, RAM, \u1ed5 \u0111\u0129a, s\u1ed1 execution th\u00ec kh\u00f3 ph\u00e1t hi\u1ec7n v\u1ea5n \u0111\u1ec1 s\u1edbm.<\/li>\n\n\n<li><strong>Kh\u00f4ng c\u1eadp nh\u1eadt:<\/strong> b\u1ecf l\u1ee1 b\u1ea3n v\u00e1 l\u1ed7i hi\u1ec7u n\u0103ng v\u00e0 b\u1ea3o m\u1eadt.<\/li>\n\n\n<li><strong>Log v\u00e0 d\u1eef li\u1ec7u c\u0169:<\/strong> kh\u00f4ng d\u1ecdn th\u00ec \u0111\u1ea7y \u1ed5 \u0111\u0129a v\u00e0 l\u00e0m ch\u1eadm h\u1ec7 th\u1ed1ng.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"N\u00ean_t\u1ed1i_\u01b0u_n8n_self-host_theo_th\u1ee9_t\u1ef1_n\u00e0o?\">N\u00ean t\u1ed1i \u01b0u n8n self-host theo th\u1ee9 t\u1ef1 n\u00e0o?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">N\u00ean t\u1ed1i \u01b0u n8n self-host t\u1eeb vi\u1ec7c r\u1ebb v\u00e0 \u00edt r\u1ee7i ro \u0111\u1ebfn vi\u1ec7c ph\u1ee9c t\u1ea1p: d\u1ecdn d\u1eef li\u1ec7u v\u00e0 chuy\u1ec3n database tr\u01b0\u1edbc, sau \u0111\u00f3 gi\u1edbi h\u1ea1n l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi, cu\u1ed1i c\u00f9ng m\u1edbi t\u00e1ch queue mode. B\u1ea3ng d\u01b0\u1edbi t\u00f3m t\u1eaft t\u1eebng b\u01b0\u1edbc, bi\u1ebfn m\u00f4i tr\u01b0\u1eddng d\u00f9ng v\u00e0 l\u00fac n\u00ean l\u00e0m.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>B\u01b0\u1edbc<\/th><th>L\u00e0m g\u00ec<\/th><th>Bi\u1ebfn ho\u1eb7c l\u1ec7nh ch\u00ednh<\/th><th>N\u00ean l\u00e0m khi<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>Chuy\u1ec3n database sang PostgreSQL<\/td><td><code>DB_TYPE=postgresdb<\/code><\/td><td>Ch\u1ea1y th\u1eadt, nhi\u1ec1u execution m\u1ed7i ng\u00e0y<\/td><\/tr><tr><td>2<\/td><td>T\u1ef1 d\u1ecdn d\u1eef li\u1ec7u execution c\u0169<\/td><td><code>EXECUTIONS_DATA_PRUNE<\/code>, <code>EXECUTIONS_DATA_MAX_AGE<\/code>, <code>EXECUTIONS_DATA_PRUNE_MAX_COUNT<\/code><\/td><td>Database t\u0103ng dung l\u01b0\u1ee3ng nhanh<\/td><\/tr><tr><td>3<\/td><td>Gi\u1edbi h\u1ea1n l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi<\/td><td><code>N8N_CONCURRENCY_PRODUCTION_LIMIT<\/code><\/td><td>Nhi\u1ec1u webhook \u0111\u1ebfn c\u00f9ng l\u00fac l\u00e0m treo n8n<\/td><\/tr><tr><td>4<\/td><td>L\u01b0u binary data ra \u1ed5 \u0111\u0129a<\/td><td><code>N8N_DEFAULT_BINARY_DATA_MODE=filesystem<\/code><\/td><td>Workflow x\u1eed l\u00fd file, \u1ea3nh, PDF<\/td><\/tr><tr><td>5<\/td><td>T\u00e1ch queue mode v\u1edbi Redis v\u00e0 worker<\/td><td><code>EXECUTIONS_MODE=queue<\/code>, <code>n8n worker --concurrency=5<\/code><\/td><td>M\u1ed9t ti\u1ebfn tr\u00ecnh kh\u00f4ng c\u00f2n \u0111\u1ee7 d\u00f9 \u0111\u00e3 l\u00e0m 1\u20134<\/td><\/tr><tr><td>6<\/td><td>Gi\u00e1m s\u00e1t b\u1eb1ng Prometheus<\/td><td><code>N8N_METRICS=true<\/code><\/td><td>C\u1ea7n s\u1ed1 li\u1ec7u \u0111\u1ec3 quy\u1ebft \u0111\u1ecbnh n\u00e2ng c\u1ea5p<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Bi\u1ebfn m\u00f4i tr\u01b0\u1eddng theo docs.n8n.io, truy c\u1eadp 23\/10\/2026<\/figcaption><\/figure>\n\n\n\n<h2 id=\"Kinh_nghi\u1ec7m_t\u1ed1i_\u01b0u_hi\u1ec7u_su\u1ea5t_n8n_self-host\">Kinh nghi\u1ec7m t\u1ed1i \u01b0u hi\u1ec7u su\u1ea5t n8n self-host<\/h2>\n\n\n\n<h3 id=\"Ch\u1ecdn_c\u1ea5u_h\u00ecnh_m\u00e1y_ch\u1ee7_v\u00e0_h\u1ec7_\u0111i\u1ec1u_h\u00e0nh_ph\u00f9_h\u1ee3p\">Ch\u1ecdn c\u1ea5u h\u00ecnh m\u00e1y ch\u1ee7 v\u00e0 h\u1ec7 \u0111i\u1ec1u h\u00e0nh ph\u00f9 h\u1ee3p<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">C\u1ea5u h\u00ecnh m\u00e1y ch\u1ee7 cho n8n n\u00ean b\u1eaft \u0111\u1ea7u v\u1eeba \u0111\u1ee7 r\u1ed3i n\u00e2ng theo s\u1ed1 li\u1ec7u gi\u00e1m s\u00e1t. Kinh nghi\u1ec7m th\u1ef1c t\u1ebf: 2 vCPU l\u00e0 m\u1ee9c kh\u1edfi \u0111\u1ea7u, 4 vCPU cho h\u1ec7 th\u1ed1ng nhi\u1ec1u workflow; RAM t\u1eeb 4GB cho c\u00e0i \u0111\u1eb7t nh\u1ecf v\u00e0 v\u1eeba, 8\u201316GB khi x\u1eed l\u00fd d\u1eef li\u1ec7u l\u1edbn ho\u1eb7c ch\u1ea1y c\u1ea3 PostgreSQL, Redis tr\u00ean c\u00f9ng VPS. Lu\u00f4n d\u00f9ng SSD ho\u1eb7c NVMe.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>H\u1ec7 \u0111i\u1ec1u h\u00e0nh:<\/strong> d\u00f9ng Ubuntu 24.04 LTS ho\u1eb7c Debian 12\/13 v\u00e0 c\u1eadp nh\u1eadt b\u1ea3n v\u00e1 th\u01b0\u1eddng xuy\u00ean. CentOS Linux \u0111\u00e3 h\u1ebft v\u00f2ng \u0111\u1eddi ng\u00e0y 30\/06\/2024, kh\u00f4ng n\u00ean d\u00f9ng cho m\u00e1y m\u1edbi.<\/li>\n\n\n<li><strong>T\u1eaft d\u1ecbch v\u1ee5 kh\u00f4ng c\u1ea7n thi\u1ebft:<\/strong> gi\u1ea3m ti\u1ebfn tr\u00ecnh ch\u1ea1y ng\u1ea7m kh\u00f4ng li\u00ean quan \u0111\u1ec3 d\u00e0nh CPU, RAM cho n8n.<\/li>\n\n\n<li><strong>Swap:<\/strong> m\u1ed9t l\u01b0\u1ee3ng swap v\u1eeba ph\u1ea3i (kho\u1ea3ng 1\u20132 l\u1ea7n RAM v\u1edbi VPS nh\u1ecf) gi\u00fap h\u1ec7 th\u1ed1ng kh\u00f4ng b\u1ecb d\u1eebng khi t\u1ea3i t\u0103ng \u0111\u1ed9t ng\u1ed9t, nh\u01b0ng d\u00f9ng swap th\u01b0\u1eddng xuy\u00ean l\u00e0 d\u1ea5u hi\u1ec7u thi\u1ebfu RAM.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">B\u1ea3ng c\u1ea5u h\u00ecnh theo quy m\u00f4: <a href=\"https:\/\/tino.vn\/blog\/cau-hinh-toi-thieu-de-trien-khai-vps-n8n\/\">c\u1ea5u h\u00ecnh t\u1ed1i thi\u1ec3u \u0111\u1ec3 tri\u1ec3n khai VPS n8n<\/a>. Gi\u1edbi h\u1ea1n RAM, CPU cho t\u1eebng container Docker: <a href=\"https:\/\/tino.vn\/blog\/toi-uu-ram-va-cpu-cho-n8n-docker-tren-vps\/\">t\u1ed1i \u01b0u RAM v\u00e0 CPU cho n8n Docker tr\u00ean VPS<\/a>.<\/p>\n\n\n\n<h3 id=\"D\u00f9ng_PostgreSQL_thay_v\u00ec_SQLite\">D\u00f9ng PostgreSQL thay v\u00ec SQLite<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PostgreSQL l\u00e0 database n\u00ean d\u00f9ng cho n8n ch\u1ea1y th\u1eadt; n8n h\u1ed7 tr\u1ee3 PostgreSQL 16, 17 v\u00e0 18 (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/choose-n8ns-database\" target=\"_blank\" rel=\"noopener nofollow\">Choose n8n\u2019s database<\/a>). MySQL v\u00e0 MariaDB kh\u00f4ng c\u00f2n \u0111\u01b0\u1ee3c h\u1ed7 tr\u1ee3 l\u00e0m database c\u1ee7a n8n t\u1eeb b\u1ea3n 2.0 (<a href=\"https:\/\/docs.n8n.io\/changelog\/v20-breaking-changes\" target=\"_blank\" rel=\"noopener nofollow\">v2.0 breaking changes<\/a>); node MySQL \u0111\u1ec3 \u0111\u1ecdc ghi d\u1eef li\u1ec7u trong workflow v\u1eabn d\u00f9ng b\u00ecnh th\u01b0\u1eddng.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SQLite l\u00e0 database d\u1ea1ng file, \u0111\u01a1n gi\u1ea3n, h\u1ee3p v\u1edbi c\u00e0i \u0111\u1eb7t c\u00e1 nh\u00e2n \u00edt workflow. Khi s\u1ed1 workflow v\u00e0 execution t\u0103ng, SQLite x\u1eed l\u00fd \u0111\u1ed3ng th\u1eddi k\u00e9m h\u01a1n v\u00e0 file database ph\u00ecnh to. C\u00e1ch chuy\u1ec3n d\u1eef li\u1ec7u sang PostgreSQL b\u1eb1ng l\u1ec7nh export v\u00e0 import c\u1ee7a n8n: <a href=\"https:\/\/tino.vn\/blog\/doi-database-n8n-tu-sqlite-sang-postgresql\/\">\u0111\u1ed5i database n8n t\u1eeb SQLite sang PostgreSQL<\/a>.<\/p>\n\n\n\n<h3 id=\"B\u1eadt_t\u1ef1_d\u1ecdn_d\u1eef_li\u1ec7u_execution_c\u0169\">B\u1eadt t\u1ef1 d\u1ecdn d\u1eef li\u1ec7u execution c\u0169<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">n8n t\u1ef1 x\u00f3a d\u1eef li\u1ec7u execution c\u0169 theo hai ng\u01b0\u1ee1ng: tu\u1ed5i (m\u1eb7c \u0111\u1ecbnh 336 gi\u1edd, t\u1ee9c 14 ng\u00e0y) v\u00e0 s\u1ed1 l\u01b0\u1ee3ng (m\u1eb7c \u0111\u1ecbnh 10.000 execution). Bi\u1ebfn <code>EXECUTIONS_DATA_MAX_AGE<\/code> t\u00ednh b\u1eb1ng gi\u1edd (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/basic-configuration\/use-environment-variables\/executions\" target=\"_blank\" rel=\"noopener nofollow\">Executions environment variables<\/a>). H\u1ea1 hai ng\u01b0\u1ee1ng n\u00e0y l\u00e0 c\u00e1ch r\u1ebb nh\u1ea5t \u0111\u1ec3 database nh\u1eb9 l\u1ea1i.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXECUTIONS_DATA_PRUNE=true\nEXECUTIONS_DATA_MAX_AGE=168            # gi\u1eef 7 ng\u00e0y (t\u00ednh b\u1eb1ng gi\u1edd)\nEXECUTIONS_DATA_PRUNE_MAX_COUNT=5000\nEXECUTIONS_DATA_SAVE_ON_SUCCESS=none   # kh\u00f4ng l\u01b0u execution ch\u1ea1y th\u00e0nh c\u00f4ng<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ch\u1ec9 \u0111\u1eb7t <code>EXECUTIONS_DATA_SAVE_ON_SUCCESS=none<\/code> khi b\u1ea1n kh\u00f4ng c\u1ea7n xem l\u1ea1i l\u1ea7n ch\u1ea1y th\u00e0nh c\u00f4ng; execution l\u1ed7i v\u1eabn \u0111\u01b0\u1ee3c l\u01b0u \u0111\u1ec3 g\u1ee1 l\u1ed7i.<\/p>\n\n\n\n<h3 id=\"Gi\u1edbi_h\u1ea1n_s\u1ed1_l\u01b0\u1ee3t_ch\u1ea1y_\u0111\u1ed3ng_th\u1eddi\">Gi\u1edbi h\u1ea1n s\u1ed1 l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u1ede ch\u1ebf \u0111\u1ed9 regular, <code>N8N_CONCURRENCY_PRODUCTION_LIMIT<\/code> gi\u1edbi h\u1ea1n s\u1ed1 l\u01b0\u1ee3t ch\u1ea1y production c\u00f9ng l\u00fac; m\u1eb7c \u0111\u1ecbnh -1 l\u00e0 kh\u00f4ng gi\u1edbi h\u1ea1n (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/basic-configuration\/use-environment-variables\/executions\" target=\"_blank\" rel=\"noopener nofollow\">Executions environment variables<\/a>). L\u01b0\u1ee3t ch\u1ea1y v\u01b0\u1ee3t gi\u1edbi h\u1ea1n \u0111\u01b0\u1ee3c x\u1ebfp h\u00e0ng ch\u1edd thay v\u00ec ch\u1ea1y c\u00f9ng l\u00fac l\u00e0m tr\u00e0n RAM.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>N8N_CONCURRENCY_PRODUCTION_LIMIT=10<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u1ede queue mode, m\u1ed7i worker t\u1ef1 gi\u1edbi h\u1ea1n b\u1eb1ng c\u1edd <code>--concurrency<\/code> (xem ph\u1ea7n queue mode b\u00ean d\u01b0\u1edbi).<\/p>\n\n\n\n<h3 id=\"L\u01b0u_binary_data_ra_\u1ed5_\u0111\u0129a\">L\u01b0u binary data ra \u1ed5 \u0111\u0129a<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Binary data l\u00e0 file \u0111\u00ednh k\u00e8m, \u1ea3nh, PDF \u0111i qua workflow. T\u1eeb n8n 2.0, ch\u1ebf \u0111\u1ed9 gi\u1eef binary data trong RAM \u0111\u00e3 b\u1ecb g\u1ee1; \u1edf ch\u1ebf \u0111\u1ed9 regular, m\u1eb7c \u0111\u1ecbnh l\u00e0 <code>filesystem<\/code>, \u1edf queue mode m\u1eb7c \u0111\u1ecbnh l\u00e0 <code>database<\/code>, ngo\u00e0i ra c\u00f3 <code>s3<\/code> (<a href=\"https:\/\/docs.n8n.io\/changelog\/v20-breaking-changes\" target=\"_blank\" rel=\"noopener nofollow\">v2.0 breaking changes<\/a>).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>N8N_DEFAULT_BINARY_DATA_MODE=filesystem<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ea3m b\u1ea3o th\u01b0 m\u1ee5c d\u1eef li\u1ec7u (m\u1eb7c \u0111\u1ecbnh n\u1eb1m trong .n8n) c\u00f2n \u0111\u1ee7 dung l\u01b0\u1ee3ng. T\u00e0i li\u1ec7u queue mode ghi n8n kh\u00f4ng h\u1ed7 tr\u1ee3 l\u01b0u binary data d\u1ea1ng filesystem khi ch\u1ea1y queue mode; khi \u0111\u00f3 d\u00f9ng database ho\u1eb7c S3.<\/p>\n\n\n\n<h3 id=\"Ch\u1ea1y_n8n_\u1edf_queue_mode_khi_m\u1ed9t_ti\u1ebfn_tr\u00ecnh_kh\u00f4ng_c\u00f2n_\u0111\u1ee7\">Ch\u1ea1y n8n \u1edf queue mode khi m\u1ed9t ti\u1ebfn tr\u00ecnh kh\u00f4ng c\u00f2n \u0111\u1ee7<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Queue mode t\u00e1ch n8n th\u00e0nh m\u1ed9t ti\u1ebfn tr\u00ecnh main nh\u1eadn trigger v\u00e0 webhook, Redis gi\u1eef h\u00e0ng \u0111\u1ee3i, v\u00e0 nhi\u1ec1u worker th\u1ef1c thi workflow song song. Worker l\u1ea5y vi\u1ec7c t\u1eeb Redis, \u0111\u1ecdc workflow trong database, ch\u1ea1y xong th\u00ec ghi k\u1ebft qu\u1ea3 l\u1ea1i (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/scaling\/enable-queue-mode\" target=\"_blank\" rel=\"noopener nofollow\">Enable queue mode<\/a>).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1400\" height=\"750\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/kinh-nghiem-toi-uu-hieu-suat-self-host-n8n-queue-mode.webp\" alt=\"S\u01a1 \u0111\u1ed3 queue mode c\u1ee7a n8n: trigger v\u00e0 webhook v\u00e0o ti\u1ebfn tr\u00ecnh main, main \u0111\u1ea9y m\u00e3 execution v\u00e0o Redis, c\u00e1c worker l\u1ea5y vi\u1ec7c t\u1eeb Redis, \u0111\u1ecdc v\u00e0 ghi k\u1ebft qu\u1ea3 v\u00e0o PostgreSQL; main v\u00e0 m\u1ecdi worker d\u00f9ng chung kh\u00f3a m\u00e3 h\u00f3a v\u00e0 c\u00f9ng database\" class=\"wp-image-131835\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/kinh-nghiem-toi-uu-hieu-suat-self-host-n8n-queue-mode.webp 1400w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/kinh-nghiem-toi-uu-hieu-suat-self-host-n8n-queue-mode-300x161.webp 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/kinh-nghiem-toi-uu-hieu-suat-self-host-n8n-queue-mode-1024x549.webp 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/kinh-nghiem-toi-uu-hieu-suat-self-host-n8n-queue-mode-768x411.webp 768w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">C\u00e1c \u0111i\u1ec1u ki\u1ec7n b\u1eaft bu\u1ed9c theo t\u00e0i li\u1ec7u n8n:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0110\u1eb7t <code>EXECUTIONS_MODE=queue<\/code> tr\u00ean main v\u00e0 tr\u00ean m\u1ecdi worker.<\/li>\n\n\n<li>D\u00f9ng PostgreSQL; n8n kh\u00f4ng khuy\u1ebfn ngh\u1ecb ch\u1ea1y queue mode v\u1edbi SQLite.<\/li>\n\n\n<li>Main, worker v\u00e0 webhook processor ph\u1ea3i d\u00f9ng chung <code>N8N_ENCRYPTION_KEY<\/code>, n\u1ebfu kh\u00f4ng worker kh\u00f4ng gi\u1ea3i m\u00e3 \u0111\u01b0\u1ee3c credentials.<\/li>\n\n\n<li>Worker m\u1eb7c \u0111\u1ecbnh ch\u1ea1y 10 vi\u1ec7c song song; n8n khuy\u00ean \u0111\u1eb7t <code>--concurrency<\/code> t\u1eeb 5 tr\u1edf l\u00ean.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">V\u00ed d\u1ee5 ph\u1ea7n khai b\u00e1o trong Docker Compose (r\u00fat g\u1ecdn, c\u1ea7n th\u00eam service PostgreSQL v\u00e0 c\u00e1c bi\u1ebfn DB_*):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  redis:\n    image: redis:7-alpine\n    restart: unless-stopped\n\n  n8n:\n    image: n8nio\/n8n:2.44.6\n    environment:\n      - EXECUTIONS_MODE=queue\n      - QUEUE_BULL_REDIS_HOST=redis\n      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}\n      - DB_TYPE=postgresdb\n\n  n8n-worker:\n    image: n8nio\/n8n:2.44.6\n    command: worker --concurrency=5\n    environment:\n      - EXECUTIONS_MODE=queue\n      - QUEUE_BULL_REDIS_HOST=redis\n      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}\n      - DB_TYPE=postgresdb<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Main v\u00e0 worker ph\u1ea3i ch\u1ea1y c\u00f9ng m\u1ed9t phi\u00ean b\u1ea3n n8n. Mu\u1ed1n th\u00eam s\u1ee9c x\u1eed l\u00fd, t\u0103ng s\u1ed1 worker (<code>docker compose up -d --scale n8n-worker=2<\/code>) thay v\u00ec ch\u1ec9 t\u0103ng concurrency.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Khi l\u01b0\u1ee3ng webhook r\u1ea5t l\u1edbn, c\u00f3 th\u1ec3 ch\u1ea1y th\u00eam ti\u1ebfn tr\u00ecnh <code>n8n webhook<\/code> ri\u00eang v\u00e0 \u0111\u1eb7t <code>N8N_DISABLE_PRODUCTION_MAIN_PROCESS=true<\/code> tr\u00ean main \u0111\u1ec3 main kh\u00f4ng nh\u1eadn webhook production n\u1eefa (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/scaling\/enable-queue-mode\" target=\"_blank\" rel=\"noopener nofollow\">Enable queue mode<\/a>). C\u1ea7n m\u1ed9t reverse proxy chia \u0111\u01b0\u1eddng d\u1eabn \/webhook\/ sang c\u00e1c ti\u1ebfn tr\u00ecnh n\u00e0y; c\u00e1ch c\u1ea5u h\u00ecnh Nginx xem \u1edf <a href=\"https:\/\/tino.vn\/blog\/cau-hinh-nginx-reverse-proxy-va-ssl-cho-n8n\/\">c\u1ea5u h\u00ecnh Nginx reverse proxy v\u00e0 SSL cho n8n<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Redis trong queue mode \u0111\u00f3ng vai tr\u00f2 h\u00e0ng \u0111\u1ee3i vi\u1ec7c (th\u01b0 vi\u1ec7n Bull), kh\u00f4ng ph\u1ea3i b\u1ed9 nh\u1edb \u0111\u1ec7m cho workflow. N\u1ebfu c\u1ea7n nhi\u1ec1u n8n \u0111\u1ed9c l\u1eadp tr\u00ean c\u00f9ng m\u00e1y thay v\u00ec m\u1ed9t n8n nhi\u1ec1u worker, xem <a href=\"https:\/\/tino.vn\/blog\/chay-nhieu-instance-n8n-tren-cung-1-vps\/\">ch\u1ea1y nhi\u1ec1u instance n8n tr\u00ean c\u00f9ng 1 VPS<\/a>.<\/p>\n\n\n\n<h3 id=\"M\u1ed9t_s\u1ed1_bi\u1ebfn_m\u00f4i_tr\u01b0\u1eddng_kh\u00e1c_n\u00ean_bi\u1ebft\">M\u1ed9t s\u1ed1 bi\u1ebfn m\u00f4i tr\u01b0\u1eddng kh\u00e1c n\u00ean bi\u1ebft<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>N8N_PUSH_BACKEND:<\/strong> ch\u1ecdn <code>websocket<\/code> (m\u1eb7c \u0111\u1ecbnh) ho\u1eb7c <code>sse<\/code> \u0111\u1ec3 g\u1eedi c\u1eadp nh\u1eadt l\u00ean giao di\u1ec7n; \u0111\u1ed5i sang sse khi proxy kh\u00f4ng h\u1ed7 tr\u1ee3 WebSocket (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/basic-configuration\/use-environment-variables\/deployment\" target=\"_blank\" rel=\"noopener nofollow\">Deployment environment variables<\/a>).<\/li>\n\n\n<li><strong>EXECUTIONS_TIMEOUT:<\/strong> th\u1eddi gian t\u1ed1i \u0111a (gi\u00e2y) cho m\u1ed7i workflow, m\u1eb7c \u0111\u1ecbnh -1 l\u00e0 kh\u00f4ng gi\u1edbi h\u1ea1n; \u0111\u1eb7t gi\u00e1 tr\u1ecb \u0111\u1ec3 workflow treo kh\u00f4ng gi\u1eef t\u00e0i nguy\u00ean m\u00e3i.<\/li>\n\n\n<li><strong>N8N_METRICS=true:<\/strong> b\u1eadt endpoint \/metrics cho Prometheus (xem ph\u1ea7n gi\u00e1m s\u00e1t).<\/li>\n<\/ul>\n\n\n\n<h3 id=\"T\u1ed1i_\u01b0u_workflow\">T\u1ed1i \u01b0u workflow<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">T\u1ed1i \u01b0u workflow th\u01b0\u1eddng mang l\u1ea1i hi\u1ec7u qu\u1ea3 l\u1edbn h\u01a1n n\u00e2ng c\u1ea5p m\u00e1y ch\u1ee7, v\u00ec ph\u1ea7n l\u1edbn t\u00e0i nguy\u00ean b\u1ecb ti\u00eau v\u00e0o d\u1eef li\u1ec7u th\u1eeba v\u00e0 l\u01b0\u1ee3t ch\u1ea1y kh\u00f4ng c\u1ea7n thi\u1ebft.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>D\u00f9ng Schedule Trigger h\u1ee3p l\u00fd:<\/strong> v\u1edbi t\u00e1c v\u1ee5 \u0111\u1ecbnh k\u1ef3, ch\u1ecdn kho\u1ea3ng th\u1eddi gian th\u1eadt s\u1ef1 c\u1ea7n (m\u1ed7i gi\u1edd, m\u1ed7i ng\u00e0y) thay v\u00ec ch\u1ea1y m\u1ed7i ph\u00fat \u0111\u1ec3 ki\u1ec3m tra.<\/li>\n\n\n<li><strong>T\u00e1ch ph\u1ea7n d\u00f9ng chung th\u00e0nh sub-workflow:<\/strong> g\u1ecdi b\u1eb1ng node Execute Workflow \u0111\u1ec3 d\u1ec5 b\u1ea3o tr\u00ec; sub-workflow ch\u1ea1y xong s\u1ebd gi\u1ea3i ph\u00f3ng d\u1eef li\u1ec7u c\u1ee7a n\u00f3, gi\u00fap workflow cha nh\u1eb9 h\u01a1n khi x\u1eed l\u00fd danh s\u00e1ch d\u00e0i.<\/li>\n\n\n<li><strong>G\u1ecdi API hi\u1ec7u qu\u1ea3:<\/strong> v\u1edbi node HTTP Request, ch\u1ec9 l\u1ea5y tr\u01b0\u1eddng c\u1ea7n thi\u1ebft, \u0111\u1eb7t Timeout \u0111\u1ec3 kh\u00f4ng treo khi API ch\u1eadm, b\u1eadt Retry On Fail cho l\u1ed7i t\u1ea1m th\u1eddi.<\/li>\n\n\n<li><strong>T\u00f4n tr\u1ecdng gi\u1edbi h\u1ea1n t\u1ed1c \u0111\u1ed9 API:<\/strong> chia d\u1eef li\u1ec7u th\u00e0nh l\u00f4 b\u1eb1ng Loop Over Items, th\u00eam node Wait gi\u1eefa c\u00e1c l\u00f4 ho\u1eb7c d\u00f9ng t\u00f9y ch\u1ecdn Batching c\u1ee7a HTTP Request \u0111\u1ec3 kh\u00f4ng b\u1ecb ch\u1eb7n v\u00ec g\u1eedi qu\u00e1 nhanh.<\/li>\n\n\n<li><strong>C\u00f3 error workflow:<\/strong> \u0111\u1eb7t m\u1ed9t workflow d\u00f9ng Error Trigger \u0111\u1ec3 ghi l\u1ea1i v\u00e0 b\u00e1o l\u1ed7i, gi\u00fap khoanh v\u00f9ng s\u1ef1 c\u1ed1 nhanh.<\/li>\n\n\n<li><strong>Ch\u1ec9 truy\u1ec1n d\u1eef li\u1ec7u c\u1ea7n thi\u1ebft:<\/strong> d\u00f9ng Edit Fields (Set) \u0111\u1ec3 b\u1ecf b\u1edbt tr\u01b0\u1eddng tr\u01b0\u1edbc c\u00e1c b\u01b0\u1edbc n\u1eb7ng; JSON l\u1edbn kh\u00f4ng c\u1ea7n thi\u1ebft l\u00e0m t\u0103ng CPU, RAM.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"Gi\u00e1m_s\u00e1t_v\u00e0_theo_d\u00f5i_hi\u1ec7u_su\u1ea5t\">Gi\u00e1m s\u00e1t v\u00e0 theo d\u00f5i hi\u1ec7u su\u1ea5t<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Gi\u00e1m s\u00e1t gi\u00fap b\u1ea1n bi\u1ebft n\u00ean t\u1ed1i \u01b0u \u1edf \u0111\u00e2u thay v\u00ec \u0111o\u00e1n. n8n xu\u1ea5t s\u1ed1 li\u1ec7u cho Prometheus khi \u0111\u1eb7t <code>N8N_METRICS=true<\/code>; endpoint \/metrics ch\u1ec9 n\u00ean m\u1edf cho d\u1ecbch v\u1ee5 n\u1ed9i b\u1ed9, kh\u00f4ng c\u00f4ng khai ra Internet (<a href=\"https:\/\/docs.n8n.io\/deploy\/host-n8n\/configure-n8n\/basic-configuration\/configuration-examples\/enable-prometheus-metrics\" target=\"_blank\" rel=\"noopener nofollow\">Enable Prometheus metrics<\/a>). K\u1ebft n\u1ed1i Prometheus v\u1edbi Grafana \u0111\u1ec3 xem s\u1ed1 li\u1ec7u theo th\u1eddi gian.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>CPU, RAM:<\/strong> d\u00f9ng nhi\u1ec1u li\u00ean t\u1ee5c ho\u1eb7c ph\u1ea3i d\u00f9ng swap l\u00e0 d\u1ea5u hi\u1ec7u c\u1ea7n t\u1ed1i \u01b0u workflow ho\u1eb7c t\u0103ng t\u00e0i nguy\u00ean.<\/li>\n\n\n<li><strong>\u1ed4 \u0111\u0129a:<\/strong> I\/O cao th\u01b0\u1eddng do database qu\u00e1 t\u1ea3i ho\u1eb7c x\u1eed l\u00fd nhi\u1ec1u file l\u1edbn; theo d\u00f5i c\u1ea3 dung l\u01b0\u1ee3ng tr\u1ed1ng.<\/li>\n\n\n<li><strong>S\u1ed1 execution v\u00e0 th\u1eddi gian ch\u1ea1y:<\/strong> s\u1ed1 l\u01b0\u1ee3t ch\u1edd trong h\u00e0ng \u0111\u1ee3i t\u0103ng ho\u1eb7c th\u1eddi gian ch\u1ea1y trung b\u00ecnh t\u0103ng l\u00e0 l\u00fac c\u00e2n nh\u1eafc th\u00eam worker.<\/li>\n\n\n<li><strong>C\u00f4ng c\u1ee5 nhanh tr\u00ean m\u00e1y ch\u1ee7:<\/strong> <code>htop<\/code>, <code>docker stats<\/code> \u0111\u1ec3 xem t\u00e0i nguy\u00ean t\u1eebng container.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"B\u1ea3o_m\u1eadt_v\u00e0_c\u1eadp_nh\u1eadt\">B\u1ea3o m\u1eadt v\u00e0 c\u1eadp nh\u1eadt<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>C\u1eadp nh\u1eadt n8n \u0111\u1ecbnh k\u1ef3:<\/strong> b\u1ea3n m\u1edbi c\u00f3 c\u1ea3i ti\u1ebfn hi\u1ec7u n\u0103ng v\u00e0 b\u1ea3n v\u00e1 b\u1ea3o m\u1eadt; sao l\u01b0u tr\u01b0\u1edbc khi n\u00e2ng. Xem <a href=\"https:\/\/tino.vn\/blog\/cach-cap-nhat-n8n\/\">c\u00e1ch c\u1eadp nh\u1eadt n8n<\/a>.<\/li>\n\n\n<li><strong>C\u1eadp nh\u1eadt h\u1ec7 \u0111i\u1ec1u h\u00e0nh, Docker, PostgreSQL, Redis<\/strong> \u0111\u1ec3 c\u00f3 b\u1ea3n v\u00e1 \u1edf c\u1ea5p h\u1ec7 th\u1ed1ng.<\/li>\n\n\n<li><strong>Kh\u00f4ng m\u1edf c\u1ed5ng 5678 ra Internet:<\/strong> d\u00f9ng reverse proxy (Nginx, Caddy) c\u00f3 HTTPS, ho\u1eb7c <a href=\"https:\/\/developers.cloudflare.com\/cloudflare-one\/networks\/connectors\/cloudflare-tunnel\/\" target=\"_blank\" rel=\"noopener nofollow\">Cloudflare Tunnel<\/a> khi kh\u00f4ng mu\u1ed1n m\u1edf c\u1ed5ng tr\u00ean t\u01b0\u1eddng l\u1eeda. Nh\u1edb \u0111\u1eb7t <code>N8N_WEBHOOK_URL<\/code> (n8n t\u1eeb 2.30.0) b\u1eb1ng \u0111\u1ecba ch\u1ec9 c\u00f4ng khai.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"K\u1ebft_lu\u1eadn\">K\u1ebft lu\u1eadn<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">T\u1ed1i \u01b0u n8n self-host hi\u1ec7u qu\u1ea3 nh\u1ea5t khi l\u00e0m theo th\u1ee9 t\u1ef1: PostgreSQL, d\u1ecdn d\u1eef li\u1ec7u execution, gi\u1edbi h\u1ea1n l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi, binary data ra \u1ed5 \u0111\u0129a, r\u1ed3i m\u1edbi queue mode. Song song \u0111\u00f3, r\u00fat g\u1ecdn d\u1eef li\u1ec7u trong workflow v\u00e0 b\u1eadt gi\u00e1m s\u00e1t \u0111\u1ec3 c\u00f3 s\u1ed1 li\u1ec7u tr\u01b0\u1edbc khi n\u00e2ng c\u1ea5p VPS.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Mu\u1ed1n ch\u1ea1y n8n 24\/7 m\u00e0 kh\u00f4ng t\u1ef1 c\u00e0i? <a href=\"https:\/\/tino.vn\/vps-n8n\">VPS n8n c\u1ee7a Tino<\/a> c\u00e0i s\u1eb5n n8n tr\u00ean VPS NVMe \u0111\u1eb7t t\u1ea1i Vi\u1ec7t Nam; b\u1ea1n v\u1eabn c\u00f3 quy\u1ec1n root \u0111\u1ec3 c\u1ea5u h\u00ecnh. Xem c\u1ea5u h\u00ecnh v\u00e0 gi\u00e1 tr\u00ean trang s\u1ea3n ph\u1ea9m.<\/p>\n<\/blockquote>\n\n\n\n<h2 id=\"Nh\u1eefng_c\u00e2u_h\u1ecfi_th\u01b0\u1eddng_g\u1eb7p\">Nh\u1eefng c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p<\/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=\"T\u1ea1i_sao_n\u00ean_s\u1eed_d\u1ee5ng_PostgreSQL_thay_v\u00ec_SQLite_cho_n8n_self-host?\">T\u1ea1i sao n\u00ean s\u1eed d\u1ee5ng PostgreSQL thay v\u00ec SQLite cho n8n self-host?<\/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\">SQLite l\u00e0 database m\u1eb7c \u0111\u1ecbnh, h\u1ee3p v\u1edbi c\u00e0i \u0111\u1eb7t nh\u1ecf. Khi nhi\u1ec1u execution, SQLite x\u1eed l\u00fd \u0111\u1ed3ng th\u1eddi k\u00e9m v\u00e0 file ph\u00ecnh to. PostgreSQL (n8n h\u1ed7 tr\u1ee3 b\u1ea3n 16\u201318) x\u1eed l\u00fd \u0111\u1ed3ng th\u1eddi t\u1ed1t h\u01a1n v\u00e0 l\u00e0 \u0111i\u1ec1u ki\u1ec7n \u0111\u1ec3 ch\u1ea1y queue mode. MySQL kh\u00f4ng c\u00f2n \u0111\u01b0\u1ee3c h\u1ed7 tr\u1ee3 l\u00e0m database t\u1eeb n8n 2.0.<\/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=\"Redis_\u0111\u00f3ng_vai_tr\u00f2_g\u00ec_trong_vi\u1ec7c_t\u1ed1i_\u01b0u_hi\u1ec7u_su\u1ea5t_n8n?\">Redis \u0111\u00f3ng vai tr\u00f2 g\u00ec trong vi\u1ec7c t\u1ed1i \u01b0u hi\u1ec7u su\u1ea5t n8n?<\/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\">Trong n8n, Redis ch\u1ee7 y\u1ebfu l\u00e0m h\u00e0ng \u0111\u1ee3i cho queue mode: main \u0111\u1ea9y m\u00e3 execution v\u00e0o Redis, worker l\u1ea5y ra \u0111\u1ec3 ch\u1ea1y. Kh\u00f4ng ch\u1ea1y queue mode th\u00ec n8n kh\u00f4ng c\u1ea7n Redis.<\/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=\"T\u1ea1i_sao_n8n_c\u1ee7a_t\u00f4i_ch\u1ea1y_ch\u1eadm_ho\u1eb7c_treo_khi_x\u1eed_l\u00fd_nhi\u1ec1u_workflow?\">T\u1ea1i sao n8n c\u1ee7a t\u00f4i ch\u1ea1y ch\u1eadm ho\u1eb7c treo khi x\u1eed l\u00fd nhi\u1ec1u workflow?<\/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\">Th\u01b0\u1eddng do thi\u1ebfu RAM, database SQLite qu\u00e1 l\u1edbn v\u00ec gi\u1eef nhi\u1ec1u execution, qu\u00e1 nhi\u1ec1u l\u01b0\u1ee3t ch\u1ea1y c\u00f9ng l\u00fac ho\u1eb7c workflow truy\u1ec1n d\u1eef li\u1ec7u th\u1eeba. Ki\u1ec3m tra theo th\u1ee9 t\u1ef1 trong b\u1ea3ng c\u1ee7a b\u00e0i tr\u01b0\u1edbc khi n\u00e2ng c\u1ea5p 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\u1ebf_\u0111\u1ed9_queue_mode_trong_n8n_l\u00e0_g\u00ec_v\u00e0_khi_n\u00e0o_n\u00ean_s\u1eed_d\u1ee5ng_n\u00f3?\">Ch\u1ebf \u0111\u1ed9 queue mode trong n8n l\u00e0 g\u00ec v\u00e0 khi n\u00e0o n\u00ean s\u1eed d\u1ee5ng n\u00f3?<\/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\">Queue mode t\u00e1ch ph\u1ea7n th\u1ef1c thi workflow sang c\u00e1c worker, d\u00f9ng Redis l\u00e0m h\u00e0ng \u0111\u1ee3i v\u00e0 PostgreSQL l\u00e0m database. N\u00ean d\u00f9ng khi \u0111\u00e3 t\u1ed1i \u01b0u database, d\u1eef li\u1ec7u execution v\u00e0 l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi m\u00e0 m\u1ed9t ti\u1ebfn tr\u00ecnh n8n v\u1eabn kh\u00f4ng \u0111\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=\"Bi\u1ebfn_N8N_EXECUTION_MODE_hay_EXECUTIONS_MODE_m\u1edbi_\u0111\u00fang?\">Bi\u1ebfn N8N_EXECUTION_MODE hay EXECUTIONS_MODE m\u1edbi \u0111\u00fang?<\/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\">EXECUTIONS_MODE m\u1edbi \u0111\u00fang, v\u1edbi gi\u00e1 tr\u1ecb regular ho\u1eb7c queue. Bi\u1ebfn N8N_EXECUTION_MODE v\u00e0 N8N_MAX_CONCURRENT_WORKFLOWS kh\u00f4ng c\u00f3 trong t\u00e0i li\u1ec7u n8n; \u0111\u1ec3 gi\u1edbi h\u1ea1n l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi d\u00f9ng N8N_CONCURRENCY_PRODUCTION_LIMIT ho\u1eb7c c\u1edd &#8211;concurrency c\u1ee7a worker.<\/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=\"Vi\u1ec7c_c\u1eadp_nh\u1eadt_n8n_c\u00f3_\u1ea3nh_h\u01b0\u1edfng_\u0111\u1ebfn_hi\u1ec7u_su\u1ea5t_kh\u00f4ng?\">Vi\u1ec7c c\u1eadp nh\u1eadt n8n c\u00f3 \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn hi\u1ec7u su\u1ea5t 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\">C\u00f3. B\u1ea3n m\u1edbi th\u01b0\u1eddng c\u00f3 c\u1ea3i ti\u1ebfn hi\u1ec7u n\u0103ng v\u00e0 b\u1ea3n v\u00e1 b\u1ea3o m\u1eadt. Sao l\u01b0u database v\u00e0 th\u01b0 m\u1ee5c .n8n tr\u01b0\u1edbc khi c\u1eadp nh\u1eadt, v\u00e0 \u0111\u1ecdc thay \u0111\u1ed5i l\u1edbn khi l\u00ean b\u1ea3n ch\u00ednh m\u1edbi.<\/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\": \"T\u1ea1i sao n\u00ean s\u1eed d\u1ee5ng PostgreSQL thay v\u00ec SQLite cho n8n self-host?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>SQLite l\u00e0 database m\u1eb7c \u0111\u1ecbnh, h\u1ee3p v\u1edbi c\u00e0i \u0111\u1eb7t nh\u1ecf. Khi nhi\u1ec1u execution, SQLite x\u1eed l\u00fd \u0111\u1ed3ng th\u1eddi k\u00e9m v\u00e0 file ph\u00ecnh to. PostgreSQL (n8n h\u1ed7 tr\u1ee3 b\u1ea3n 16\u201318) x\u1eed l\u00fd \u0111\u1ed3ng th\u1eddi t\u1ed1t h\u01a1n v\u00e0 l\u00e0 \u0111i\u1ec1u ki\u1ec7n \u0111\u1ec3 ch\u1ea1y queue mode. MySQL kh\u00f4ng c\u00f2n \u0111\u01b0\u1ee3c h\u1ed7 tr\u1ee3 l\u00e0m database t\u1eeb n8n 2.0.<\/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\": \"Redis \u0111\u00f3ng vai tr\u00f2 g\u00ec trong vi\u1ec7c t\u1ed1i \u01b0u hi\u1ec7u su\u1ea5t n8n?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Trong n8n, Redis ch\u1ee7 y\u1ebfu l\u00e0m h\u00e0ng \u0111\u1ee3i cho queue mode: main \u0111\u1ea9y m\u00e3 execution v\u00e0o Redis, worker l\u1ea5y ra \u0111\u1ec3 ch\u1ea1y. Kh\u00f4ng ch\u1ea1y queue mode th\u00ec n8n kh\u00f4ng c\u1ea7n Redis.<\/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\": \"T\u1ea1i sao n8n c\u1ee7a t\u00f4i ch\u1ea1y ch\u1eadm ho\u1eb7c treo khi x\u1eed l\u00fd nhi\u1ec1u workflow?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Th\u01b0\u1eddng do thi\u1ebfu RAM, database SQLite qu\u00e1 l\u1edbn v\u00ec gi\u1eef nhi\u1ec1u execution, qu\u00e1 nhi\u1ec1u l\u01b0\u1ee3t ch\u1ea1y c\u00f9ng l\u00fac ho\u1eb7c workflow truy\u1ec1n d\u1eef li\u1ec7u th\u1eeba. Ki\u1ec3m tra theo th\u1ee9 t\u1ef1 trong b\u1ea3ng c\u1ee7a b\u00e0i tr\u01b0\u1edbc khi n\u00e2ng c\u1ea5p 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\u1ebf \u0111\u1ed9 queue mode trong n8n l\u00e0 g\u00ec v\u00e0 khi n\u00e0o n\u00ean s\u1eed d\u1ee5ng n\u00f3?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Queue mode t\u00e1ch ph\u1ea7n th\u1ef1c thi workflow sang c\u00e1c worker, d\u00f9ng Redis l\u00e0m h\u00e0ng \u0111\u1ee3i v\u00e0 PostgreSQL l\u00e0m database. N\u00ean d\u00f9ng khi \u0111\u00e3 t\u1ed1i \u01b0u database, d\u1eef li\u1ec7u execution v\u00e0 l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi m\u00e0 m\u1ed9t ti\u1ebfn tr\u00ecnh n8n v\u1eabn kh\u00f4ng \u0111\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\": \"Bi\u1ebfn N8N_EXECUTION_MODE hay EXECUTIONS_MODE m\u1edbi \u0111\u00fang?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>EXECUTIONS_MODE m\u1edbi \u0111\u00fang, v\u1edbi gi\u00e1 tr\u1ecb regular ho\u1eb7c queue. Bi\u1ebfn N8N_EXECUTION_MODE v\u00e0 N8N_MAX_CONCURRENT_WORKFLOWS kh\u00f4ng c\u00f3 trong t\u00e0i li\u1ec7u n8n; \u0111\u1ec3 gi\u1edbi h\u1ea1n l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi d\u00f9ng N8N_CONCURRENCY_PRODUCTION_LIMIT ho\u1eb7c c\u1edd --concurrency c\u1ee7a worker.<\/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\": \"Vi\u1ec7c c\u1eadp nh\u1eadt n8n c\u00f3 \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn hi\u1ec7u su\u1ea5t kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>C\u00f3. B\u1ea3n m\u1edbi th\u01b0\u1eddng c\u00f3 c\u1ea3i ti\u1ebfn hi\u1ec7u n\u0103ng v\u00e0 b\u1ea3n v\u00e1 b\u1ea3o m\u1eadt. Sao l\u01b0u database v\u00e0 th\u01b0 m\u1ee5c .n8n tr\u01b0\u1edbc khi c\u1eadp nh\u1eadt, v\u00e0 \u0111\u1ecdc thay \u0111\u1ed5i l\u1edbn khi l\u00ean b\u1ea3n ch\u00ednh m\u1edbi.<\/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>Mu\u1ed1n n8n self-host ch\u1ea1y nhanh v\u00e0 \u1ed5n \u0111\u1ecbnh, h\u00e3y l\u00e0m theo th\u1ee9 t\u1ef1: chuy\u1ec3n database sang PostgreSQL, b\u1eadt t\u1ef1 d\u1ecdn d\u1eef li\u1ec7u execution c\u0169, gi\u1edbi h\u1ea1n s\u1ed1 l\u01b0\u1ee3t ch\u1ea1y \u0111\u1ed3ng th\u1eddi, l\u01b0u file nh\u1ecb ph\u00e2n ra \u1ed5 \u0111\u0129a, r\u1ed3i m\u1edbi t\u00e1ch queue mode v\u1edbi Redis v\u00e0 worker khi m\u1ed9t ti\u1ebfn tr\u00ecnh kh\u00f4ng c\u00f2n \u0111\u1ee7. M\u1ed7i [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":116939,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7397],"tags":[7343],"class_list":["post-116924","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-n8n","tag-n8n"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/116924","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=116924"}],"version-history":[{"count":9,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/116924\/revisions"}],"predecessor-version":[{"id":131888,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/116924\/revisions\/131888"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/116939"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=116924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/categories?post=116924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=116924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}