Sobes.tech
Senior

User request processing service in Telegram User can send a report Admins can process reports Admin can give feedback to the user DAU = 100 Availability = 99.95% RPS = 100 Ticket Service POST /api/v1/tickets // creation GET /api/v1/tickets/{id} PATCH tickets/{id}/status PATCH tickets/{id}/assign Diagram: User and admin go to Api Gateway Api Gateway goes to Ticket Service and Admin Service Ticket Service goes to PgSQL

sobes.tech AI

Answer from AI

For a Telegram inquiry processing service with DAU=100, Availability=99.95%, and RPS=100, the architecture should ensure reliability, scalability, and ease of support.

Key points:

  • API Gateway — entry point for users and admins, routes requests to Ticket Service and Admin Service.
  • Ticket Service — responsible for creating, retrieving, and updating ticket statuses, stores data in PostgreSQL.
  • Admin Service — handles admin actions, such as assigning tickets and sending feedback.

Recommendations:

  1. Database: PostgreSQL — a good choice for relational ticket data. To improve availability, replication and automatic failover can be used.

  2. Status and assignment handling: PATCH requests should be idempotent and atomic to avoid conflicts during parallel processing.

  3. Scalability: with RPS=100, the load is moderate, but horizontal scaling of services and API Gateway should be considered.

  4. Monitoring and logging: to ensure SLA of 99.95%, set up monitoring for availability, latency, and errors.

  5. Security: authentication and authorization for users and admins, validation of incoming data.

  6. Diagram: Users and Admins go to API Gateway, which distributes requests to Ticket Service and Admin Service. Ticket Service interacts with PostgreSQL for data storage.

Example of a simplified ticket creation endpoint in Go:

func CreateTicketHandler(w http.ResponseWriter, r *http.Request) {
    var ticket Ticket
    if err := json.NewDecoder(r.Body).Decode(&ticket); err != nil {
        http.Error(w, "Invalid input", http.StatusBadRequest)
        return
    }
    // Save to DB
    id, err := ticketService.Create(ticket)
    if err != nil {
        http.Error(w, "Failed to create ticket", http.StatusInternalServerError)
        return
    }
    w.WriteHeader(http.StatusCreated)
    json.NewEncoder(w).Encode(map[string]interface{}{ "id": id })
}

This approach will ensure convenient handling of inquiries and support the specified availability and performance metrics.

User request processing service in Telegram User can… - sobes.tech