From 2b9efe3974be189aac46ad151095addbc5cdd99e Mon Sep 17 00:00:00 2001 From: Zoey de Souza Pessanha Date: Tue, 6 Feb 2024 19:52:24 -0300 Subject: [PATCH 1/2] =?UTF-8?q?submiss=C3=A3o=20elixiremfoco?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- participantes/elixiremfoco/README.md | 22 ++++++ participantes/elixiremfoco/docker-compose.yml | 73 +++++++++++++++++++ participantes/elixiremfoco/nginx.conf | 22 ++++++ 3 files changed, 117 insertions(+) create mode 100644 participantes/elixiremfoco/README.md create mode 100644 participantes/elixiremfoco/docker-compose.yml create mode 100644 participantes/elixiremfoco/nginx.conf diff --git a/participantes/elixiremfoco/README.md b/participantes/elixiremfoco/README.md new file mode 100644 index 000000000..9b76a6ee5 --- /dev/null +++ b/participantes/elixiremfoco/README.md @@ -0,0 +1,22 @@ +# Submissão para Rinha de Backend, Segunda Edição: 2024/Q1 - Controle de Concorrência + +
+ logo nginx + logo elixir + logo postgres + logo phoenix +
+ +## Matheus Lobo + +Submissão feita com: + +- `nginx` como load balancer +- `postgres` como banco de dados +- `elixir` para api com a lib `phoenix` +- [repositório da api](https://github.com/ElixiremFoco/rinha-backend-2024-q1) + +100% success rate, 11ms mean response time + +[@herminiotorres](https://twitter.com/herminiotorres)@twitter +[@zoedsoupe](https://bsky.app/profile/zoedsoupe.bsky.social)@bsky diff --git a/participantes/elixiremfoco/docker-compose.yml b/participantes/elixiremfoco/docker-compose.yml new file mode 100644 index 000000000..6af515542 --- /dev/null +++ b/participantes/elixiremfoco/docker-compose.yml @@ -0,0 +1,73 @@ +version: "3.5" + +services: + api01: &api + image: ghcr.io/elixiremfoco/rinha-backend-2024-q1:latest + hostname: api01 + environment: + - PHX_HOST=api01 + - SECRET_KEY_BASE="HScbRLB0u8vOQAMWLC2DFHdrpnMKcGEs" + - DATABASE_URL=postgresql://postgres:postgres@db:5432/rinha + + ports: + - "4000:4000" + depends_on: + db: + condition: service_healthy + deploy: + resources: + limits: + cpus: "0.6" + memory: "200MB" + + api02: + <<: *api + hostname: api02 + environment: + - PORT=4001 + - PHX_HOST=api02 + - SECRET_KEY_BASE="ZufWuBc1xg3ssETNHHB14bZ1PKM1mruC" + - DATABASE_URL=postgresql://postgres:postgres@db:5432/rinha + ports: + - "4001:4001" + + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - api01 + - api02 + ports: + - "9999:9999" + deploy: + resources: + limits: + cpus: "0.17" + memory: "10MB" + + db: + image: postgres:latest + hostname: db + environment: + - POSTGRES_PASSWORD=postgres + - POSTGRES_USER=postgres + - POSTGRES_DB=rinha + ports: + - "5432:5432" + deploy: + resources: + limits: + cpus: "0.13" + memory: "140MB" + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres -d rinha" ] + interval: 3s + timeout: 1s + retries: 2 + +networks: + default: + driver: bridge + name: rinha-nginx-2024q1 + diff --git a/participantes/elixiremfoco/nginx.conf b/participantes/elixiremfoco/nginx.conf new file mode 100644 index 000000000..4b529ddd4 --- /dev/null +++ b/participantes/elixiremfoco/nginx.conf @@ -0,0 +1,22 @@ +events { + worker_connections 1000; +} + +http { + access_log off; + sendfile on; + + upstream api { + server api01:4000; + server api02:4001; + } + + server { + listen 9999; + + location / { + proxy_pass http://api; + } + } +} + From 807758367d2ca95c36714b8e80567ec9a76d3d65 Mon Sep 17 00:00:00 2001 From: Zoey de Souza Pessanha Date: Tue, 6 Feb 2024 19:54:06 -0300 Subject: [PATCH 2/2] Update README.md --- participantes/elixiremfoco/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/participantes/elixiremfoco/README.md b/participantes/elixiremfoco/README.md index 9b76a6ee5..bc6707a9e 100644 --- a/participantes/elixiremfoco/README.md +++ b/participantes/elixiremfoco/README.md @@ -7,7 +7,7 @@ logo phoenix -## Matheus Lobo +## Elixir em Foco Submissão feita com: @@ -18,5 +18,6 @@ Submissão feita com: 100% success rate, 11ms mean response time +[portal elixiremfoco](https://www.elixiremfoco.com/) [@herminiotorres](https://twitter.com/herminiotorres)@twitter [@zoedsoupe](https://bsky.app/profile/zoedsoupe.bsky.social)@bsky