За счёт чего в антифрод-модуле удалось снизить время проверки на 25% при нагрузке свыше 700 RPS?
Asked at
AI answer
In your answer, it is important to explain how latency was measured and what exactly was optimized. For example: “We first profiled requests under load and identified the most expensive stages of the anti-fraud checks. We then reduced the number of database calls, optimized queries, and reused features that had already been computed. We combined independent checks or ran them in parallel, and moved expensive external calls out of the synchronous path wherever the business logic allowed. After each change, we verified the correctness of decisions and ran load tests above 700 RPS. Comparing p95/p99 latency before and after showed a 25% reduction in verification time without degrading detection quality.”
In a real answer, replace general measures with those actually applied, name the latency metric, and clarify whether you compared the average or, for example, p95.
Also asked at GigaChat / Сбер
- app = FastAPI() def get_db(): db = SessionLocal() try: yield db finally: db.close() def heavy_text_parser(file_id: int, db: Session): # Parsing a file that takes 5 minutes parse_and_save(file_id, db) @app.post("/upload") async def upload_file( background_tasks: BackgroundTasks, db: Session = Depends(get_db) ): file_id = save_file_to_db(db) db.commit() background_tasks.add_task(heavy_text_parser, file_id, db) return {"status": "parsing started"}
- def extract_emails_from_huge_file(file_path: str) -> list[str]: with open(file_path, 'r', encoding='utf-8') as f: content = f.read() # Заменяем переносы строк, чтобы текст был "сплошным" content = content.replace('\r\n', ' ').replace('\n', ' ') lines = content.split(' ') emails = [word for word in lines if '@' in word] return emails
Similar questions
- Can you quantify the benefits using specific metrics (RPS, latency, resource consumption, deliverability)?
- Could you briefly explain the caching in this case: what was cached, and how did it help?
- You wrote that latency dropped from 120 to 6 milliseconds. Was that mainly thanks to caching?
- What do you consider a high load: how many requests per second or per minute?
- A web service endpoint has started responding slowly. What steps would you take to identify and resolve the problem?