Backend challenge running on limited resources
410
Project developed to participate in the "Rinha de Backend" challenge. The aim of the challenge is to create an API for manipulating people's data, with cache, database and a load balancer to manage two instances, all in a limited environment with 1.5vCPUs and 3GB of memory.
In the project, an example environment variables file will be available. The project will start using it, if you want to change the database user and password, or some other value, feel free
Clone git repository with modules
git clone https://github.com/WeversonL/rinha-backend.git
cd rinha-backend
Start with docker-compose
docker-compose up -d
You can access the API via load balancer, sending requests to localhost:9999. Due to resource limitations, it is necessary to wait a while for the entire application to be up and running.
The endpoints offered are based on those requested by the challenge!!
To make the HTTP requests below, the httpie tool was used:
$ http POST :9999/pessoas apelido="nickname" nome="My Name" nascimento="2000-01-22" stack:='["Java","C", "Python"]'
[
{
"id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
"nome": "Weverson Lemos",
"apelido": "verso",
"nascimento": "2003-01-22",
"stack": [
"Java",
"C"
]
}
]
$ http GET :9999/pessoas/{id}
[
{
"id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
"nome": "Weverson Lemos",
"apelido": "verso",
"nascimento": "2003-01-22",
"stack": [
"Java",
"C"
]
}
]
In this endpoint you can search for people by any term. It will check whether the term entered appears in any of the columns. For example, knowing if there is someone in my bank who has a STRING with the value "John"
$ http GET ':9999/pessoas?t=John'
[
{
"id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
"nome": "John Mars",
"apelido": "John",
"nascimento": "2003-01-22",
"stack": [
"Java",
"C"
]
}
]
$ http GET ':9999/pessoas?t=2003-01-22'
[
{
"id": "b987f790-7c92-42ca-ab99-2358adcd5e38",
"nome": "John Mars",
"apelido": "John",
"nascimento": "2003-01-22",
"stack": [
"Java",
"C"
]
}
]
Rinha Backend is MIT licensed.
Content type
Image
Digest
sha256:e62c86e00…
Size
41.1 MB
Last updated
over 2 years ago
docker pull weversonlemos/rinha-backend