Answers.Body: <p>Update: when the combination below is present (at least with some JetPack paid plans), it seems that JetPack’s ‘Dedicated Sync’ thread which gets called on login is somehow blocked by CiviCRM’s session management giving the 30s timeout. I’ve been working with JetPack engineers for a while now, taking traces to narrow things down. The workaround is for them to disable the Dedicated Sync thread, but I’m not sure what is lost when you do that. That warning in WordPress’s system health about an active PHP session is probably not as harmless as has been mentioned here…</p>
  <p>It seems like this was related to something going on with the JetPack plugin, in the end. CiviCRM + JetPack + all the themes I tried that didn't come with WordPress = slow login. CiviCRM + JetPack + included WordPress themes = fast login, but the layout options weren't what I wanted. Change any of those and logins were fast. JetPack Support noticed an unknown-cause, not fully understood by me sync discrepancy, fixed it, and now any login after the first one (per user, per browser, so, session cookie updating) is fast. Given that there will always be something going wrong unexpectedly, I'm hoping they'll take my suggestion and make the JetPack plugin a bit more robust, assuming that was in fact the root cause.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-26T15:47:57.330Z
Answers.LastActivityDate: 2023-01-24T16:03:03.013Z
Answers.LastEditDate: 2023-01-24T16:03:03.013Z
Answers.UserDisplayName: Michael Matthews
Answers.Body: <p>I am unsure if this is an 'answer' but I have seen this before and I have always tracked it down to another plugin waiting on a request.   That plugin on it's own is not the issue, but as it's unaware of CiviCRM the combination is the issue.</p>
  <p>I'd start by disabling all plugins except CiviCRM, go to a default theme and see if the problem is still there.   If it is I'd look at the server/fpm settings.</p>
  <p>If CiviCRM loads on a clean site, I'd enable the theme, test.  If no issues I'd move to plugins one by one until I found the issue.</p>
  <p>I've just tested on a cpanel server (closest I have to your config) and with a theme we use on most sites (Kadence) and about 20 plugins - login is nearly instant.</p>
  <p>My enviornment is WP 6.0.3, CiviCRM 5.54, php 7.4-fpm, CentOS and WHM/cPanel</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-10T00:22:19.033Z
