I have substitute my memcache with Redis. I use the phpredis client and the pconnect () for connecting.
I have also created a Redis class which implements the singleton pattern, but I keep on getting new client connections after a few refreshes of the home page.
More specifically, I have an application which gets some values from redis by given keys.
When I start redis-server I have 0 clients connected. I refresh the page and 1 client is connected. In the second refresh 2 clients are connected. After 2-3 more refreshes 3 clients are connected and so on, until it reaches 11 sometime 12 clients. Then it stops to increase their amount.
The time to render the home page is more or less the same (also with memcache) and it doesn’t consume more memory, but I was trying to find why it does have this weird behavior.
I run my application locally on MAMP 2.0.5 and I have redis-2.4.7.
You have 12 instances of apache workers running PHP with your script. That’s fine as long as you don’t see any clients disconnecting and reconnecting all the time.