GithubHelp home page GithubHelp logo

chymz / ecobenchmark-applicationweb-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from boavizta/ecobenchmark-applicationweb-backend

0.0 1.0 0.0 2.29 MB

License: Other

Shell 0.20% JavaScript 0.57% Python 0.29% PHP 1.34% Go 1.11% Rust 0.70% Kotlin 0.77% Makefile 0.01% Jupyter Notebook 94.87% Dockerfile 0.11% Twig 0.04%

ecobenchmark-applicationweb-backend's Introduction

Eco benchmark

This repository is benchmarking different scenario to try to compare the energy consumption, for several languages.

The different scenario will be the following, for each language:

  • default, optimised but not extremely
  • different degraded use cases.

Workflow

The complete workflow is based on docker images. Every image should be named as <org>/service-<service_name>:<use_case>.

Each image can be built using the following command.

# oRG=jdrouet is used by default but can be changed by exporting a different variable.
./builder/service.sh <name_of_your_service> <use_case>

Starting the database

Postgres

docker run -d \
  --name eco-benchmark-database \
  # to run the migrations when starting the database
  --volume $(pwd)/migrations:/docker-entrypoint-initdb:ro \
  --port 5432:5432 \
  -e POSTGRES_PASSWORD=mysecretpassword \
  # today, the 30th of april 2022, this is the latest release
  postgres:14.2-bullseye

export DATABASE_URL=postgresql://postgres:[email protected]:5432/postgres

Use Case Status

Langage Reference (main) No Index ORM Loop MySQL GRPC No Pagination Aggregation on code side
Go Lang X X X X X X X
Rust X X X X X
PHP (Symfony) X X X X N/A X X
JVM/Kotlin X X X X X X X
Node.js X X X X X X
Ruby On Rails

Use Case Documentation

Default

Branch : main

Description : classic optimized implementation, but not too much.

No Index

Branch : usecase-no-index

Description : oups, we forgot to put the indexes. For thoses who are laughing, you all have people running wordpress website around you. Check the db...

ORM Loop

Branch : usecase-orm-loop

Description : for the API path GET /api/accounts/:account_id/lists/ we do a classic loop like developer usually do using a ORM or layered architecture.

Instead of one request, the get list become :

  • Get the list from the db (paginated)
  • Loop on the list
    • get the tasks of the lists
    • fill the tasks in the list object
  • return full list with task.

MySQL

Branch : usecase-mysql

Description : replace postgresql by mysql

Note : DATABASE_URL should be like : mysql://root:mysqlpw@tcp(localhost:3306)/ecobenchmark?parseTime=true

?parseTime=true is mandatory.

GRPC

Branch : usecase-grpc

Description : use grpc instead of classic http/json.

Based on this service definition : https://gitlab.com/jeremie.drouet/eco-benchmark/-/blob/usecase-grpc/service/go-pgx/endpoints/endpoints.proto

No Pagination

Branch : usecase-no-pagination

Description : for the API path GET /api/accounts/:account_id/lists/ remove pagination.

Aggregation on code side

Branch : usecase-aggregation-code-side

Description : for the API path GET /api/stats remove group by and aggregate on code side.

ecobenchmark-applicationweb-backend's People

Contributors

jdrouet avatar youenchene avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.