From af5a4d0f934d5e7da1bfc2da0b05948820c637ad Mon Sep 17 00:00:00 2001 From: gmrms Date: Wed, 7 Feb 2024 18:49:19 -0300 Subject: [PATCH] participante gmrms --- participantes/gmrms/README.md | 13 +++++++ participantes/gmrms/docker-compose.yml | 51 ++++++++++++++++++++++++++ participantes/gmrms/nginx.conf | 30 +++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 participantes/gmrms/README.md create mode 100644 participantes/gmrms/docker-compose.yml create mode 100644 participantes/gmrms/nginx.conf diff --git a/participantes/gmrms/README.md b/participantes/gmrms/README.md new file mode 100644 index 000000000..e78e97a46 --- /dev/null +++ b/participantes/gmrms/README.md @@ -0,0 +1,13 @@ +# Submissão para Rinha de Backend, Segunda Edição: 2024/Q1 - Controle de Concorrência + +logo clojure +logo clojure +logo nginx + + +## Guilherme Morum +Submissão feita com: +- `nginx` como load balancer +- `mongodb` como banco de dados +- `kotlin` para api com as libs `ktor` e `kmongo` +- [repositório da api](https://github.com/gmrms/rinha-2024Q1-ktor-mongo) \ No newline at end of file diff --git a/participantes/gmrms/docker-compose.yml b/participantes/gmrms/docker-compose.yml new file mode 100644 index 000000000..f864cf1d1 --- /dev/null +++ b/participantes/gmrms/docker-compose.yml @@ -0,0 +1,51 @@ +services: + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - api01 + - api02 + ports: + - "9999:9999" + deploy: + resources: + limits: + cpus: "0.18" + memory: "30MB" + + api01: &api + image: gmorum/rinha-2024q1:ktor-mongo-v1 + ports: + - "8070:8080" + environment: + - INIT_DB=true + - MONGO_CONNECTION_STRING=mongodb://mongo:27017 + depends_on: + - mongo + deploy: + resources: + limits: + cpus: "0.52" + memory: "160MB" + + api02: + <<: *api + depends_on: + - mongo + environment: + - INIT_DB=false + - MONGO_CONNECTION_STRING=mongodb://mongo:27017 + ports: + - "8060:8080" + + mongo: + image: mongo:7.0.3 + ports: + - "27017:27017" + command: --quiet --logpath /dev/null + deploy: + resources: + limits: + cpus: "0.28" + memory: "200MB" \ No newline at end of file diff --git a/participantes/gmrms/nginx.conf b/participantes/gmrms/nginx.conf new file mode 100644 index 000000000..c25779440 --- /dev/null +++ b/participantes/gmrms/nginx.conf @@ -0,0 +1,30 @@ +worker_processes auto; +worker_rlimit_nofile 500000; + +events { + use epoll; + worker_connections 5000; +} + +http { + access_log off; + sendfile on; + + upstream api { + server api01:8080; + server api02:8080; + } + + server { + listen 9999; + + location / { + proxy_buffering off; + proxy_set_header Connection ""; + proxy_http_version 1.1; + proxy_set_header Keep-Alive ""; + proxy_set_header Proxy-Connection "keep-alive"; + proxy_pass http://api; + } + } +}