8000 [PropertyInfo] Use a single cache item per method by deviantintegral · Pull Request #30523 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[PropertyInfo] Use a single cache item per method #30523

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

Closed

Conversation

deviantintegral
Copy link
Contributor
Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #29977
License MIT
Doc PR none

This PR changes how property metadata is cached, significantly reducing the number of calls made between PHP and the backend cache. Instead of storing one cache item per method and set of arguments, a single cache item is stored per method. This matches well with real-world use, where most properties in an object will need to be inspected.

It's not clear to me if performance improvements fall under "bug fix", though I will say that we would have had to rewrite our code to remove PropertyInfo without this change.

Note that the absolute numbers in the above PR are best case. In production environments where memcache is on a remote server, we were seeing multiple seconds consumed by memcache calls.

@deviantintegral deviantintegral force-pushed the single-cache-per-method branch from 9700ee0 to fa65dfa Compare March 11, 2019 19:10
@dunglas
Copy link
Member
dunglas commented Mar 11, 2019

The patch looks good to me.
In production, be sure to use a local cache (static array, APC...) instead of memcache or any other remote server. As it's just a metadata cache that can be computed, there is no benefits using a remote system, only a performance penalty.

@dunglas
Copy link
Member
dunglas commented Mar 11, 2019

However, it should target master, we don't consider performance fixes as bug fixes.

@deviantintegral
Copy link
Contributor Author

In production, be sure to use a local cache (static array, APC...) instead of memcache or any other remote server. As it's just a metadata cache that can be computed, there is no benefits using a remote system, only a performance penalty.

One case we found is that if a new webserver is added to a pool due to autoscaling, having memcache + APC is useful in reducing first-load times.

Thanks for the review. I will open a new PR so this is available in case anyone in the future wants to patch this in.

symfony-splitter pushed a commit to symfony/property-info that referenced this pull request Apr 3, 2019
…ntintegral)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[PropertyInfo] Use a single cache item per method

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29977
| License       | MIT
| Doc PR        | none

Replaces symfony/symfony#30523 with a rebase to master.

This PR changes how property metadata is cached, significantly reducing the number of calls made between PHP and the backend cache. Instead of storing one cache item per method and set of arguments, a single cache item is stored per method. This matches well with real-world use, where most properties in an object will need to be inspected.

Note that the absolute numbers in the above PR are best case. In production environments where memcache is on a remote server, we were seeing multiple seconds consumed by memcache calls.

Commits
-------

2a4f8a11d4 [PropertyInfo] Use a single cache item per method
fabpot added a commit that referenced this pull request Apr 3, 2019
…ntintegral)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[PropertyInfo] Use a single cache item per method

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29977
| License       | MIT
| Doc PR        | none

Replaces #30523 with a rebase to master.

This PR changes how property metadata is cached, significantly reducing the number of calls made between PHP and the backend cache. Instead of storing one cache item per method and set of arguments, a single cache item is stored per method. This matches well with real-world use, where most properties in an object will need to be inspected.

Note that the absolute numbers in the above PR are best case. In production environments where memcache is on a remote server, we were seeing multiple seconds consumed by memcache calls.

Commits
-------

2a4f8a1 [PropertyInfo] Use a single cache item per method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0