• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 11 pages
Essay

Implementing Horizontal Scaling with Microservices, Docker, and NGINX in a SaaS Environment

Document preview thumbnail
Preview 2 out of 11 pages

Implementing Horizontal Scaling with Microservices, Docker, and NGINX in a SaaS Environment

Content preview

1




Implementing Horizontal Scaling with Microservices, Docker, and NGINX in a SaaS
Environment


Student’s Name
Institution
Course
Professor
Date

, 2


Implementing Horizontal Scaling with Microservices, Docker, and NGINX in a SaaS
Environment
1) Flask microservice (containerizable)
app/main.py
from flask import Flask, jsonify, request
from sqlalchemy import create_engine, text
import os


app = Flask(__name__)


DB_URI = os.getenv("DB_URI", "mysql+pymysql://user:password@db:3306/appdb")
POOL_SIZE = int(os.getenv("DB_POOL_SIZE", "10"))
engine = create_engine(DB_URI, pool_size=POOL_SIZE, max_overflow=POOL_SIZE,
pool_pre_ping=True)


@app.get("/health")
def health():
with engine.connect() as conn:
conn.execute(text("SELECT 1"))
return jsonify(status="ok")


@app.get("/users")
def list_users():
# demo endpoint; assumes a 'users' table exists
limit = int(request.args.get("limit", 10))
with engine.connect() as conn:
rows = conn.execute(text("SELECT id, email FROM users ORDER BY id LIMIT :lim"),
{"lim": limit}).mappings().all()

Document information

Study
Uploaded on
December 4, 2025
Number of pages
11
Written in
2025/2026
Type
Essay
Professor(s)
Unknown
Grade
A
$10.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
1
Items
9
Last sold
-



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions