forked from zanfranceschi/rinha-de-backend-2024-q1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adiciona participante vitorbgs (zanfranceschi#1642)
- Loading branch information
Showing
4 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
version: "3.8" | ||
|
||
services: | ||
api01: &api | ||
image: vitorbgs/crebito-rinha-backend-2024q1 | ||
hostname: api01 | ||
environment: | ||
- ASPNETCORE_ENVIRONMENT=Loadtest | ||
- ConnectionStrings__CrebitoDbConnection=Host=db;Database=rinha;Username=admin;Password=123;Maximum Pool Size=4; | ||
ports: | ||
- "8081:8080" | ||
depends_on: | ||
- db | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "0.4" | ||
memory: "70MB" | ||
|
||
api02: | ||
<<: *api | ||
hostname: api02 | ||
ports: | ||
- "8080:8080" | ||
|
||
nginx: | ||
image: nginx:latest | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf:ro | ||
depends_on: | ||
- api01 | ||
- api02 | ||
ports: | ||
- "9999:9999" | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "0.2" | ||
memory: "20MB" | ||
|
||
db: | ||
image: postgres:latest | ||
hostname: db | ||
environment: | ||
- POSTGRES_PASSWORD=123 | ||
- POSTGRES_USER=admin | ||
- POSTGRES_DB=rinha | ||
command: 'postgres -c max_connections=20 -c shared_buffers=128MB -c effective_cache_size=256MB -c synchronous_commit=off -c fsync=off -c full_page_writes=off' | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- ./script.sql:/docker-entrypoint-initdb.d/script.sql | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "0.5" | ||
memory: "390MB" | ||
|
||
networks: | ||
default: | ||
driver: bridge | ||
name: rinha-nginx-2024q1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
events { | ||
worker_connections 512; | ||
} | ||
|
||
|
||
http { | ||
upstream api { | ||
server api01:8080; | ||
server api02:8080; | ||
} | ||
|
||
server { | ||
listen 9999; | ||
access_log off; | ||
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; | ||
|
||
# Timeouts | ||
proxy_connect_timeout 30s; | ||
proxy_send_timeout 60s; | ||
proxy_read_timeout 60s; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## Rinha de Backend 2024q1 - vitorbgs | ||
|
||
### Tecnologias | ||
- .NET 8 | ||
- Minimal API | ||
- Clean Architecture | ||
- FluentValidation | ||
- Dapper | ||
- PostgreSQL | ||
- NGINX | ||
|
||
### Resultados | ||
 | ||
|
||
|
||
### Info | ||
Repositório da Rinha: [zanfranceschi/rinha-de-backend-2024-q1](https://github.com/zanfranceschi/rinha-de-backend-2024-q1) | ||
|
||
LinkedIn: [Vitor Breno Gomes da Silva](https://www.linkedin.com/in/vitorbgs/) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
-- Table: public.contas | ||
|
||
-- DROP TABLE IF EXISTS public.contas; | ||
|
||
CREATE TABLE IF NOT EXISTS public.contas | ||
( | ||
id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
cliente_id integer NOT NULL, | ||
limite integer NOT NULL, | ||
saldo integer NOT NULL, | ||
CONSTRAINT pk_clientes PRIMARY KEY (id) | ||
); | ||
|
||
CREATE INDEX IF NOT EXISTS idx_contas_cliente_id ON public.contas(cliente_id); | ||
|
||
-- Table: public.Transacoes | ||
|
||
-- DROP TABLE IF EXISTS public.transacoes; | ||
|
||
CREATE TABLE IF NOT EXISTS public.transacoes | ||
( | ||
id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), | ||
conta_id integer NOT NULL, | ||
tipo character(1) COLLATE pg_catalog."default" NOT NULL, | ||
descricao text COLLATE pg_catalog."default" NOT NULL, | ||
valor integer NOT NULL, | ||
realizada_em timestamp with time zone NOT NULL, | ||
CONSTRAINT pk_transacoes PRIMARY KEY (id) | ||
); | ||
CREATE INDEX IF NOT EXISTS idx_transacoes_conta_id ON public.transacoes(conta_id); | ||
|
||
|
||
DELETE FROM public.contas; | ||
DELETE FROM public.transacoes; | ||
|
||
INSERT INTO public.contas(cliente_id, limite, saldo) | ||
VALUES | ||
(1, 100000, 0), | ||
(2, 80000, 0), | ||
(3, 1000000, 0), | ||
(4, 10000000, 0), | ||
(5, 500000, 0); | ||
|