Skip to content

anon-000/fast-api-with-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

{ Trying the Redis Queue with FAST API }


How to run/test it ?


* git clone
* create a virtual environment
* pip install -r requirements.py
* create a .env file and store your REDIS_DB_NO, REDIS_PASSWORD(if any), REDIS_QUEUE_NAME
* now we are ready with basic setup.

-------------- Running Producer Code ( Inside virtual env) --------------

* uvicorn producer_app.main:app --reload

---------------------------------------------------

-------------- Running Consumer/Worker Code ( Inside virtual env) --------------
( If you want multiple workers then follow the below for each worker, open separate terminal and run below code )

* python -m consumer_app.worker

---------------------------------------------------

-------------- How to Test --------------

Open a fresh terminal and hit your fast API end point : /start-message-queue

* Run the following curl command in terminal

curl --location 'localhost:8000/start-message-queue' \
--header 'Content-Type: application/json' \
--data '{
    "numberOfMessages": 3
}'

-----------------------------------------

1. Setting up Producers and Consumers


starting_up_the_apps.mov

2. Sending & Recieving 10 messages (with some fraction of delay 0.1)


queue_of_10_msgs.mov

3. Sending & Recieving 3000 & 30,000 messages (with no delay : You can see the speed)


queue_of_3k_and_30K_messages.mov

About

Handling distributed queues with Redis 🗿

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages