Thanks Jason for your explanation. Based on your comment I can say if the main thread is no where using the requested result then the main process will logged "Process completed" and will not bother about whether http-get or post any completed.
Meanwhile I will try to verify the question I am asking. Expecting some more input from your side. Thanks & Regards Abhishek Srivastav Systems Engineer Tata Consultancy Services Cell:- +91-9883389968 Mailto: abhishek5...@tcs.com Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ From: Jason Hunter <jhun...@marklogic.com> To: General MarkLogic Developer Discussion <general@developer.marklogic.com> Date: 07/14/2011 09:56 PM Subject: Re: [MarkLogic Dev General] Async behavior of HTTP request Sent by: general-boun...@developer.marklogic.com What slide 36 is saying is that an xdmp:http-get() and xdmp:http-post() will (invisibly to the user) start a background thread to do the remote fetch while letting your main thread continue. At the time your program needs to read the results, it'll block if the background request hasn't finished. It's an optimization technique, and the talk is explaining that if you want to fetch 2 URLs you probably don't want to fetch/look/fetch/look but rather fetch/fetch/look/look and really you want to delay the looking at results until you have no other work to do that doesn't depend on the fetched result. There's some pretty cool stuff going on for performance in MarkLogic that you don't usually need to think about, but sometimes being aware of it can help you maximize performance. The Search API uses a lot of these techniques internally. -jh- On Jul 14, 2011, at 12:44 AM, Abhishek53 S wrote: Danny Thanks for reply . Referring the link ( http://www.marklogicevents.com/file/presentations/Effective_XQuery_in_MarkLogic_Heitkamp_Koul.pdf ) where on slide 36 it is mentioned that HTTP interfaces executes asynchronously. Let me know If I misunderstood. Can It be possible to run child some transaction asynchronously. I am thinking of one way to achieve it where the child module is written into separate xqy file and then use xdmp:spawn to invoke the module. In this case the parent transaction will not wait for the response from the spawned module. Let me know If I am wrong here. Any separate way to achieve the asynchronous child transaction? Thanks Abhishek Srivastav Tata Consultancy Services Cell:- +91-9883389968 Mailto: abhishek5...@tcs.com Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ From: Danny Sokolsky <danny.sokol...@marklogic.com> To: General MarkLogic Developer Discussion <general@developer.marklogic.com> Date: 07/14/2011 06:27 AM Subject: Re: [MarkLogic Dev General] Async behavior of HTTP request Sent by: general-boun...@developer.marklogic.com Hi Abhishek, I think the http-get requests are *synchronous*, not asynchronous; that is, they will wait until they get the results to move on to the next thing in the query. So I am not sure I understand your question. For example, if you run the following: let $x := (xdmp:http-get("http://marklogic.com"), xdmp:log("Req # 1"), xdmp:sleep(1000)) let $y := (xdmp:http-get("http://marklogic.com"), xdmp:log("Req # 1"), xdmp:sleep(1000)) return xdmp:log("Process completed") You will see 3 log messages in your log, and they will be about 1 second apart from each other. 2011-07-13 17:53:48.395 Info: danny: Req # 1 2011-07-13 17:53:49.462 Info: danny: Req # 1 2011-07-13 17:53:50.462 Info: danny: Process completed -Danny From: general-boun...@developer.marklogic.com [ mailto:general-boun...@developer.marklogic.com] On Behalf Of Abhishek53 S Sent: Wednesday, July 13, 2011 12:36 PM To: General MarkLogic Developer Discussion Subject: [MarkLogic Dev General] Async behavior of HTTP request Hi Folks, As per my understanding of HTTP request through Marklogic HTTP APIs is that they are asynchronous by nature.Between the HTTP service requests the behavior is asynchronous. Is the calling module execute asynchronously with invoked HTTP requests ie sample query let $x := xdmp:http-get($uri1,()) let $y := xdmp:http-get($uri2,()) return xdmp:log("Process completed") Can the logging be done irrespective to wait for the response from both the requests? Your suggestions will be appreciated. Thanks in advance Abhishek Srivastav Tata Consultancy Services Cell:- +91-9883389968 Mailto: abhishek5...@tcs.com Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general