Answers.Text: Thanks, finally made time to poke around a bit more. Seems like it's the Vantage theme that's interacting poorly with CiviCRM for slow logins.
Answers.UserDisplayName: Michael Matthews
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-13T16:44:08.460Z
Answers.Text: Or maybe something used by Vantage, because I do have another site that has CiviCRM and Vantage but doesn't have a slow login. Really wish there was a thorough way to analyze performance of calls to /wp-admin/admin-ajax.php here.
Answers.UserDisplayName: Michael Matthews
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-31T13:35:48.927Z
Answers.LastActivityDate: 2022-10-31T13:35:48.927Z
Answers.UserDisplayName: Kevin Cristiano
Body: <p>Just upgraded to CiviCRM 5.54.1, on WordPress 6.0.3 (self-hosting on a virtual private host running CentOS 9, PHP 7.4.32 using php-fpm). For a really long time now, I think since the beginning to be honest, there's been a roughly 25 second delay after a user clicks login before the login is accepted and the login page starts to be processed on the server. Once that happens things are quick.</p>
  <p>Browser debugging has the wait squarely on admin-ajax.php. Enabling custom logging on my SSL request log confirms that the request to that URL takes 30 seconds on login (most of the time it's logged as 0 seconds, as it only logs in units of integer seconds).</p>
  <p>It's not OS resource related, it's not traffic related. I don't think it has anything to do with database performance as there isn't much traffic or activity at all, and no SQL queries are showing as suspicious (unable to tell if there are just a bajillion of them adding up with my view though). I can't find anything in any error log even with debugging turned on that helps me figure out what's going on.</p>
  <p>Disabling the CiviCRM plugin causes logins to be instantaneous. Re-enabling brings back the login delay. While I know that the two WordPress tests around REST API timeout and active PHP session are deemed harmless and there are posted workarounds to disable those tests, I can't help but wonder if while the tests may be testing the wrong thing, the underlying issue may be valid.</p>
  <p>Searched this group and the internet in general several times, trying different search terms, to no avail. No help on the WordPress StackExchange group either.</p>
  <p>So, does anyone have any ideas what it may be or how I could narrow the culprits down a bit?</p>
  <p>Thank you.</p>
  <p>Michael</p>
  
Tags: <wordpress><performance>
Title: CiviCRM plugin causes a ~ 30 second login delay
ThreadText: # CiviCRM plugin causes a ~ 30 second login delay
  
  (Asked by: username_0 on 2022-10-30)
  
  Just upgraded to CiviCRM 5.54.1, on WordPress 6.0.3 (self-hosting on a virtual private host running CentOS 9, PHP 7.4.32 using php-fpm). For a really long time now, I think since the beginning to be honest, there's been a roughly 25 second delay after a user clicks login before the login is accepted and the login page starts to be processed on the server. Once that happens things are quick.
  
  Browser debugging has the wait squarely on admin-ajax.php. Enabling custom logging on my SSL request log confirms that the request to that URL takes 30 seconds on login (most of the time it's logged as 0 seconds, as it only logs in units of integer seconds).
  
  It's not OS resource related, it's not traffic related. I don't think it has anything to do with database performance as there isn't much traffic or activity at all, and no SQL queries are showing as suspicious (unable to tell if there are just a bajillion of them adding up with my view though). I can't find anything in any error log even with debugging turned on that helps me figure out what's going on.
  
  Disabling the CiviCRM plugin causes logins to be instantaneous. Re-enabling brings back the login delay. While I know that the two WordPress tests around REST API timeout and active PHP session are deemed harmless and there are posted workarounds to disable those tests, I can't help but wonder if while the tests may be testing the wrong thing, the underlying issue may be valid.
  
  Searched this group and the internet in general several times, trying different search terms, to no avail. No help on the WordPress StackExchange group either.
  
  So, does anyone have any ideas what it may be or how I could narrow the culprits down a bit?
  
  Thank you.
  
  Michael
  
  **Tags:** wordpress, performance
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2022-11-26. Score: 1
  
  Update: when the combination below is present (at least with some JetPack paid plans), it seems that JetPack’s ‘Dedicated Sync’ thread which gets called on login is somehow blocked by CiviCRM’s session management giving the 30s timeout. I’ve been working with JetPack engineers for a while now, taking traces to narrow things down. The workaround is for them to disable the Dedicated Sync thread, but I’m not sure what is lost when you do that. That warning in WordPress’s system health about an active PHP session is probably not as harmless as has been mentioned here…
  
  It seems like this was related to something going on with the JetPack plugin, in the end. CiviCRM + JetPack + all the themes I tried that didn't come with WordPress = slow login. CiviCRM + JetPack + included WordPress themes = fast login, but the layout options weren't what I wanted. Change any of those and logins were fast. JetPack Support noticed an unknown-cause, not fully understood by me sync discrepancy, fixed it, and now any login after the first one (per user, per browser, so, session cookie updating) is fast. Given that there will always be something going wrong unexpectedly, I'm hoping they'll take my suggestion and make the JetPack plugin a bit more robust, assuming that was in fact the root cause.
  
  
  ---
  
  ### Answer by username_1 on 2022-10-31. Score: 0
  
  I am unsure if this is an 'answer' but I have seen this before and I have always tracked it down to another plugin waiting on a request. That plugin on it's own is not the issue, but as it's unaware of CiviCRM the combination is the issue.
  
  I'd start by disabling all plugins except CiviCRM, go to a default theme and see if the problem is still there. If it is I'd look at the server/fpm settings.
  
  If CiviCRM loads on a clean site, I'd enable the theme, test. If no issues I'd move to plugins one by one until I found the issue.
  
  I've just tested on a cpanel server (closest I have to your config) and with a theme we use on most sites (Kadence) and about 20 plugins - login is nearly instant.
  
  My enviornment is WP 6.0.3, CiviCRM 5.54, php 7.4-fpm, CentOS and WHM/cPanel
  
  > **Comments:**
  > **username_0**: Thanks, finally made time to poke around a bit more. Seems like it's the Vantage theme that's interacting poorly with CiviCRM for slow logins.  
  > **username_0**: Or maybe something used by Vantage, because I do have another site that has CiviCRM and Vantage but doesn't have a slow login. Really wish there was a thorough way to analyze performance of calls to /wp-admin/admin-ajax.php here.  
  
  ---
  
  