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

Support for request batching via /batch endpoint? #9271

Closed
nitzmahone opened this issue Jan 5, 2018 · 17 comments
Closed

Support for request batching via /batch endpoint? #9271

nitzmahone opened this issue Jan 5, 2018 · 17 comments
Assignees
Labels
ARM - Core ARM ARM-Core Triaged customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. Service Attention This issue is responsible by Azure service team.

Comments

@nitzmahone
Copy link

After seeing how the portal batch-fetches VM instanceViews for PowerState so quickly via the /batch endpoint, I hacked together a batched version of instance_view() on ComputeManagementClient. I couldn't find any docs about the batch endpoint though (complicated by the prevalence of docs for the Batch service)..

Is /batch actually supported, and if so, any chance for "official" support for batched operations via msrestazure and/or the Python SDK? The bulk VM instanceView fetch is the only thing I can think of right now that I'd need it for, but there are probably plenty of other things out there too...

cc @lmazuel

@lmazuel
Copy link
Member

lmazuel commented Jan 5, 2018

That's super interesting, I didn't know about this one either.
@devigned @johanste ? thoughts?

@lmazuel
Copy link
Member

lmazuel commented Jan 5, 2018

(sniffed from the portal)
Request URL:https://management.azure.com/batch?api-version=2015-11-01
Request Method:POST

{
	"requests": [{
		"url": "https://management.azure.com/subscriptions/XXXXXXXX/resourceGroups/rgfluentchash-6828/providers/Microsoft.Compute/virtualMachines/chashvm?api-version=2017-03-30&$expand=instanceView",
		"httpMethod": "GET"
	}, {
		"url": "https://management.azure.com/subscriptions/XXXXXXXX/resourceGroups/javacsmrg3492/providers/Microsoft.Compute/virtualMachines/extvm3158?api-version=2017-03-30&$expand=instanceView",
		"httpMethod": "GET"
	}, {
		"url": "https://management.azure.com/subscriptions/XXXXXXXX/resourceGroups/vmbdtest2680/providers/Microsoft.Compute/virtualMachines/javavm?api-version=2017-03-30&$expand=instanceView",
		"httpMethod": "GET"
	}, {
		"url": "https://management.azure.com/subscriptions/XXXXXXXX/resourceGroups/vmbdtest2819/providers/Microsoft.Compute/virtualMachines/javavm?api-version=2017-03-30&$expand=instanceView",
		"httpMethod": "GET"
	}, {
		"url": "https://management.azure.com/subscriptions/XXXXXXXX/resourceGroups/vmbdtest3413/providers/Microsoft.Compute/virtualMachines/javavm?api-version=2017-03-30&$expand=instanceView",
		"httpMethod": "GET"
	}, {
		"url": "https://management.azure.com/subscriptions/XXXXXXXX/resourceGroups/vmbdtest5047/providers/Microsoft.Compute/virtualMachines/javavm?api-version=2017-03-30&$expand=instanceView",
		"httpMethod": "GET"
	}]
}

response

{
	"responses": [{
		"httpStatusCode": 200,
		"headers": {
			"Pragma": "no-cache",
			"x-ms-ratelimit-remaining-resource": "Microsoft.Compute/LowCostGet3Min;4799,Microsoft.Compute/LowCostGet30Min;38399",
			"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
			"x-ms-served-by": "XXXXXXXXXXXX",
			"x-ms-request-id": "XXXXXXX",
			"Cache-Control": "no-cache",
			"Server": "Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0",
			"x-ms-ratelimit-remaining-subscription-reads": "14989",
			"x-ms-correlation-request-id": "XXXXXXXXXX",
			"x-ms-routing-request-id": "WESTUS2:20180105T165654Z:cfe09e58-53d6-4079-b426-51ecb0ac88bd",
			"Date": "Fri, 05 Jan 2018 16:56:53 GMT"
		},
		"content": {
			"properties": {
			"type": "Microsoft.Compute/virtualMachines",
			"location": "southcentralus",
			"tags": {},
			"id": "/subscriptions/XXXXXXXX/resourceGroups/rgfluentchash-6828/providers/Microsoft.Compute/virtualMachines/chashvm",
			"name": "chashvm"
		},
		"contentLength": 4058
	}
}

@johanste
Copy link
Member

johanste commented Jan 5, 2018

I don't know why the API is not publicly documented (I have asked in the past but not gotten an authoritative answer). I may be that the endpoints don't have the SLAs needed for them to be supported for arbitrary usage. @ravbhatnagar, any insights?

@devigned
Copy link
Member

devigned commented Jan 5, 2018

💯 Uhm... That's something we should have documented.

@nitzmahone
Copy link
Author

nitzmahone commented Jan 8, 2018

Yeah, it's definitely handy... The ARM implementation switches from a single synchronous response to a standard polled long-running operation at 20+ items (which that C# client didn't seem to take into account at first glance), and maxes out at 500 embedded requests. I don't have enough VMs laying around in my test account to poke at the limits for the instanceView use case that I care most about, but in my crusty prototype, fetching instanceView for 10 VMs usually comes back in < 1s, which is a HUGE improvement over 10 additional round trips.

I'm sure there are a number of other things this could be useful for, but the fact that it remains undocumented on ARM is definitely of concern. I'm leaning toward using it anyway for our new inventory plugin; perhaps with a switch or auto-fallback to the standard method on any unexpected failures.

@jtuliani
Copy link

Any update on getting the /batch API documented? I'd like to understand it better, for example can it do more than just GET requests, how to I specify a request body, etc.

@clarkd
Copy link

clarkd commented Feb 22, 2019

Is there any update here? I can't find any documentation for the /batch endpoint. It's also used by Azure Monitor to fetch data across multiple resources which would otherwise be many API calls.

@lmazuel lmazuel transferred this issue from Azure/msrestazure-for-python Dec 27, 2019
@lmazuel lmazuel assigned lmazuel and unassigned lmazuel Dec 27, 2019
@lmazuel lmazuel added ARM ARM - Core Mgmt This issue is related to a management-plane library. Service Attention This issue is responsible by Azure service team. labels Dec 27, 2019
@ghost
Copy link

ghost commented Dec 27, 2019

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

3 similar comments
@ghost
Copy link

ghost commented Dec 27, 2019

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

@ghost
Copy link

ghost commented Dec 27, 2019

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

@ghost
Copy link

ghost commented Dec 27, 2019

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

@xiangyan99
Copy link
Member

@ifeoluwaokunoren any update on this issue?

@RAY-316 RAY-316 added the issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. label Dec 15, 2021
@ghost
Copy link

ghost commented Dec 15, 2021

Hi @nitzmahone. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

@ghost
Copy link

ghost commented Dec 22, 2021

Hi @nitzmahone, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.

@ghost ghost closed this as completed Dec 22, 2021
@kaptajnen
Copy link
Contributor

/unresolve

@ghost
Copy link

ghost commented Jan 8, 2022

Hi kaptajnen, only the original author of the issue can ask that it be unresolved. Please open a new issue with your scenario and details if you would like to discuss this topic with the team.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ARM - Core ARM ARM-Core Triaged customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests