iamrobins / message-board-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup

  1. Install Docker and Docker Compose
  2. Open terminal and run docker compose up --build or (docker-compose up --build)
  3. python manage.py test (There are 6 tests)

Current Design

diagram

How can we improve further with minor changes?

Our Django server holds the logic for everything including a ML model which checks for toxicity in a text and this can easily become a bottleneck in our system as the number of requests increases.

  • We can solve this issue by increasing the resoruces of our server vertically but there's always a max resource limit.
  • As our server is stateless we can solve it by scaling it horizontally but other features which are rarely getting any requests will scale as well.

A Slightly Improved Design

improved-diagram

  • Here we've scaled it horizontally now our main server is running on very light weight machines and we've moved our Detoxify ML model to better machines.
  • Now we can easily serve more requests but there is another bottleneck the requests are synchronous as its bound to the time taken by a Detoxify Model to respond and it could be a request timeout if not handled properly.
  • We can fix it using asynchronous approach by introducing a message broker like RabbitMQ and the requests will resolve extremely fast.

About


Languages

Language:Python 94.7%Language:Dockerfile 4.3%Language:Shell 1.0%