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

Request: Document #8

Closed
semsphy opened this issue Jul 7, 2020 · 16 comments
Closed

Request: Document #8

semsphy opened this issue Jul 7, 2020 · 16 comments
Assignees

Comments

@semsphy
Copy link

semsphy commented Jul 7, 2020

Would you please update the document?

@rez1dent3
Copy link
Member

Hi, Can I have more details?

@rez1dent3 rez1dent3 self-assigned this Jul 7, 2020
@semsphy
Copy link
Author

semsphy commented Jul 7, 2020

Hi @rez1dent3 ,

I installed the package, but I can't get it works.

@rez1dent3
Copy link
Member

You need to install xhprof, and then configure it to your needs.

'enabled' => true,
'global_middleware' => true,
'path' => '/opt/xhprof',
'output_dir' => null,
'name' => 'xhprof',
'freq' => 1 / 1000,
'extension_name' => 'xhprof',
'provider' => \Bavix\XHProf\Providers\XHProfProvider::class,

@semsphy
Copy link
Author

semsphy commented Jul 7, 2020

'path' => '/opt/xhprof', the lib of xhprof was not included in this package. where can I get it?

I debugged

if ($freq >= (mt_rand() / mt_getrandmax())) {
and it is never true.

@rez1dent3
Copy link
Member

rez1dent3 commented Jul 7, 2020

'path' => '/opt/xhprof', the lib of xhprof was not included in this package. where can I get it?

Xhprof source path

and it is never true.

You are not right

@semsphy
Copy link
Author

semsphy commented Jul 7, 2020

Ok, I will try again. How can I show the result of profiling?

@semsphy
Copy link
Author

semsphy commented Jul 7, 2020

I want to confirm one more thing, If I use the tideway, the lib from xhprof still works?

@rez1dent3
Copy link
Member

Ok, I will try again. How can I show the result of profiling?

expand and configure
https://github.com/longxinH/xhprof/tree/master/xhprof_html

@semsphy
Copy link
Author

semsphy commented Jul 7, 2020

'path' => '/opt/xhprof', the lib of xhprof was not included in this package. where can I get it?

Xhprof source path

and it is never true.

You are not right

>>> config('xhprof.freq', 0.01);
=> 0.001
>>> mt_rand() / mt_getrandmax()
=> 0.75573935301776

I followed the default configuration, you see the 0.001 >= 0.7555 , I tested many time it is never true. How can I tweak to make it works in term of best practice?

@rez1dent3
Copy link
Member

I followed the default configuration, you see the 0.001 >= 0.7555 , I tested many time it is never true. How can I tweak to make it works in term of best practice?

Screenshot from 2020-07-07 12-36-33

I log not all requests, but only one thousandth.

Screenshot from 2020-07-07 12-37-40
And here is how it works on production.

@semsphy
Copy link
Author

semsphy commented Jul 7, 2020

image

From cli it works. What is the purpose of freq?

@semsphy
Copy link
Author

semsphy commented Jul 7, 2020

If I changed the freq => 1 in xhprof.php I can produce the output, any idea?

image

@rez1dent3
Copy link
Member

What is the purpose of freq?

xhprof can be used in production. To reduce the load, I log part of the requests. That there was no overhead

@semsphy
Copy link
Author

semsphy commented Jul 7, 2020

What is the purpose of freq?

xhprof can be used in production. To reduce the load, I log part of the requests. That there was no overhead

I changed my freq to 1 to make it works, it is not a good idea?

@rez1dent3
Copy link
Member

I changed my freq to 1 to make it works, it is not a good idea?

Depends on your load. I would advise no more than 1% of requests

@semsphy
Copy link
Author

semsphy commented Jul 8, 2020

I changed my freq to 1 to make it works, it is not a good idea?

Depends on your load. I would advise no more than 1% of requests

A million thanks @rez1dent3 for guiding me to get it works. I will try to adjust the freq accordingly.

@semsphy semsphy closed this as completed Jul 8, 2020
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

2 participants