-
-
Save maierru/d4cb7d0124d2eece80bd07b7a51ad31b to your computer and use it in GitHub Desktop.
Phoenix (elixir) highload optimization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config :hlcup, HlcupWeb.Endpoint, | |
# https://hexdocs.pm/phoenix/endpoint.html => ctrl-f => load_from_system_env | |
# Let's see from my app Endpont (HlcupWeb.Endpoint) | |
# def init(_key, config) do | |
# if config[:load_from_system_env] do | |
# port = System.get_env("PORT") || raise "expected the PORT environment variable to be set" | |
# {:ok, Keyword.put(config, :http, [:inet6, port: port])} | |
# else | |
# {:ok, config} | |
# end | |
# end | |
# if load_from_system_env is true => http options don't use. | |
load_from_system_env: false, | |
# https://hexdocs.pm/plug/Plug.Adapters.Cowboy.html | |
http: [ | |
ip: {0,0,0,0}, | |
port: 80, | |
acceptors: 2500, | |
max_connections: :infinity, | |
timeout: 2000, | |
# https://ninenines.eu/docs/en/cowboy/1.0/manual/cowboy_protocol/ | |
protocol_options: [{:max_keepalive, 20000000},{:timeout, 2000}] | |
], | |
url: [host: "travels.com", port: 80], | |
cache_static_manifest: "priv/static/cache_manifest.json", | |
server: true, | |
root: ".", | |
version: Application.spec(:hlcup, :vsn) | |
# remove any unimportant logger function output from code at compilation | |
config :logger, level: :error, compile_time_purge_level: :error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Move erts IO Polling to dedicated threads | |
# https://github.com/erlang/otp/pull/1552 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> :inet.i() | |
> Application.get_env(:hlcup, HlcupWeb.Endpoint) | |
> :ets.lookup(:"Elixir.HlcupWeb.Endpoint", :http) | |
> :erlang.system_info(:process_limit) | |
> :erlang.system_info(:port_limit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/bitwalker/distillery/blob/master/docs/Walkthrough.md | |
$ MIX_ENV=prod mix release --erl="+K true +stbt db" --env=prod --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/knutin/elli | |
# Not Sure for this | |
# https://github.com/zampino/pastelli | |
# https://github.com/zampino/pastelli_phoenix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use phoenix_jiffy instead of Poison - it's faster! | |
# https://hex.pm/packages/phoenix_jiffy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment