How to find maximum update domains/fault domains available in an Azure region - powershell

The only way I know of to enquire maximum update domains or fault domains allowed for creation of an avaiability set in Azure is by passing very large values and then parsing the error message. Is there a better way to query for the maximum values?
For example, executing New-AzureRmAvailabilitySet -PlatformUpdateDomainCount 100 -PlatformFaultDomainCount 100 <other parameters> will fail with an error that looks like below:
ErrorCode: InvalidParameter
ErrorMessage: The specified fault domain count 100 must fall in the range 1 to 2.
StatusCode: 400
ReasonPhrase: Bad Request

Maybe you can find the maximum fault domains in this article:
The maximum update domains is 20 by default.

Related

Waypoint sequencing API returning server error and no guidance on what the error is

I am trying to run the waypoint sequencing request in this guide:
https://developer.here.com/documentation/routing-waypoints/dev_guide/topics/example-truck.html
This is the postman request I am issuing(Yes, I inserted my API key)
https://wps.hereapi.com/v8/findsequence2?apiKey={MY_API_KEY}
&start=WiesbadenCentralStation;50.0715,8.2434
&destination1=FranfurtCentralStation;50.1073,8.6647
&destination2=DarmstadtCentralStation;49.8728,8.6326
&destination3=FrankfurtAirport;50.0505,8.5698
&destination4=HanauCentralStation;50.1218,8.9298
&end=MainzCentralStation;50.0021,8.259
&departure=2014-12-09T09:30:00%2b01:00
&mode=car;traffic:disabled;
All I get is: Status: 500 Internal Server Error.
QUESTION 2:
If we have to specify 100 waypoints will we run into any issues?
For the issue related to 500 error, we don't see any issue at our end.
For your question 2: The maximum number of waypoints including the start point and destination is 120 without traffic and 50 with traffic. If the routing mode pedestrian is used, the distance between each two of the waypoints must not be greater than 5km. You can refer to this doc:
https://developer.here.com/documentation/routing-waypoints/dev_guide/topics/request-constructing.html

Rate limiting in Google Cloud Storage

At the tope of every minute my code uploads between 20 to 40 files total (from multiple machines, about 5 files in parallel until they are all uploaded) to Google Cloud Storage. I frequently get 429 - Too Many Errors, like the following:
java.io.IOException: Error inserting: bucket: mybucket, object: work/foo/hour/out/2015/08/21/1440191400003-e7ba2b0c-b71b-460a-9095-74f37661ae83/2015-08-21T20-00-00Z/
at com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl.wrapException(GoogleCloudStorageImpl.java:1583)
at com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl$3.run(GoogleCloudStorageImpl.java:474)
... 3 more
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 429 Too Many Requests
{
"code" : 429,
"errors" : [ {
"domain" : "usageLimits",
"message" : "The total number of changes to the object mybucket/work/foo/hour/out/2015/08/21/1440191400003-e7ba2b0c-b71b-460a-9095-74f37661ae83/2015-08-21T20-00-00Z/ exceeds the rate limit. Please reduce the rate of create, update, and delete requests.",
"reason" : "rateLimitExceeded"
} ],
"message" : "The total number of changes to the object mybucket/work/foo/hour/out/2015/08/21/1440191400003-e7ba2b0c-b71b-460a-9095-74f37661ae83/2015-08-21T20-00-00Z/ exceeds the rate limit. Please reduce the rate of create, update, and delete requests."
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:432)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at com.google.cloud.hadoop.gcsio.GoogleCloudStorageImpl$3.run(GoogleCloudStorageImpl.java:471)
... 3 more
I have some retry logic, which helps a bit, but even after some exponential backoff and up to 3 retries, I still often get the error.
Strangely, when I go to the Google Developers Console -> APIs & auth -> APIs -> Cloud Storage API -> Quotas, I see Per-user limit 102,406.11 requests/second/user. When I look at the Usage tab, it shows no usage.
What am I missing? How do I stop getting rate limited when uploading files to GCS? Why is my quota so high and my usage reported as 0?
Judging by your description of multiple machines all taking an action at the same moment, I suspect all of your machines are attempting to write exactly the same object name at the same moment. GCS limits the number of writes per second against any one single object (1 per second).
Since it looks like your object names end in a slash, like they're meant to be a directory (work/foo/hour/out/2015/08/21/1440191400003-e7ba2b0c-b71b-460a-9095-74f37661ae83/2015-08-21T20-00-00Z/ ), is it possible you meant to end them with some unique value or a machine name or something but left that bit off?
That error happens when you attempt to update the same object too frequently. From https://cloud.google.com/storage/docs/concepts-techniques#object-updates:
There is no limit to how quickly you can create or update different objects in a bucket. However, a single particular object can only be updated or overwritten up to once per second.

Correct HTTP status code to number of itens per page exceeded + pagination offset

