mardi 19 juillet 2016

How long should a Microsoft Azure machine learning API take to respond?

I've been trying to use a web app made in Ruby on Rails to access Microsoft's machine learning API. I already designed the API and deployed it as a web service, but all calls I have made so far have timed out and exceeded Heroku's 30 second limit. Is this a sign that something in my implementation is wrong, or is it normal to take that long and I should go for an asynchronous approach using Blobs instead?

Here is my sample HTTP post code:

def post
    url = @api_url
    uri = URI.parse(url)
    http = Net::HTTP.new(uri.host, uri.port)
    @request = Net::HTTP::Post.new(@api_url)
    @request.set_form_data({"Authorization" => "Bearer #{@api_key}", "Content-Length" => "#{@payload.length}", "Content-Type" => "application/json", "Accept" => "application/json"})
    @request.body = @payload
    resp = http.request(@request)
end

Aucun commentaire:

Enregistrer un commentaire