Xander
Xander

Reputation: 9171

Scaling a long running web service

I was thinking of creating a web service that does a long running process. What would be the best way to design these to work with a load balancer? I can't think of any way of doing it besides writing a custom queue.

Upvotes: 0

Views: 127

Answers (1)

cs-NET
cs-NET

Reputation: 516

That is exactly what you should do. You typically want your web service calls to be a quick request/response. So make a call to the web service, have the web service queue the work then have worker processes pick up the messages from the queue and process them.

This is the way to go, queuing the long running processes allows your system to scale, allows you to add recovery logic if a process fails, allows you to scale quickly by adding additional workers to process the queue, and best of all does not tie up the client waiting for a response.

REDIS (http://redis.io/) has been my choice over the past few years, if you are using Azure or AWS they have messaging services as well.

You can also use websockets to notify the client when processes are completed to keep the UI state in the loop.

Upvotes: 1

Related Questions