Open gjedeer opened 1 year ago
Thanks for the report!
Beyond changing the way we do our requests, it will definitely be interesting to monitor and try to better understand any slow-downs that may happen with our API during USA business hours.
By any chance, were you able to run any tests while ruling out the Astra calls, to see which one of the 3 API calls caused the biggest slowdown?
On our end we'll also take a look at this. 👍
I have disabled Jetpack Protect because it was unneeded anyway, an unknowing client enabled this feature.
That being said, after disabling Protect, Jetpack is still adding at least 0.7s to most requests - and it's measured outside US business hours. I've temporarly added a logging call to class-wp-http.php.
I'll follow up with a measurement during US business hours.
[Wed May 31 10:47:58.119228 2023] [php:notice] [pid 2227] [client 5.173.196.47:0] HTTP request 1.0 s to URL https://mydomain.com/wp-json/jetpack/v4/sync/spawn-sync?time=1685530077&request_lock_id=1685530077.1143, referer: https://mydomain.com/wp-admin/index.php
[Wed May 31 10:47:58.323985 2023] [php:notice] [pid 447] [client 45.32.239.246:0] HTTP request 0.7 s to URL https://jetpack.wordpress.com/xmlrpc.php?sync=1&codec=deflate-json-array×tamp=1685530077.5971&queue=sync&cd=0.0008&pd=0.0003&queue_size=1&buffer_id=647725dd9188f&sync_flow_type=dedicated&timeout=20&home=https%3A%2F%2Fmydomain.com&siteurl=https%3A%2F%2Fmydomain.com&idc=1&for=jetpack&wpcom_blog_id=210280219
[Wed May 31 10:49:02.300900 2023] [php:notice] [pid 1665] [client 5.173.196.47:0] HTTP request 1.0 s, total so far 4.9 s, URL https://mydomain.com/wp-json/jetpack/v4/sync/spawn-sync?time=1685530141&request_lock_id=1685530141.2965, referer: https://mydomain.com/wp-admin/index.php
[Wed May 31 10:49:02.891972 2023] [php:notice] [pid 1196] [client 45.32.239.246:0] HTTP request 0.7 s, total so far 0.7 s, URL https://jetpack.wordpress.com/xmlrpc.php?sync=1&codec=deflate-json-array×tamp=1685530142.1719&queue=sync&cd=0.0010&pd=0.0004&queue_size=1&buffer_id=6477261e29b1c&sync_flow_type=dedicated&timeout=20&home=https%3A%2F%2Fmydomain.com&siteurl=https%3A%2F%2Fmydomain.com&idc=1&for=jetpack&wpcom_blog_id=210280219
[Wed May 31 10:49:37.930696 2023] [php:notice] [pid 443] [client 5.173.196.47:0] HTTP request 1.0 s, total so far 3.4 s, URL https://mydomain.com/wp-json/jetpack/v4/sync/spawn-sync?time=1685530176&request_lock_id=1685530176.9259, referer: https://mydomain.com/wp-admin/options-general.php?page=menu_editor
[Wed May 31 10:49:38.121400 2023] [php:notice] [pid 2037] [client 45.32.239.246:0] HTTP request 0.7 s, total so far 0.7 s, URL https://jetpack.wordpress.com/xmlrpc.php?sync=1&codec=deflate-json-array×tamp=1685530177.3983&queue=sync&cd=0.0007&pd=0.0004&queue_size=1&buffer_id=6477264160fdf&sync_flow_type=dedicated&timeout=20&home=https%3A%2F%2Fmydomain.com&siteurl=https%3A%2F%2Fmydomain.com&idc=1&for=jetpack&wpcom_blog_id=210280219
[Wed May 31 10:50:05.581769 2023] [php:notice] [pid 2231] [client 51.38.52.128:0] HTTP request 0.1 s, total so far 0.1 s, URL https://pixel.wp.com/t.gif?blog_lang=en-US&origin_ip=51.38.52.128&login=mydomain&_via_ua=Mozilla%2F5.0+%28Windows+NT+10.0%3B+WOW64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F57.0.2987.133+Safari%2F537.36&_via_ip=51.38.52.128&_lg=&blog_url=https%3A%2F%2Fmydomain.com&blog_id=210280219&jetpack_version=12.1.1&user_lang=0&_ut=anon&_ui=jetpack%3AwvKJBwSQ8xC2HeVX%2BDyzQHEd&_en=jetpack_failed_login&_ts=1685530205525&browser_type=php-agent&_aua=tracks-client-v0.3&_rt=1685530205526&_=_
[Wed May 31 10:50:12.674508 2023] [php:notice] [pid 2231] [client 5.173.196.47:0] HTTP request 1.0 s, total so far 3.5 s, URL https://mydomain.com/wp-json/jetpack/v4/sync/spawn-sync?time=1685530211&request_lock_id=1685530211.6698, referer: https://mydomain.com/wp-admin/admin.php?page=wc-admin
[Wed May 31 10:50:12.895441 2023] [php:notice] [pid 2542] [client 45.32.239.246:0] HTTP request 0.7 s, total so far 0.7 s, URL https://jetpack.wordpress.com/xmlrpc.php?sync=1&codec=deflate-json-array×tamp=1685530212.1525&queue=sync&cd=0.0010&pd=0.0004&queue_size=1&buffer_id=6477266424efb&sync_flow_type=dedicated&timeout=20&home=https%3A%2F%2Fmydomain.com&siteurl=https%3A%2F%2Fmydomain.com&idc=1&for=jetpack&wpcom_blog_id=210280219
[Wed May 31 10:50:49.460946 2023] [php:notice] [pid 2227] [client 5.173.196.47:0] HTTP request 1.0 s, total so far 1.7 s, URL https://mydomain.com/wp-json/jetpack/v4/sync/spawn-sync?time=1685530248&request_lock_id=1685530248.4557, referer: https://mydomain.com/wp-admin/plugins.php
[Wed May 31 10:50:49.640174 2023] [php:notice] [pid 443] [client 45.32.239.246:0] HTTP request 0.7 s, total so far 0.7 s, URL https://jetpack.wordpress.com/xmlrpc.php?sync=1&codec=deflate-json-array×tamp=1685530248.9172&queue=sync&cd=0.0011&pd=0.0004&queue_size=1&buffer_id=64772688dfa0a&sync_flow_type=dedicated&timeout=20&home=https%3A%2F%2Fmydomain.com&siteurl=https%3A%2F%2Fmydomain.com&idc=1&for=jetpack&wpcom_blog_id=210280219
[Wed May 31 10:51:14.241711 2023] [php:notice] [pid 447] [client 5.173.196.47:0] HTTP request 1.0 s, total so far 2.8 s, URL https://mydomain.com/wp-json/jetpack/v4/sync/spawn-sync?time=1685530273&request_lock_id=1685530273.237, referer: https://mydomain.com/wp-admin/admin.php?page=automatewoo-dashboard
[Wed May 31 10:51:14.418106 2023] [php:notice] [pid 2037] [client 45.32.239.246:0] HTTP request 0.7 s, total so far 0.7 s, URL https://jetpack.wordpress.com/xmlrpc.php?sync=1&codec=deflate-json-array×tamp=1685530273.6811&queue=sync&cd=0.0008&pd=0.0003&queue_size=1&buffer_id=647726a1a60e6&sync_flow_type=dedicated&timeout=20&home=https%3A%2F%2Fmydomain.com&siteurl=https%3A%2F%2Fmydomain.com&idc=1&for=jetpack&wpcom_blog_id=210280219
I'm not sure I understand. Do you mean that requests take 0.7s to complete generally, outside of US business hours, but take longer during business hours?
Impacted plugin
Protect
What
Using website with Jetpack Protect is slow in US rush hours
How
I was debugging a site that has been extremally slow during USA business hours. The site itself has not been receiving almost any traffic, server load was low etc.. In other hours, it has been working okay.
XDebug has traced this to be caused by curl HTTP requests by Jetpack and Astra. Disabling Jetpack and the offending features of Astra helped.
It seems that these days, it's possible to use asynchronous execution for HTTP - even in PHP. Would you consider using this to not slow down your users' websites when your server gets slow?