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

Fix DomainMessage metadata bottleneck #69

Merged
merged 2 commits into from
Mar 22, 2018
Merged

Conversation

enumag
Copy link
Member

@enumag enumag commented Mar 22, 2018

It turns out that adding metadata to a command or query is a serious bottleneck in our application because of the toArray and fromArray transformations used in those methods. In our case it's about 10% of the total time the server needs to respond to a http request. The reason why it is a bottleneck is because the messages contain Ramsey\Uuid objects which are slow to convert to string and back. So I need to prevent this from happening.

I've fixed it by changing the fromArray / toArray logic to simple PHP clone. Now this of course can be considered a BC break since the clone is no longer deep after this. I'm not exactly sure if this is a problem (it's not for me) so you need to consider the possible impacts before merging this. I'm fine with changing the logic on my side in case you don't want this change. Anyway I think you should know about this bottleneck and maybe consider some other changes to solve it.

@enumag
Copy link
Member Author

enumag commented Mar 22, 2018

I have no idea why the tests failed. The failure seems unrelated but it didn't print anything useful to figure out the problem.

@prolic
Copy link
Member

prolic commented Mar 22, 2018

@enumag the tests fails because the copyright needs to be updated to 2018. We have a travis hook for checking this, so we don't forget it somewhere. Can you update the LICENSE file as well as the docheaders of the php-files? Should be very simple with PhpStorm search/replace.

As about the PR itself: I think I'm good with the changes, your thoughts @codeliner?

@codeliner
Copy link
Member

LGTM 👍

@prolic prolic self-assigned this Mar 22, 2018
@prolic
Copy link
Member

prolic commented Mar 22, 2018

@enumag if you could update the copyright year to 2018, then I'll merge and release this.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 99.401% when pulling 997b69f on enumag:patch-1 into a3ea636 on prooph:master.

@enumag
Copy link
Member Author

enumag commented Mar 22, 2018

@prolic Done. The build is passing now.

@prolic prolic merged commit 6c8651e into prooph:master Mar 22, 2018
@prolic
Copy link
Member

prolic commented Mar 22, 2018

see: https://github.com/prooph/common/releases/tag/v4.2.2

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.

4 participants