You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by Jason Dusek <ja...@gmail.com> on 2013/10/14 06:23:31 UTC

Backoff on instance running timeout -- via properties?

Hi All,

I'd like to perform instance launches with a gradually
increasing timeout...if I fail the first time, at say two
minutes, then I'd like to extend the timeout to three minutes,
then to four.

The problem is that the timeout is set not on a per request
basis, but in the builder for the ComputeServiceContext, via a
property override. If elsewhere one of my programs only has the
ComputeServiceContext, how can it adjust the property? I can not
find the API for that.

I thought about instantiating a new builder that would clone
things over from the old context, but this seems not to be a
supported pattern.

Thanks for making jClouds, which has been undeniably helpful in
allowing me to work across clouds at a high level.

--
Jason Dusek
pgp // solidsnack // C1EBC57DC55144F35460C8DF1FD4C6C1FED18A2B

Re: Backoff on instance running timeout -- via properties?

Posted by Ignasi <ig...@gmail.com>.
Hi Jason,

In jclouds that is configured in separate places. One thing is the
timeout used for each request, and another one is how the retry logic
will be executed when necessary.

There is not a dynamic way to configure the timeouts, but you can
configure a custom timeout for each method you call from the target
API, by configuring the appropriate properties when creating the
context. A part from globally configuring the timeouts, you can
provide more fine grained configuration properties in the form:
"jclouds-timeouts.<api method name>", where that "<api method name>"
is the name of the method you are calling. If you take a look at the
different APIs jclouds implements (take the EC2 InstanceApi [1] as an
example) you'll see that each method has a @Named annotation. That is
the name you have to use to configure a specific timeout for that
concrete API call.

Apart from that, when a request has to be retried, jclouds applies an
exponential backoff retry policy by default. Take a look at the
BackoffLimitedRetryHandler [2] to have an idea of how it works and how
you can customize it.


Perhaps you can combine both to configure what you are trying to achieve.


HTH!

Ignasi


[1] https://github.com/jclouds/jclouds/blob/master/apis/ec2/src/main/java/org/jclouds/ec2/features/InstanceApi.java
[2] https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/http/handlers/BackoffLimitedRetryHandler.java

On 14 October 2013 06:23, Jason Dusek <ja...@gmail.com> wrote:
> Hi All,
>
> I'd like to perform instance launches with a gradually
> increasing timeout...if I fail the first time, at say two
> minutes, then I'd like to extend the timeout to three minutes,
> then to four.
>
> The problem is that the timeout is set not on a per request
> basis, but in the builder for the ComputeServiceContext, via a
> property override. If elsewhere one of my programs only has the
> ComputeServiceContext, how can it adjust the property? I can not
> find the API for that.
>
> I thought about instantiating a new builder that would clone
> things over from the old context, but this seems not to be a
> supported pattern.
>
> Thanks for making jClouds, which has been undeniably helpful in
> allowing me to work across clouds at a high level.
>
> --
> Jason Dusek
> pgp // solidsnack // C1EBC57DC55144F35460C8DF1FD4C6C1FED18A2B
>