ChrisM
ChrisM

Reputation: 1

Softlayer API -- exception happened when calling softlayer api

I got an exception: "TransportError: TransportError(0): ('Connection aborted.', error(110, 'Connection timed out'))" when I called the api: Virtual_Guest::getBandwidthTotal.

It happened in this situation:

  1. one same softlayer-api username and key

  2. I called the functions concurrently thousands times at one moment.

So I do not know the exception happened due to "huge concurrent api callings" or just a network problem, or some other reasons.

If it causes since "huge concurrent api callings", here is an additional question:

As I says before that I called with one same username and key, if I calls concurrently with different username and key, will this exception happen as well?

Upvotes: 0

Views: 91

Answers (2)

Chris Gallo
Chris Gallo

Reputation: 191

There is a limit on the number of API calls that can be made by an account per second. I believe this limit is per username, however I would not recommend using a bunch of different users to get around this limit.

My suggestion would be to use an objectMask to get as much data as possible in one API call, instead of making numerous api calls.

Instead of calling Virtual_Guest::getBandwidthTotal on every virtual guest on your account, you could call

SoftLayer_Account::getVirtualGuests(mask="mask[inboundPrivateBandwidthUsage,inboundPublicBandwidthUsage,outboundPrivateBandwidthUsage,outboundPublicBandwidthUsage]") 

You might also need to use result Limits so that one big call doesn't time out as well.

Upvotes: 0

The timeout errors are usually generated when the client is waiting a response of the API, this situation is documented here, in your case you can try to increase the timeout of your client, if you are using the Softlayer Python client please see the documentation to increase the timeout here, and aslo please review that you network connection is fine.

Regards

Upvotes: 1

Related Questions