you could do this before the request hits marklogic with a reverse proxy like haproxy or varnish.
________________________________________ From: [email protected] [[email protected]] on behalf of Will Thompson [[email protected]] Sent: 04 March 2013 23:46 To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Throttling webservice calls typo: "Task Scheduler" => "Task Server" From: Will Thompson <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Discussion <[email protected]<mailto:[email protected]>> Date: Monday, March 4, 2013 3:44 PM To: MarkLogic Discussion <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] Throttling webservice calls Can anyone recommend a good way to throttle calls to a webservice API that has transaction limits? I.e.: one call per second restrictions to a remote webservice. My first thought was to configure Task Scheduler to handle only one thread. Then whenever someone needs to hit the webservice it spawns something like this (using <result>{fn:true()}</result>): let $response := xdmp:http-get('http://some-webservice') return ($response, xdmp:sleep(seconds-from-duration(xs:dayTimeDuration('PT1S') - xdmp:elapsed-time()) * 1000)) This would keep requests to a maximum 1 per second, but anyone calling it with an empty queue would still have to wait the full second to get their result. Also, if anything else relied on Task Server being able to execute tasks with multiple threads, this would break it. -Will _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
