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

Big performance hit when upgrading from 1.4.2 to 1.5.0 #44

Closed
sdepablos opened this issue Mar 26, 2014 · 6 comments
Closed

Big performance hit when upgrading from 1.4.2 to 1.5.0 #44

sdepablos opened this issue Mar 26, 2014 · 6 comments

Comments

@sdepablos
Copy link

A few days ago we upgraded a few packages in our SF2 project and realized that our times when from 60 ms to almost 100 ms (confirmed both by newrelic and logstash), so we started to debug which one of the upgrades was to blame.

Finally we've found the cause on the metadata package upgrade from 1.4.2 to 1.5.0. Here's a screenshot of 500 requests with version 1.4.2 vs 500 with version 1.5.0

jms-perf

Taking a look to the differences between 1.4.2 vs 1.5.0 the only possible cause may be the pull request #36 (medatada caching improvement). I see on the issue that a benchmark was done, but I don't know which kind of benchmark and if it was done with "real code". Could it be that the change from one call to instanceof to five (two directly on getMetadataForClass and three more calling filterNullMetadata) is causing this performance hit? It seems that as instanceof uses strings comparisons, the class name length has a big impact, but this is just a guess.

@schmittjoh
Copy link
Owner

Could you verify this by reverting said commit and measuring the impact?

@acasademont
Copy link

Checking the diff between 1.4.2 and 1.5.0 there's only this change really. The other one is just adding a method for adding drivers, not an issu at all.

From what I can see, there is now one extra function call filterNullMetadata where previously there was none. I really don't know how many times this funcion must be called to cause that big time bump.

Maybe @adrienbrault can give us some clues

@sdepablos
Copy link
Author

Commit from full request #36 removed and we're back to normal performance. We have not tried changing any of the code, but our intuition says is has to be something related with the extra calls to instanceof. @adrienbrault, do you remember how the performance test was done?

@adrienbrault
Copy link
Contributor

Yep, serializing an object graph with a lot of objects without any metadata was super slow.

Maybe you could use xhprof to find the bottleneck (likely io related, instanceof is supposed to be super fast).

@sdepablos
Copy link
Author

@adrienbrault did you take a look to issue #45? It looks like a good explanation for the performance hit.

schmittjoh added a commit that referenced this issue Jul 12, 2014
Fix NullMetadata performance issue
@goetas
Copy link
Collaborator

goetas commented May 9, 2018

fixed in #46

@goetas goetas closed this as completed May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants