implementing PHP Symfony 5.4 and Redis connection timeouts during high traffic
I've looked through the documentation and I'm still confused about I'm relatively new to this, so bear with me. I'm experiencing connection timeouts when my Symfony 5.4 application tries to communicate with Redis during peak traffic times. I have a caching layer set up using Redis, and while it works smoothly under normal conditions, when concurrent users spike beyond a certain threshold (around 200 requests per second), I get the following behavior: ``` RedisException: Connection timed out ``` I've configured Redis with the following settings in my `config/packages/redis.yaml`: ```yaml parameters: redis_host: '%env(REDIS_HOST)%' redis_port: '%env(REDIS_PORT)%' framework: cache: pools: my_cache: adapter: cache.adapter.redis provider: '%redis_host%:%redis_port%' ``` I suspect that the default connection and read timeout settings might be too low for bursts of traffic. I've tried adjusting the `timeout` parameter in my Redis configuration: ```yaml options: timeout: 5 ``` However, this hasn't resolved the scenario. Additionally, I'm using the predis/predis library for Redis connections. I've also increased the `maxclients` setting in my Redis configuration to 10000, but the scenario continues. During the timeouts, Redis appears to be operating normally when I check its logs, which makes me think there might be an scenario with how PHP is handling the connections. I've checked the PHP-FPM settings, and the `pm.max_children` is set to 50, which I thought would be sufficient. I’ve also scaled the number of FPM workers based on my server capabilities but still face timeouts. Has anyone encountered similar issues, or can you suggest any best practices for handling Redis connections under high load in Symfony? Any insights or tips would be greatly appreciated. For context: I'm using Php on Windows. Any ideas what could be causing this? I'm working on a CLI tool that needs to handle this. Am I missing something obvious? This is part of a larger REST API I'm building. Any ideas how to fix this?