I have a restriction in my API where the maximum number permitted of itens per page is 50.
What is the correct HTTP code to return to consumer if he put 51, for example?
I thought in HTTP 400 (Bad request), because the consumer "knows" (based in API conventions) that the maximum is 50. In this case I will also return a response with the error described.
The same question for pagination. If I have 20 rows/objects and the API consumer put 21 in the offset param, should I return HTTP 200 with total = 0?
This definitely falls into the 4XX categories of HTTP response.
For the first scenario:
I think the post appropriate status for this use case is 400 BAD REQUEST, based on the HTTP spec (https://www.rfc-editor.org/rfc/rfc7231#section-6.5.1)
6.5.1. 400 Bad Request
The 400 (Bad Request) status code indicates that the server cannot
or will not process the request due to something that is perceived
to be a client error (e.g., malformed request syntax, invalid
request message framing, or deceptive request routing).
The user "knows" that API will not accept > 50 and the server will/would try to fulfil the another request that conforms with the rules of your API.
For the second scenario:
I'm not sure if understood that correctly.
200 OK would be correct if your API shows all 20 rows/objects instead of silently saying that the request succeed and there's no objects at all!
However:
You might consider 404 Not Found depending on your business rules if the page 21 does not exist.
From RFC7231
:
The 404 (Not Found) status code indicates that the origin server did
not find a current representation for the target resource or is not
willing to disclose that one exists.
Maybe you could explain more the second scenario and I'll edit the response accordingly :)
Let's suppose you are working with offset and limit in the request and count (and perhaps total) in the response.
You ask for a maximum number of results (limit) skipping n results from the beginning (offset) and in the response you get the items, and the number of items returned (to facilitate automation).
The first scenario should not be an error. It is the same case as the last page (they ask for 50 but you only return remaining).
You should return HTTP 200 and the field count=50 or the number of records returned.
The second scenario could return one of these:
HTTP 200 with count=0 (total must be allways the same) and no items in the returned list.
HTTP 400 because invoker asked for an url that is invalid
HTTP 404 because items to return are not found
I think it's safe to return an error (4xx + error info) in this situation because the offset can be exceeded by one of these assumptions:
A coding error
Invoker is not fetching data from begining (no fresh state)
Invoker ignored pagination data (present on each response)
You are not using total field in the response (which is optional because there are some situations where you can not count all items or simply it's very expensive counting them). In this case, if your last page has the same number of items (count) as the number of items asked for in the request (limit), there is no way to know that this is the last page, so you try another one. In that last request you will get a count=0 in the response and you can stop asking for pages. This case makes it fair to return a 200 code also because the programmer did exactly what you asked for in the API documentation.
It must be one of the 4xx status codes, as the server is more than capable of supplying more and hasn't failed in any way, so it's a client error.
400 Bad Request doesn't quite fit to me as there's no "error" per-se, you're simply asking for more than is allowed, but in the correct manner.
I'd opt for 405 Method Not Allowed (A request was made of a resource using a request method not supported by that resource).
Although it's vague, and nothing is going to react according to the status code. I'm assuming the consumer will set it up, realise it's not working, check what was returned and see your error message stating too many rows were requested (max 50).
I wouldn't return 200, that implies there are no items to be had, it doesn't suggest an error on their part.

enable more form fields per post coldfusion [duplicate]

There is a ColdFusion function where we have to pass more then 100 arguments to get a search result. When passing these 100 odd parameters into the function, ColdFusion throws the error: "404 not found"
I tried to increase post size Limit in CF server settings from 100 to 300 but am still getting the error.
Increasing the "post size limit" only changes how many megabytes can be received, not the quantity.
For that, you need to increase the "post parameters limit" in neo-runtime.xml, by adding* or updating the XML node:
<var name='postParametersLimit'><number>300.0</number></var>
Then save the file and restart the ColdFusion server for the changes to take effect.
* If the 'postParametersLimit' field is not present, you can insert it immediately before <var name='postSizeLimit'> - whilst it's not mandatory to place it there specifically, this is a simple way to ensure it does not get nested invalidly.
Note that this affects the number of form fields (i.e. HTTP POST parameters) being submitted - not the number of arguments to a function, but this is presumably your problem because the latter should not cause a 404 error.
In ColdFusion 10, the post parameters limit is a setting in the Administrator:
Server Settings / Settings / Request Size Limits / Maximum number of POST request parameters
This setting defaults to 100.
Increase it to the required amount of parameters required to be accepted.
(We just had to increase ours to 300!)

Maximum number of network updates retrieved per API call

Is there any restriction on the number of entries that are retrieved using a single call to the Network Updates API? I found this forum comment "The per-user limit is per call, so 300 requests with however many updates they have." on the thread
http://developer.linkedin.com/forum/increase-search-api-throttle-limit
I want to confirm that indeed there is no limit. I have received as many as 106 entries in a single call.
Thanks in advance.
The maximum number of updates returned from the Network Updates API appears to be 250. Performing the following query as an example:
http://api.linkedin.com/v1/people/~/network/updates?count=500
Even if I try to specify the start parameter at, say, 250, I can't get the next 250 updates from the API:
http://api.linkedin.com/v1/people/~/network/updates?count=250&start=250
So it looks like 250 is the max, with no ability to page beyond that.
UPDATE:
Have verified that 250 is the maximum number returned, either in a single call or via the paging parameters. Looks like the documentation has been updated to reflect this.