Jump to content

How to profile product save on production?


gloomybear

Recommended Posts

Hello,

 

I am having a performance problem - it takes loooong to save a product in BO. In most cases save ends with overtime.

 

I tried to nail a problem by profiling on a local copy - but problem seems to exist only on prod.

I tried to disable various modules but problem still persists.

 

I cannot just enable profiling on prod because the site has many visitors.

Is it possible to save profiling results to some log file?  Or to enable profiling only on BO?

 

Any advice how to solve this problem are much appreciated!

Link to comment
Share on other sites

Thank you both!

 

Yes, I have my php.ini max_execution_time increased to 1000. Nevertheless script fails after a minute with 501.

 

Thanks to your advice, El Patron, I improved script from dh42 to fit my needs. This is what I use to profile only on BO:

// defines.inc.php, replace line 44

if (strpos($_SERVER['REQUEST_URI'],'admin') !== false) {
	define('_PS_DEBUG_PROFILING_', true);
} else {
	define('_PS_DEBUG_PROFILING_', false);
}

Profiling BO is not helping however because when you click save on product there is:

1) actual product save and execution of hook productUpdate - not visible in profiling :(

2) display of product catalog - visible in profiling, and everything OK

 

Any advice how to profile step 1?

Edited by gloomybear (see edit history)
Link to comment
Share on other sites

Sorry  <_< It's actually 503: Service unavailable. This error is unusual because max_execution_time is set on 1000 but 'service unavailable' is thrown after circa 30 seconds.

 

I have checked server logs and there is a strange error like this: 

[Tue Jan 06 16:52:41.458140 2015] [proxy_fcgi:error] [pid 46073:tid 34954938368] [client 78.8.143.220:51957] AH01067: Failed to read FastCGI header, referer http://site.com/234admin/index.php?controller=AdminProducts&id_product=1539&updateproduct&token=cfe32909555d823cd093c611ba3d39ca

[Tue Jan 06 16:52:41.458163 2015] [proxy_fcgi:error] [pid 46073:tid 34954938368] (70014)End of file found: [client 78.8.143.220:51957] AH01075: Error dispatching request to :, referer http://site.com/234admin/index.php?controller=AdminProducts&id_product=1539&updateproduct&token=cfe32909555d823cd093c611ba3d39ca

I assume my host is using apache proxy and problem is there... I have just wrote my host  asking about this issue.

 

Thank you for hints El Patron, it helped me to progress with the issue.

Edited by gloomybear (see edit history)
Link to comment
Share on other sites

Anyway - do you know how to profile product save to check:

1) how long does it take to save a product,

2) what are execution times of hooks on productUpdate?

 

With profiling enabled I can only see profiling info for rendering product catalog (where user is redirected after successful save).

Link to comment
Share on other sites

I would look at error logs

 

check from hosting control panel logs-->error_log (note you may need to enable prestashop debug mode to obtain error but usually mod_security will log issue regardless)

 

also, you may need to enable prestashop debug mode.

 

doing a little searching, it's possible this is just a 'super' slow hosting...what sort of hosting package shared/vps/dedicated are you  using?

Link to comment
Share on other sites

I am on shared hosting and have there 2 accounts.

 

On account A it is ultraslow. I contacted the host and they said: "Everything is fine on our side, it is slow script which jumps with CPU utilization up to 100%". They kill the script when script uses 100% CPU for long time.

On account B product save is blink of an eye. And B is very similar to A.

 

This is why I want to debug / profile product update on this particular installation.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...