Startonix / Modular-AI

Advanced AI Training and Building Repository
0 stars 0 forks source link

Multithreading and Load Balancing #148

Open Startonix opened 4 months ago

Startonix commented 4 months ago

multithreading_example.py

import threading

def task(): print("Task running")

threads = [] for i in range(10): t = threading.Thread(target=task) threads.append(t) t.start()

for t in threads: t.join()

NGINX Load Balancer Configuration

nginx_load_balancer.conf

upstream backend { server backend1.example.com; server backend2.example.com; }

server { listen 80; location / { proxy_pass http://backend; } }