agile-microservices

byMaulik Patel

March Scope of Work for FXIS.AI Intro: We are planning to add 3 microservices in our Kubernetes cluster hosted on Vultr that can perform the following tasks: Generate thumbnail for every file uploaded Generate face rec. embedding for every file uploaded Architecture: Note: We can also decide to go with a single microservice for this task if needed. The idea of keeping 2 separate pods for each is that multiple users could also be uploading hundreds or even thousands of photos at times. Although these photos are uploaded sequentially at a per user level, yet we can have multiple users uploading parallelly, and considering the execution time, there could be multiple requests queued parallelly. Keeping 1 or 2 microservices require planning accordingly. Thumbnail Generation Job: Currently we have 2 lambda functions that perform this task. Lambda 1 takes care of following tasks: Downloading the newly uploaded image from B2 Generating it’s thumbnail using Sharp package in Node.js Uploading the thumbnail back to B2 Upon successful execution of Lambda 1, it also invokes Lambda 2 that updates the db about the storage, photo_count, and other necessary changes that our application requires. In the microservice, we simply need to perform the tasks of Lambda 1, and for db operations we can continue to use Lambda 2 since it would have access to our db, while our k8s cluster does not. Refer the Lambda function “r2-object-thumb-test” for referring the lambda function logic as reference. Embedding generation job: This microservice would be triggered from the thumbnail job itself since it uses the same image (payload). We need to use the exact same model and parameters as we use in prod_batch_embed to generate the embeddings for each image that is passed through this. Similar to the step function, we can use the lambda function for making the db update since that is in the same VPC and subnet as the prod db and has access to it, unlike Vultr server. One key difference in running this microservice would be that prod_batch_embed lambda function runs indexing on a batch of 50 photos, but here it would be run for 1 photo at a time. Therefore performance must be optimized in this to minimize the delay as much as possible. Queries from a UX perspective: Refer our current architecture for upload: Yellow blocks denote Lambda function Due to this architecture, after the upload of even 10k photos, user has to wait only a few seconds (<10s) before the thumbnails of uploaded images are shown at FE. For those 10 seconds, we show a loader saying “Processing your photos” so the user knows some processing is going on. The status “Processing” is currently deduced by FE based on the status of the 20 lambda calls in the last iteration of upload. But since we will be doing this thumbnail generation in Vultr going forward, how can we show the realtime status of this "Processing” at the front-end so the user is informed? Also, how can we do the same for the ai indexing since processing for that might again take some extra time so we would like to show some message such as “indexing with ai” until that processing is complete. Testing Criteria for UAT: Functionality testing complete (No Load Scenario) - For every photo that is uploaded via application, using B2 event notification both thumbnail and embedding generation job must be triggered (whether in parallel or sequential can be decided). Both the jobs should run successfully generating thumbnail and embedding. Need to minimize the time as much as possible. Load Testing - For 5 users uploading 2k photos in parallel, need to test how long is the thumbnail and embedding generation taking at a per user level once their upload is completed.

HomeLoginGalleryServicesSettingsUploadDashboardStatus
Home

Comments (0)

No comments yet. Be the first!

System Requirements

System Requirement Document
Page 1 of 4

System Requirements Document (SRD)

Project Name: agile-microservices

1. Introduction

Welcome to the System Requirements Document (SRD) for agile-microservices, a project designed to enhance the scalability and efficiency of image processing tasks within a Kubernetes cluster hosted on Vultr. This document outlines the functional and non-functional requirements, architecture, and design concepts for the system.

The project aims to implement microservices for thumbnail generation and face recognition embedding generation, ensuring seamless user experience and optimized performance. This document has been tailored to meet the needs of Maulik Patel, based in India, with locale-specific considerations such as timezone (IST) and infrastructure preferences.

2. System Overview

The agile-microservices project will consist of two primary microservices:

  1. Thumbnail Generation Microservice: Responsible for creating thumbnails for uploaded images.
  2. Embedding Generation Microservice: Responsible for generating face recognition embeddings for the same images.

Both microservices will operate within a Kubernetes cluster hosted on Vultr, leveraging API-based polling for real-time status updates to the front-end. The architecture will ensure scalability to handle parallel uploads from multiple users while maintaining optimal performance.

The system will integrate with existing Lambda functions for database operations, ensuring compatibility with the current infrastructure.

3. Functional Requirements

Thumbnail Generation Microservice

  • As a User, I should be able to upload images and have thumbnails generated automatically.
  • As a User, I should be able to see the real-time status of thumbnail generation via API polling.

Embedding Generation Microservice

  • As a User, I should be able to upload images and have face recognition embeddings generated automatically.
  • As a User, I should be able to see the real-time status of embedding generation via API polling.
Page 2 of 4

General Requirements

  • As an Admin, I should be able to monitor the performance and load of both microservices.
  • As an Admin, I should be able to configure thresholds for acceptable processing delays.

4. User Personas

1. User

  • Description: End-users uploading images via the application.
  • Needs: Quick processing of images, real-time status updates, and seamless user experience.

2. Admin

  • Description: System administrators managing the microservices and infrastructure.
  • Needs: Monitoring tools, performance metrics, and configuration options for thresholds.

5. Visuals Colors and Theme

Color Palette

The visual identity of agile-microservices will reflect a modern, tech-forward aesthetic with the following unique color palette:

  • Background: #1A1A2E (Deep Midnight Blue)
  • Surface: #16213E (Dark Navy)
  • Text: #E94560 (Vivid Coral Red)
  • Accent: #0F3460 (Rich Sapphire Blue)
  • Muted Tones: #53354A (Muted Plum)

These colors are designed to evoke a sense of innovation and reliability while maintaining a professional appearance.

6. Signature Design Concept

Page 3 of 4

Interactive Galaxy Map Homepage

The homepage of agile-microservices will feature an interactive galaxy map, where each star represents a feature or section of the application.

  • Visuals: A dark, starry background with glowing stars that pulse gently.
  • Interactions: Users can hover over stars to reveal tooltips about features, and clicking a star will zoom into that section with smooth transitions.
  • Animations: Stars will twinkle subtly, and constellations will form dynamically as users navigate.
  • Micro-Interactions: When a user clicks on a star, the galaxy map will shift perspective, creating a sense of movement and exploration.

This design concept ensures the homepage is unforgettable, engaging, and aligned with the futuristic theme of the project.

7. Non-Functional Requirements

  • Performance: Thumbnail generation should complete within 300ms per image under moderate load. Embedding generation should aim for ~500ms per image.
  • Scalability: The system must handle parallel uploads from at least 5 users uploading 2,000 images each without significant delays.
  • Reliability: Microservices must maintain 99.9% uptime.
  • Security: All data transfers must be encrypted using TLS.

8. Tech Stack

Frontend

  • React for Web

Backend

  • Python
  • FastAPI

Database

  • MySQL or MariaDB (preferred for RDBMS)
  • MongoDB (for NoSQL needs)

AI Models

  • GPT 5.2 for user-friendly responses
  • Claude 4.5 Opas for academic or coding work
Page 4 of 4

AI Tools

  • Litellm for LLM Routing
  • Langchain

Orchestration

  • Docker and docker-compose for local orchestration
  • Kubernetes for server-side orchestration

9. Assumptions and Constraints

Assumptions

  • Users will upload images sequentially at a per-user level but parallel uploads from multiple users will occur.
  • The Vultr Kubernetes cluster will have sufficient resources to handle the expected load.

Constraints

  • Database operations must remain within the existing Lambda functions due to VPC and subnet restrictions.
  • Real-time status updates will rely on API polling, which may introduce slight delays compared to WebSocket-based solutions.

10. Glossary

  • Microservice: A small, independent service designed to perform a specific task.
  • Thumbnail: A smaller version of an image used for preview purposes.
  • Embedding: A numerical representation of an image used for face recognition.
  • Polling: Periodically querying an API to check for updates.
  • Kubernetes: An open-source platform for managing containerized applications.
  • Lambda Function: A serverless compute service that runs code in response to events.

This document provides a comprehensive overview of the agile-microservices project, ensuring clarity and alignment with Maulik Patel's vision. Let me know if further refinements are needed!

No page designs yet.

The Design Agent will generate JSX pages automatically after user flows are created.

No user flows yet.

The User Flow Agent will generate per-persona navigation diagrams after SRD updates.