Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi get implementation in QueryCache #5831

Closed
wants to merge 1 commit into from

Conversation

polyanin
Copy link

@polyanin polyanin commented May 20, 2016

Hi

There is significant performance degradation when doctrine tries to check the cache (memcache) after fetching multiple thousands of rows. It occurs because it doesn't use memcache's multiple get function.

This modification implements multiple get cache checking as it has been done here: #954

@polyanin polyanin changed the title Optimization. Multiple get in QueryCache Multi get implementaion in QueryCache Jul 13, 2016
@polyanin polyanin changed the title Multi get implementaion in QueryCache Multi get implementation in QueryCache Jul 13, 2016
@A
Copy link

A commented Jul 13, 2016

I have same issue with performance. Please merge it!
image

@Ocramius Ocramius self-assigned this Nov 26, 2016
@Ocramius Ocramius added this to the 2.6.0 milestone Dec 12, 2016
Copy link
Member

@lcobucci lcobucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and it's a freaking awesome improvement.
Just think that we can do some small refactoring do organise the code a bit more.

foreach ($entry->result as $index => $concreteEntry) {
$entityCacheKeys[$index] = new EntityCacheKey($cm->rootEntityName, $concreteEntry['identifier']);
}
$entries = $region->getMultiple(new CollectionCacheEntry($entityCacheKeys));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius does it makes sense to extract this process to a named constructor on CollectionCacheEntry?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checked...
In order to do that we would need make CollectionCacheEntry know about EntityCacheKey and now it just depends on CacheKey (abstract class), so it's better keep the dependency here.


if ($this->cacheLogger !== null) {
$this->cacheLogger->entityCacheMiss($regionName, $entityKey);
$this->cacheLogger->entityCacheMiss($regionName, $entityCacheKeys[$index]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also do something CollectionCacheEntry#get($index) here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just use CollectionCacheEntry#identifiers

@lcobucci
Copy link
Member

Manually merged on bb943af

@polyanin thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants