humanmade / query-monitor-flamegraph

Flamegraphs for Query Monitor
57 stars 6 forks source link

PHP 7 ? #2

Open raptor235 opened 8 years ago

raptor235 commented 8 years ago

Hey @joehoyle is php7 supported with the "XHProf with configurable sampling" project?

joehoyle commented 8 years ago

@raptor235 unfortunately not, php7 changed the extensions api quite a lot, and in both Tideways and the XHProf PHP7 fork, they removed the ability to do sampling. We asked in https://github.com/tideways/php-profiler-extension/issues/26 if there was interest in supporting it, but there's been no response yet.

joehoyle commented 8 years ago

I also updated the readme at https://github.com/humanmade/query-monitor-flamegraph/blob/master/README.md to say php7 isn't supported on that one.

raptor235 commented 8 years ago

@joehoyle I did manage to get this working with TIdeways extension just FYI

joehoyle commented 8 years ago

@raptor235 oh interesting, what did you do to do that?

raptor235 commented 8 years ago

Nothing in particular, I had tideways installed already and I went through the regular setup process for this project and it just worked...

http://i.imgur.com/9C9iMJE.png

Let me know if you need any particular info if I can help.

On Thu, Oct 6, 2016 at 3:57 PM, Joe Hoyle notifications@github.com wrote:

@raptor235 https://github.com/raptor235 oh interesting, what did you do to do that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/humanmade/query-monitor-flamegraph/issues/2#issuecomment-252071267, or mute the thread https://github.com/notifications/unsubscribe-auth/AATJ4cuR4_o64BfrQo2ywN2yjK-I-Ff-ks5qxVKSgaJpZM4KOqx_ .

Bart Dabek Co-Founder, CTO Technology FlowPress Inc m: 647-588-6285 a: 119 Spadina Ave. Suite 1203 w: FlowPress.com http://flowpress.com/ e: bart@flowpress.com https://twitter.com/bartdabek https://www.linkedin.com/in/bartdabek

joehoyle commented 8 years ago

@raptor235 hmm that screenshot is for XHGui, no?

raptor235 commented 8 years ago

Yeah showing that flamegraphs do work on PHP7

On Thu, Oct 6, 2016 at 4:17 PM, Joe Hoyle notifications@github.com wrote:

@raptor235 https://github.com/raptor235 hmm that screenshot is for XHGui, no?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/humanmade/query-monitor-flamegraph/issues/2#issuecomment-252076193, or mute the thread https://github.com/notifications/unsubscribe-auth/AATJ4RcoNTiCNK8kDz55o_OomQkWWFvNks5qxVdWgaJpZM4KOqx_ .

Bart Dabek Co-Founder, CTO Technology FlowPress Inc m: 647-588-6285 a: 119 Spadina Ave. Suite 1203 w: FlowPress.com http://flowpress.com/ e: bart@flowpress.com https://twitter.com/bartdabek https://www.linkedin.com/in/bartdabek

joehoyle commented 8 years ago

Ahh ok - so yes, it's possible that flamegraphs can be generated via Tideways, I'm just not sure what data structure that is using, I don't think it's via sampling. However, I'll give setting up xhgui to try that out, are flamegrphs supported out of the box there?

raptor235 commented 8 years ago

Yep

On Thu, Oct 6, 2016 at 4:26 PM, Joe Hoyle notifications@github.com wrote:

Ahh ok - so yes, it's possible that flamegraphs can be generated via Tideways, I'm just not sure what data structure that is using, I don't think it's via sampling. However, I'll give setting up xhgui to try that out, are flamegrphs supported out of the box there?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/humanmade/query-monitor-flamegraph/issues/2#issuecomment-252078508, or mute the thread https://github.com/notifications/unsubscribe-auth/AATJ4UEIuj-RXExqGMnCGzMj0yH2Q_t7ks5qxVmGgaJpZM4KOqx_ .

Bart Dabek Co-Founder, CTO Technology FlowPress Inc m: 647-588-6285 a: 119 Spadina Ave. Suite 1203 w: FlowPress.com http://flowpress.com/ e: bart@flowpress.com https://twitter.com/bartdabek https://www.linkedin.com/in/bartdabek

joehoyle commented 8 years ago

@raptor235 so I'm looking into this a bit more to understand how XHGui is able to generate full flamegraphs off the xhprof_enable style profiling (not sampling). I'm pretty sure this is generated from the 1 level deep data that you can get from XHProf (See http://web.archive.org/web/20110514095512/http://mirror.facebook.net/facebook/xhprof/doc.html#Limitations) looks like this: https://github.com/perftools/xhgui/blob/7e35a4f2a2e21cc66a5a4e5a6b3840dc12ed03ad/tests/ProfileTest.php#L108. I believe XHGui then attempts to build a full stack trace on the framegraphs by making the 1 level deep profiling by trying to convert something like:

'main()==>your_func' => array(
    'ct' => 1,
),
'your_func==>other_func' => array(
    'ct' => 1,
),

Into a hierarchical call graph like:

'main()==>your_func==>other_func' => array(
    'ct' => 1,
),

Unsurprisingly this is very lossy as it's not a true representation of the call stack, when I took a look at your flamegraph

I noticed most of the data is pretty wrong - it shows get_term taking the majority of the time, which apparently is a wrapping call for the majority of the WordPress load, which is not true.

More digging is needed to see if just this flamegraph is incorrect, or if this is 1) an issue with XHGui, or 2) the data from XHProf / Tideways is not sufficient to generate a true fullstack call graph.

raptor235 commented 8 years ago

Interesting, I'll see if I can setup another php 5.x env and compare the same pages with sampling enabled. Thanks for taking a deeper look.

Mte90 commented 7 years ago

any update for this?

rmccue commented 7 years ago

I put a bunch of time into this; basically, XHProf has to be ported to PHP 7. Still nothing there; I had a half-working fork, but it would occasionally segfault.

Mte90 commented 7 years ago

For tideways in case?

rmccue commented 7 years ago

Tideways doesn't support the profiling mode required to produce flamegraphs (nor do other XHProf ports to PHP 7 generally)