We’ve rebuilt our tutorial recommendation pipeline from the ground up—no-nonsense, fully transparent.
Unreliable AI Service
Every request hit a llama model, causing random latency spikes and occasional outages.
Vague Errors
Timeouts and crashes resulted in generic 5xx responses. Users saw “Something went wrong.”
High Operating Costs
Scaling the AI horizontally was expensive; traffic surges drove up compute bills.
A FastAPI microservice handles similarity lookups. Single responsibility: return the top N related tutorials.
If the service fails, we run a SQL query: same category, within ±6 months, sorted by date proximity, limited to six results. You always receive suggestions.
Client Request
GET /get-similar-tutorials/{id}?top_n={n}
hits our Flask endpoint.
Primary Path
Call the FastAPI service with the tutorial ID and desired count.
On Success
Enrich results with author and date, then return a consistent JSON payload.
On Failure
Log a warning and switch to the SQL fallback, maintaining the same output format.
Final Response
Always success: true
with similar_tutorials
, or success: false
if the database itself fails.
Cache First
Three-day TTL on precomputed recommendations in MySQL.
Text + Semantic Blend
Combined 60/40 to rank candidates
Top-N Selection
Exclude the original tutorial, select the highest-scoring entries.
A focused FastAPI service + SQL fallback + strategic caching = faster, more cost-effective, and fully reliable tutorial recommendations.