Replies: 2 comments
-
If sessions dict becomes bottleneck, consider redis for storing sessions: see code```python # session_store.pyimport json try: Configuration to decide storage backendUSE_REDIS = os.getenv('USE_REDIS', 'false').lower() == 'true' and REDIS_AVAILABLE In-memory fallback storage_sessions: Dict[str, dict] = {} class GameSession(BaseModel):
def save_session(session: GameSession, ttl: Optional[int] = None): def load_session(session_id: str) -> Optional[GameSession]: def delete_session(session_id: str): Example usageif name == "main":
|
Beta Was this translation helpful? Give feedback.
-
Found this error with 1000 concurrent users: sqlite sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30.00 |
Beta Was this translation helpful? Give feedback.
-
Current findings with Locust (testing API only):
TODO:
Beta Was this translation helpful? Give feedback.
All reactions