Lots of rest API requests
-
Is there a filter to disable the JetPack sync requests to these URLs?
/wp-json/jetpack/v4/sync
/?rest_route=%2Fjetpack%2Fv4%2Fsync
I have a website which is receiving 6000 requests daily to these which is unnecessarily using CPU time. The only module used is the statistics one so the sync requests aren’t required.
-
Hi, are those the full paths for the requests? Just
/wp-json/jetpack/v4/sync
?Thanks for the reply. No those are truncated:
/wp-json/jetpack/v4/sync/spawn-sync?time=1709722891&request_lock_id=**
/?rest_route=%2Fjetpack%2Fv4%2Fsync%2Fstatus&_for=jetpack&token=**Hello wpcharged.
I’m looking into this issue. Depending on the site’s content and frequency of data changes, the number of requests could be as expected. Sync is part of Jetpack that syncs data so that specific features can operate. Thus, disabling it might result in features no longer functioning as expected. You can find more details about the synced data here.
Would it be possible for you to share the URL of the site in question? With this information, I can better determine if this is expected behavior or if there is some other issue and can work with you to resolve it.
If you do not wish to post it publicly here, you can contact our support privately here. If you submit a support request on our site, please include a link back to this support thread and the URL of the site receiving these requests.
The website is autocar.co.nz. I believe I have seen this on another site though but will check.
Hello again wpcharged.
Sorry for the followup before I hear back from you. I was thinking more about the endpoints that are being hit on your site. Do you see any patterns in the requests that the site receives? If so, what are the patterns?
For example, you shared that the
/wp-json/jetpack/v4/sync/spawn-sync
endpoint is requested. Is that the endpoint that receives the most requests or is there a mix of different/wp-json/jetpack/v4/sync/*
endpoints andrest_route
values that are hit? If it is a mix, can you give me examples of the endpoints that have the most requests?Thanks in advance for both the URL and endpoint details.
Edit: Looks like you just beat me on the response. Thanks for the URL information. I’ll start looking using that information while waiting for the endpoint details.
- This reply was modified 8 months, 3 weeks ago by Chris Jean.
GET /wp-json/jetpack/v4/sync/spawn-sync – 4577 requests yesterday coming from the server
GET /?rest_route=%2Fjetpack%2Fv4%2Fsync%2Fstatus – 304 requests coming from an external IPThat’s exactly what I needed. Thanks wpcharged.
I may not have any answers for you tonight (it’s getting late for me where I’m at). I’m going to share these details with my team, and we’ll make sure to get a response with more information for you within the next 24 hours.
Hello wpcharged.
Getting back to your initial question about a filter to disable Jetpack Sync requests as you’re only using the Stats feature, the Stats feature does make use of data synced by Sync. So, if Sync is disabled on the site, Stats would not function as expected.
As for the frequency of requests, I worked with my team to look over the data, and there seems to be a bug causing the relatively-high number of requests. Some data on the site is switching back and forth between two values. Each time the value switches, additional Sync requests are triggered. Since this value switch happens frequently, so do the requests.
We’re unsure of the cause just yet, but we suspect that it some kind of compatibility issue. We’ve been trying to recreate the specific situation happening on your site. Unfortunately, we have yet to determine exactly which combination of factors is creating the situation.
Would be possible for us to gain access to the site? That access would help us identify the cause much more quickly. If so, please contact our support privately here and include a link back to this support thread.
If sharing access is not possible, would you be able to tell us which plugins are active on the site? If so, you can either share that information here or share it privately in a support thread.
I have found and implemented the filter below which seems to be disabling the sync in the meantime, would this be suitable to block the sync requests?
add_filter( ‘jetpack_sync_listener_should_load’, “__return_false” );
JetPack statistics are tracked using the external stats.wp.com/e-202410.js request. I’m not sure replicating the site posts to JetPack would be required for those statistics to show in the dashboard. I have blocked the sync requests on another site and and statistics continue to work ok.
Thanks for the contact link, I may reach out via there if the sync is needed.Just following up if the filter above will be the one to use to prevent syncing of content? I have another site that made close to 10k requests to the wp-json/jetpack/v4/sync/spawn-sync URLs in one day (has since decreased to normal ranges of a handful a day) but ideally I’d like to prevent these to stop sync requests using a large amount of processing time.
I’m terribly sorry for not replying earlier wpcharged.
While I don’t recommend the code that you posted above (the
jetpack_sync_listener_should_load
filter), looking at the data on our end, I do see that it succeeded in significantly reducing the requests. I don’t recommend it for two reasons:- It’s likely only a temporary solution for your specific needs as the data that Stats uses may look accurate now since it has relatively-fresh synced data, but as time goes on, it may try to request data that either has gotten stale or does not exist as it was created after you disabled that filter. You’re correct that the actual stats are tracked using the external request, but Stats also pulls in other data, such as content titles, using synced data.
- I can’t offer any guarantees that this filter will continue to function or exist in the same manner in the future.
In short, it’s quite possible that this solution will work for you for now, I just can’t offer any assurances that it won’t cause problems for you in the months and years ahead.
My team found other sites that exhibit the same bug, and we’re narrowing in on the root cause of the issue.
For the time being, perhaps the most pragmatic solution is the following:
- You add that filter to the affected sites.
- I post an update here once my team has a solution.
- You remove the filter on the sites.
- I confirm with you that the solution resolved the issue.
Does this plan work for you?
Hey there, @wpcharged,
Do you have updates about that? We usually close inactive threads after one week of no movement, but we want to make sure we’re all set before marking it as solved. Thanks!
I am getting hammered with requests from
18.219.133.99/wp-json/jetpack/v4/sync/spawn-syncYour allow list here listed
- 122.248.245.244/32
- 54.217.201.243/32
- 54.232.116.4/32
- 192.0.80.0/20
- 192.0.96.0/20
- 192.0.112.0/20
- 195.234.108.0/22
- 192.0.64.0/18
A dozen threads here about this very issue and numerous posts form numerous people over numerous years indicating that the IPs hammering their servers are NOT in the listed range.https://jetpack.com/support/how-to-add-jetpack-ips-allowlist/
NOT ONE OF YOU who work for WP or develop this plugin has addressed that subject. You just ignore it and stammer on about the requests being expected and part of of the software. Insanity.
If these requests are legitimate then why are they not coming from the listed IP ranges? The people asking for support appear to be more informed than the people providing the support.Hi @beananimal,
Could you please start your own thread, as per the Forum Welcome?
https://www.ads-software.com/support/plugin/jetpack#new-post
?
Please also provide your site URL as it can help us assist you better and faster.Thank you!
- You must be logged in to reply to this topic.