At the time of writing, I'm using SDK version 1.9.31:
- sources on Github: https://github.com/aws/aws-sdk-java
- Javadoc : https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/
The code (source on Github) is pretty self-explanatory and totally similar to the CLI example in the previous article.
- Get the list of models
- Pick one
- Build a prediction request : data record + endpoint
- Fire the request
- Get a result!
Here's the output:
Nice and simple. What about performance? My previous article measured a CLI call (aka 'aws machinelearning predict') within us-east-1 at around 300ms, well above the 100ms mentioned in the FAQ.
Believe or not, the Amazon product team got in touch (I'm not worthy, I'm not worthy... and thanks for reading!). They kindly pointed out that this measurement includes much more than the call to the web service and of course, they're right.
Fortunately, the Java program above is finer-grained and allows us to measure only the actual API call. I packaged it, deployed it to a t2.micro EC2 instance running in us-east-1 (same configuration as before) and...
Average time is around 80ms, which is indeed under the 100ms limit mentioned in the FAQ. There you go :)
I'm definitely looking forward to using this in production. Till next time, keep rockin'.
No comments:
Post a Comment