Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "perf: bandit adaptor (#2204)" #2230

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,6 @@ config :logflare, Logflare.Source.BigQuery.Schema, updates_per_minute: 6

# Configures the endpoint
config :logflare, LogflareWeb.Endpoint,
adapter: Bandit.PhoenixAdapter,
http: [
thousand_island_options: [
# https://cloud.google.com/load-balancing/docs/https/#timeouts_and_retries
# preserves idle keepalive connections up to load balancer max of 600s
read_timeout: 600_000,
# transport options are passed wholly to :gen_tcp
# https://github.com/mtrudel/thousand_island/blob/ae733332892b1bb2482a9cf4e97de03411fba2ad/lib/thousand_island/transports/tcp.ex#L61
transport_options: [
# https://www.erlang.org/doc/man/inet
# both reuseport and reuseport_lb should be provided for linux
reuseport: true,
reuseport_lb: true
#
]
]
],
url: [host: "localhost", scheme: "http", port: 4000],
secret_key_base: "DSzZYeAgGaXlfRXPQqMOPiA8hJOYSImhnR2lO8lREOE2vWDmkGn1XWHxoCZoASlP",
render_errors: [view: LogflareWeb.ErrorView, accepts: ~w(html json)],
Expand Down
9 changes: 8 additions & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ config :logflare,
config :logflare, LogflareWeb.Endpoint,
server: true,
http: [
port: System.get_env("PORT") || 4000
port: System.get_env("PORT") || 4000,
transport_options: [
max_connections: 16_384,
num_acceptors: 100,
socket_opts: [{:raw, 0xFFFF, 0x0200, <<1::32-native>>}]
],
protocol_options: [max_keepalive: 1_000],
compress: true
],
live_view: [
signing_salt: "eVpFFmpN+OHPrilThexLilWnF+a8zBLbCtdH/OzAayShcm1B3OHOyGiadM6qOezp"
Expand Down
19 changes: 18 additions & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,24 @@ config :logflare, env: :prod

config :logflare, LogflareWeb.Endpoint,
http: [
port: 4000
port: 4000,
transport_options: [
max_connections: 64_000,
num_acceptors: 1_000,
# for so_reuseport
socket_opts: [{:raw, 1, 15, <<1::32-native>>}]
],
# https://blog.percy.io/tuning-nginx-behind-google-cloud-platform-http-s-load-balancer-305982ddb340
# https://github.com/ninenines/cowboy/issues/1286#issuecomment-699643478
protocol_options: [
# https://ninenines.eu/docs/en/cowboy/2.8/manual/cowboy_http/
request_timeout: 30_000,
# https://cloud.google.com/load-balancing/docs/https/#timeouts_and_retries
# must be greater than 600s
idle_timeout: 650_000,
max_keepalive: :infinity
],
compress: true
],
cache_static_manifest: "priv/static/cache_manifest.json",
server: true,
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test.only": :test,
"test.format": :test,
"test.compile": :test,
"test.security": :test,

Check warning on line 20 in mix.exs

View workflow job for this annotation

GitHub Actions / Checks (Code Quality - Linting, mix lint --only warnings)

~R/.../ is deprecated, use ~r/.../ instead

Check warning on line 20 in mix.exs

View workflow job for this annotation

GitHub Actions / Checks (Code Quality - Formatting, mix test.format)

~R/.../ is deprecated, use ~r/.../ instead

Check warning on line 20 in mix.exs

View workflow job for this annotation

GitHub Actions / Checks (Compilation Warnings, mix test.compile)

~R/.../ is deprecated, use ~r/.../ instead

Check warning on line 20 in mix.exs

View workflow job for this annotation

GitHub Actions / Checks (Tests, mix do ecto.create, ecto.migrate, test)

~R/.../ is deprecated, use ~r/.../ instead
"test.typings": :test,
coveralls: :test,
"coveralls.detail": :test,
Expand Down Expand Up @@ -72,13 +72,13 @@
defp deps do
[
# Phoenix stuff
{:phoenix, "~> 1.7.14"},
{:phoenix, "~> 1.7"},
{:phoenix_live_view, "~> 0.18"},
{:phoenix_view, "~> 2.0"},
{:phoenix_pubsub, "~> 2.1"},
{:phoenix_ecto, "~> 4.4"},
{:phoenix_live_reload, "~> 1.4", only: :dev},
{:bandit, "~> 1.5.7"},
{:bandit, ">= 0.7.7"},
{:plug_crypto, "~> 1.2.2"},
{:cors_plug, "~> 2.0"},
{:plug_caisson, "~> 0.2.1"},
Expand Down
Loading
Loading