GithubHelp home page GithubHelp logo

ipakeev / fastapi-async-tasks Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 2.0 279 KB

FastAPI with async/await background tasks (ARQ, SAQ, FastStream, Celery) + Prometheus + Grafana

Dockerfile 1.58% Makefile 0.43% Python 97.99%

fastapi-async-tasks's Introduction

FastAPI with async background tasks + Prometheus + Grafana

This project provides a way to setup and run asynchronous (async/await) tasks using these libraries:

This way can also be useful for testing your code with eager execution. You can see it in tests/conftest.py.

Finally, it shows how to monitor FastAPI app and execution of tasks with Prometheus + Grafana using these libraries:


Installation

Clone the repository:

git clone https://github.com/ipakeev/fastapi-async-tasks

Usage

Create .env file and adjust it:

cp example.env .env

Build app image:

docker build -t fastapi-async-tasks .

Run all containers:

docker-compose up

Now you have access to these services:

Raw metrics are available here:


Benchmark

You can test the performance of the application and run a benchmark using locust:

env endpoint={endpoint} locust --config locust/master.conf -f locust/benchmark.py -u 10 -i 1000
env endpoint={endpoint} locust --config locust/master.conf -f locust/background.py -u 10 -i 1000

Available {endpoint}s:

  • io/simple
  • io/sync
  • io/thread
  • cpu/simple
  • cpu/process

fastapi-async-tasks's People

Stargazers

Alexander  Ivanenkov avatar Thiên Nhật avatar Aleksey Afanasev avatar Nikita Kotov avatar Evgeny Stepanchenko avatar Alexey Sidorov avatar DJun avatar xin.gao avatar  avatar

Watchers

Ipakeev avatar

Forkers

djun alexiv-tn65

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.