Is RESTful API Suitable for Computational Services?

restweb services

Is RESTful API appropriate for the following scenario?

  • A time-limited token is obtained, which will last for one minute only
  • Image is uploaded to a server
  • Server performs some CPU-heavy image processing upon request, within the time limit
  • The result is available for download, within the time limit
  • When the token expires:
    • The image, computation, result are all discarded / terminated, and any open connection will be closed.
  • All other necessary aspects of web services, such as authentication / service authorization, quota, encryption etc., might still be necessary.

Since the "resource" is only allowed to exist for less than one minute, does it still make sense to make "resource" the first-class citizen in this API?


Update

I have found this link that talks about a REST API for job queueing in RabbitMQ. However it is an "idea page", so I'm not sure whether this is relevant or not.

Best Answer

REST as a transport protocol is suitable, as an architectual paterrn it might not be enough. Lets assume that you would want to distribute the computation accross multiple servers. This would require round robin load balancer to even out the load, and sticky sessions to ruote the result request to the same server that processed the image. You should take a look at master worker job distribution frameworks such as cellery that are based on queues, and at low latency computation frameworks such as storm.

Related Topic