Recently I've set up memcached for my project(just started to work on it so I don't have any complicated DB queries yet). I am using it with Doctrine2 and Symfony 3.3 on my local vagrant machine(Ubuntu 16). I know it is working because I can see that it is writing things into memory:
What I don't understand is that why performance is so poor. According to this:
I should get significant performance increase.
How do I set up my memcached?
Version: 1.4.25
config.yml:
metadata_cache_driver:
type: memcached
host: 127.0.0.1
port: 11211
instance_class: Memcached
query_cache_driver:
type: memcached
host: 127.0.0.1
port: 11211
instance_class: Memcached
result_cache_driver:
type: memcached
host: 127.0.0.1
port: 11211
instance_class: Memcached
And then I do something like this:
$posts = $this->getEntityManager()->createQuery($dql)->useQueryCache(true)->useResultCache(true);
My questions/worries:
- Why there are so many connections?(1st screenshot, middle column - Claster stats)? I have already seen this but my implementation is different.
- Big number of connections make it slower?
- Do I have to use big data set/lots of queries to test it? Currently I am using one query as a test and I am getting over 100 posts from database. However from what I understand speed and performance boost should be so big I should be able to see it even with that data set.
- When I hit my endpoint without cache(via postman/insomia) I can get ~300-400ms but with memcached it's always above 1s. I was hoping for something like ~100ms.
Can anyone tell me more about what might be the problem here? I will be happy with every hint I can get.
Regards, Rob

