Windows / Using XAMPP / PHP version 7.4.11 / php_redis.dll Thread Safe for PHP 7.4 / Redis runs with command prompt
Connecting to Redis in my PHP application with $redis->pconnect('127.0.0.1', '6379') takes 20ms. That seems like a long time. I connect to Redis with every PHP request, and it takes 20ms every time.
Is there any way to speed this up? I read that it is supposed to take 1MS for PHP->phpredis to connect with Redis, which means I am doing something wrong.
In the redis.conf I set timeout to 60. Thinking this might allow for persistent connections meaning a second php request might re-use a previously opened connection to Redis, and save time. However nothing changes, pconnect takes roughly 20ms with every request.
What I have tried so far.
- I ran Redis Server with Ubuntu, this changed nothing.
- I ran Redis Server with Ubuntu, and opened a unix port. I read that this is faster. But I cannot manage to connect to the unix port in my PHP application. It throws an error.
- I ran Redis Server with CMD and tried to open a unix port, but this does not work.
- I installed Predis, this had some effect. When connecting to Redis with Predis it lasted 5ms. However when executing get/set hget/hset commands with Predis it was much slower then the get/set hget/hset commands with phpredis.
I am a huge noobie and I do not know very well what I am doing, I do not know how to ask any clearer and just hope that some smart person knows what is going wrong. Been trying to overcome this issue for the past 4 days and haven't gotten any closer.