-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from opencodeco/main
Participação da OpenCodeCo com Swoole & Hyperf na Rinha
- Loading branch information
Showing
4 changed files
with
95 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,5 @@ | ||
# Swoole & Hyperf | ||
|
||
- GitHub: [@opencodeco](https://github.com/opencodeco) | ||
- Twitter: [@opencodeco](https://github.com/opencodeco) | ||
- Repositório: [github.com/opencodeco/rinha-de-backend-2023-q3](https://github.com/opencodeco/rinha-de-backend-2023-q3) (branch `dev`) |
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,55 @@ | ||
version: '3.5' | ||
services: | ||
api1: &api | ||
image: opencodeco/rinha-de-backend:2023-q3 | ||
environment: | ||
DB_HOST: db | ||
DB_DATABASE: rinha | ||
DB_USERNAME: root | ||
DB_PASSWORD: rinha | ||
REDIS_HOST: cache | ||
depends_on: | ||
- db | ||
- cache | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '0.25' | ||
memory: '0.7GB' | ||
|
||
api2: | ||
<<: *api | ||
|
||
db: | ||
image: mysql:8.1 | ||
command: --default-authentication-plugin=mysql_native_password | ||
volumes: | ||
- ./migrations.sql:/docker-entrypoint-initdb.d/migrations.sql | ||
environment: | ||
MYSQL_ROOT_PASSWORD: rinha | ||
MYSQL_DATABASE: rinha | ||
|
||
cache: | ||
image: redis:7.2 | ||
ports: | ||
- '6379:6379' | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '0.1' | ||
memory: '0.5GB' | ||
|
||
nginx: | ||
image: nginx:1.25 | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf:ro | ||
depends_on: | ||
- api1 | ||
- api2 | ||
ports: | ||
- 9999:9999 | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: '0.25' | ||
memory: '0.1GB' |
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,8 @@ | ||
create table person( | ||
id varchar(36) primary key unique, | ||
nick varchar(32) not null, | ||
name varchar(100) not null, | ||
searchable longtext not null, | ||
birth date not null, | ||
stack json | ||
); |
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,27 @@ | ||
worker_processes auto; | ||
|
||
events { | ||
worker_connections 4096; | ||
} | ||
|
||
http { | ||
access_log off; | ||
#proxy_cache_path /tmp/cache keys_zone=cacherinha:100m max_size=1G use_temp_path=off; | ||
#proxy_cache_valid any 15s; | ||
|
||
upstream api { | ||
server api1:9501; | ||
server api2:9501; | ||
} | ||
|
||
server { | ||
listen 9999; | ||
|
||
location / { | ||
proxy_pass http://api; | ||
|
||
#proxy_cache cacherinha; | ||
#proxy_cache_background_update on; | ||
} | ||
} | ||
} |