I've developed a custom service application which causes quite some load on a server. It processes a PDF document and performs OCR and some more recognition on it. For this we're using a third party component which is quite heavy.

It's ok that the process is a heavy one, that's just the way it is. But I'm using the service application from within workflows throughout the site. When multiple workflows fire at once, the server is running multiple OCR processes at once, which takes up too much resources.

So I'm looking for a way to properly manage this. I don't want to scale out immediately, so I'm looking for a way to queue the processing jobs. Since the workflows are async, it doesn't really matter how long the process takes.

I'm not quite sure what a good aproach would be, so I'm looking for some guidelines / best practices on this topic.


How about using the workflows to set flags in a list somewhere and then creating a Timer Job that runs on an app server and fires every 5 minutes or so. It would check the list and then process the OCR for the items and then update the source items. If needed, it could push the workflow to the next step as well.

That gets the load off of your Web Front Ends, gets it out of the Workflow process and prevents numerous instances of it firing at once.

  • As you developed custom service application, you could utilize service application database and store submitted requests in the service database table. SPService class has a collection of Job Definitions , so you can register custom Timer Job against service instance. To keep it crispy & clean. You can also force Timer Job to execute on chosen server (see SPJobLockType.Job) to move workload from front-end servers to application server (if you've got one free). – Maksymilian Mulawa Jul 17 '12 at 19:24
  • Sounds interesting, I could link a job to my service application and use that to process the OCR tasks one by one. But that would mean the call to my service application would just write an entry in the queue and then succeed. How would I then make my workflow wait for the document to process and kick off again after it's processed by the timer job? – Jasper Jul 18 '12 at 10:45
  • By the way, what exactly do you mean by service application database? At the moment I'm not creating a seperate database for my service app. I am storing some configuration values, but those are stored by SharePoint, I guess somewhere in the system config database? – Jasper Jul 18 '12 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.