Monday, 15 September 2014

java - Implementing idempotency for AWS Spot Instance Requests -



java - Implementing idempotency for AWS Spot Instance Requests -

i'm using java aws sdk create ec2 spot instance requests. opposed on demand instances, api spot requests not have similar clienttoken , not back upwards idempotency out of box.

the straightforward way think of set launchgroup property unique uuid; when check phone call describespotinstancerequests , see if have request same launch group.

to surprise, seems there's delay before describe phone call returns spot requests sent before. wrote junit test , seems in order consistent have set timeout of @ to the lowest degree 60s between 2 calls (request spot instance , describe spot instance requests). need have granularity of 10s, because requests can repeated application @ interval, in case of failure - i.e. breaks after sent request before read result got amazon. in case don't want have request repeated, want see got registered , move on.

@test public void testrunspotinstances() throws exception { activity.execute(execution); timeout(timeout); // shouldn't activity.execute(execution); timeout(timeout); describespotinstancerequestsresult result = client.describespotinstancerequests( new describespotinstancerequestsrequest().withfilters(new filter() .withname("launch-group").withvalues(business_key))); assertthat(result.getspotinstancerequests()).hassize(1); timeout(timeout); }

the test works every time if timeout set 60s; 40-50s works intermittently. below fails every time.

has managed work around delay? implementing idempotency spot requests possible using aws api , not having state saved in client application?

in case don't want have request repeated, want see got registered , move on.

if got 200 back, it's registered. may not show right away, it's registered , can move on in flow.

is implementing idempotency spot requests possible using aws api , not having state saved in client application?

i don't believe so. have same sort of issue amazon's emr. way work around have component who's job observe clusters. when create request emr cluster, cluster id, pass off observer. observer phone call other components when cluster changes state. not beingness acknowledged emr right away valid case , not treated exception.

i have no thought if that's appropriate you. perhaps seek maintaining spotinstancerequestid. in case, maintain them in memory, maintain them somewhere persistent if need be.

java amazon-web-services amazon-ec2

No comments:

Post a Comment