From bfaa5e4996bc858900650ad144fcc8ef86b9bfb8 Mon Sep 17 00:00:00 2001 From: Arthur Werbrouck Date: Fri, 2 Aug 2024 12:00:54 +0200 Subject: [PATCH 1/8] doc: improve startup time by limiting file descriptors --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 7dcb9ac..581ac60 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ The Dispatcher runs as an application in which the `Dispatcher` module is overri 1. [Host an EmberJS app](#Host-an-EmberJS-app) 2. [External API CORS headers](#External-API-CORS-headers) 3. [Provide 404 pages](#Provide-404-pages) + 4. [Fix slow startup time](#fix-slow-startup-time) 7. [Architecture](#Architecture) 1. [forwarding connections with plug_mint_proxy](#Forwarding-Connections) 2. [Wiring with Plug](#Wiring-with-Plug) @@ -465,6 +466,22 @@ defmodule Dispatcher do end end ``` +### fix slow startup times +On recent kernels you have to limit file descriptors for elixir services via ulimit to decrease the startup time. + +In `/etc/docker/deamon.json` add the following +```json +{ + "default-ulimits": { + "nofile": { + "Hard": 104583, + "Name": "nofile", + "Soft": 104583 + } + }, + <...> +} +``` ## Architecture From 4e50cb771b46a0b05f8dd02f658af7de2b8ca6a9 Mon Sep 17 00:00:00 2001 From: Arthur Werbrouck Date: Fri, 2 Aug 2024 12:02:24 +0200 Subject: [PATCH 2/8] chore: Fix typo in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 581ac60..e3e5520 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The Dispatcher runs as an application in which the `Dispatcher` module is overri 1. [Host an EmberJS app](#Host-an-EmberJS-app) 2. [External API CORS headers](#External-API-CORS-headers) 3. [Provide 404 pages](#Provide-404-pages) - 4. [Fix slow startup time](#fix-slow-startup-time) + 4. [Fix slow startup time](#fix-slow-startup-times) 7. [Architecture](#Architecture) 1. [forwarding connections with plug_mint_proxy](#Forwarding-Connections) 2. [Wiring with Plug](#Wiring-with-Plug) @@ -479,7 +479,7 @@ In `/etc/docker/deamon.json` add the following "Soft": 104583 } }, - <...> + ... } ``` From 804e6bfa3da885aa0939a54057492edba26a5978 Mon Sep 17 00:00:00 2001 From: Arthur Werbrouck Date: Fri, 2 Aug 2024 12:03:50 +0200 Subject: [PATCH 3/8] chore: Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e3e5520..e85ca5a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The Dispatcher runs as an application in which the `Dispatcher` module is overri 1. [Host an EmberJS app](#Host-an-EmberJS-app) 2. [External API CORS headers](#External-API-CORS-headers) 3. [Provide 404 pages](#Provide-404-pages) - 4. [Fix slow startup time](#fix-slow-startup-times) + 4. [Fix slow startup times](#fix-slow-startup-times) 7. [Architecture](#Architecture) 1. [forwarding connections with plug_mint_proxy](#Forwarding-Connections) 2. [Wiring with Plug](#Wiring-with-Plug) From 788f88d8619b89f835015cf23e08538151e040a9 Mon Sep 17 00:00:00 2001 From: Arthur Werbrouck Date: Fri, 2 Aug 2024 12:32:41 +0200 Subject: [PATCH 4/8] Improve README: Add steps to fix slow start times for Elixir services --- README.md | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e85ca5a..cf17108 100644 --- a/README.md +++ b/README.md @@ -466,22 +466,35 @@ defmodule Dispatcher do end end ``` -### fix slow startup times -On recent kernels you have to limit file descriptors for elixir services via ulimit to decrease the startup time. - -In `/etc/docker/deamon.json` add the following -```json -{ - "default-ulimits": { - "nofile": { - "Hard": 104583, - "Name": "nofile", - "Soft": 104583 - } - }, - ... -} -``` +### Fix Slow Start Times + +If you are experiencing slow start times (5-10 minutes) with Elixir services on recent kernels, you may need to limit file descriptors via `ulimit`. Follow these steps to decrease the startup time: + +1. **Edit Docker Daemon Configuration**: + + Open the Docker daemon configuration file located at `/etc/docker/daemon.json` and add the following configuration: + + ```json + { + "default-ulimits": { + "nofile": { + "Hard": 104583, + "Name": "nofile", + "Soft": 104583 + } + } + } + ``` + +2. **Restart Docker**: + + After updating the configuration, restart the Docker service to apply the changes: + + ```sh + sudo systemctl restart docker + ``` + +By setting the `nofile` ulimit, you can significantly reduce the startup time for your Elixir services. ## Architecture From 18be1ba6417f96c68b9d4d0629384d4321f73cbf Mon Sep 17 00:00:00 2001 From: Arthur Werbrouck Date: Fri, 2 Aug 2024 12:36:27 +0200 Subject: [PATCH 5/8] chore: fixed typos --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cf17108..179be55 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The Dispatcher runs as an application in which the `Dispatcher` module is overri 1. [Host an EmberJS app](#Host-an-EmberJS-app) 2. [External API CORS headers](#External-API-CORS-headers) 3. [Provide 404 pages](#Provide-404-pages) - 4. [Fix slow startup times](#fix-slow-startup-times) + 4. [Fix slow start times](#fix-slow-start-times) 7. [Architecture](#Architecture) 1. [forwarding connections with plug_mint_proxy](#Forwarding-Connections) 2. [Wiring with Plug](#Wiring-with-Plug) @@ -35,7 +35,7 @@ The Dispatcher runs as an application in which the `Dispatcher` module is overri ### Configuration The disptacher is configured using the dispatcher.ex file in a [mu-project](https://github.com/mu-semtech/mu-project). - +Improve The basic (default) configuration of the mu-dispatcher is an Elixir module named `Dispatcher` which uses the `Matcher` functionality. An empty set of accept types is required (`define_accept_types []`). @@ -466,7 +466,7 @@ defmodule Dispatcher do end end ``` -### Fix Slow Start Times +### Fix slow start times If you are experiencing slow start times (5-10 minutes) with Elixir services on recent kernels, you may need to limit file descriptors via `ulimit`. Follow these steps to decrease the startup time: From 832e5b050ae4c06773b85bd65a3449288702fedc Mon Sep 17 00:00:00 2001 From: Arthur Werbrouck Date: Fri, 2 Aug 2024 12:54:29 +0200 Subject: [PATCH 6/8] chore: cleanup --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 179be55..2bb6581 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,6 @@ The Dispatcher runs as an application in which the `Dispatcher` module is overri ### Configuration The disptacher is configured using the dispatcher.ex file in a [mu-project](https://github.com/mu-semtech/mu-project). -Improve The basic (default) configuration of the mu-dispatcher is an Elixir module named `Dispatcher` which uses the `Matcher` functionality. An empty set of accept types is required (`define_accept_types []`). @@ -468,7 +467,7 @@ end ``` ### Fix slow start times -If you are experiencing slow start times (5-10 minutes) with Elixir services on recent kernels, you may need to limit file descriptors via `ulimit`. Follow these steps to decrease the startup time: +If you are experiencing slow start times (5-10 minutes) with Elixir services such as mu-dispatcher. on recent kernels, you may need to limit file descriptors via `ulimit`. Follow these steps to decrease the startup time: 1. **Edit Docker Daemon Configuration**: @@ -478,9 +477,9 @@ If you are experiencing slow start times (5-10 minutes) with Elixir services on { "default-ulimits": { "nofile": { - "Hard": 104583, - "Name": "nofile", - "Soft": 104583 + "Name": "nofile", + "Soft": 104583, + "Hard": 104583 } } } From 9e4eda89abb6a6d706160572db959d5e0aa9b24b Mon Sep 17 00:00:00 2001 From: Arthur Werbrouck Date: Fri, 9 Aug 2024 10:35:06 +0200 Subject: [PATCH 7/8] Update README.md Co-authored-by: Riad Abdallah --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2bb6581..c72eda7 100644 --- a/README.md +++ b/README.md @@ -467,7 +467,7 @@ end ``` ### Fix slow start times -If you are experiencing slow start times (5-10 minutes) with Elixir services such as mu-dispatcher. on recent kernels, you may need to limit file descriptors via `ulimit`. Follow these steps to decrease the startup time: +If you are experiencing slow start times (5-10 minutes) with Elixir services such as mu-dispatcher on recent kernels, you may need to limit file descriptors via `ulimit`: 1. **Edit Docker Daemon Configuration**: From bd8c45958c09729afd809d926234230c08e1193d Mon Sep 17 00:00:00 2001 From: Arthur Werbrouck Date: Fri, 9 Aug 2024 10:37:29 +0200 Subject: [PATCH 8/8] Remove duplicates as suggested by @Riadabd --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c72eda7..9fe16be 100644 --- a/README.md +++ b/README.md @@ -493,7 +493,6 @@ If you are experiencing slow start times (5-10 minutes) with Elixir services suc sudo systemctl restart docker ``` -By setting the `nofile` ulimit, you can significantly reduce the startup time for your Elixir services. ## Architecture