XLL RTD COM fetching data from Web Service (hundreds of requests)

Add-in Express™ Support Service
That's what is more important than anything else

XLL RTD COM fetching data from Web Service (hundreds of requests)
How to get more performance from doing multiple WebRequest calls? 
psycho




Posts: 18
Joined: 2013-02-25
Hello Add-in Express,

I've been playing with your product for a few days and it's been very exciting. Thanks for the high quality offering :)

Within a few hours of downloading, I was able to get simple fetches from my web service from Excel using C#'s WebRequest and StreamReader. Way cool! As it is though, I'm doing 1-for-1 request/data... but I need to process about 300 to 1000 requests per go. When latency is introduced through the net or from the db querying, it can become very slow (even @ 10ms * 1000 requests = wait ~2min).

To make it more performant, I was planning to create a request packaging function probably at the COM (or RTD?) level that intercepts the XLL UDFs requests and processes them in bulk later. Maybe a "Process" button will need to be clicked first to send out a single web request with the batch. Upon receipt of the response (more complex data structure) it will process and feed back correct data to the UDFs.

I'm just wondering if there are better ways to tackle this scenario? Or am I on the right track?
Posted 25 Feb, 2013 12:04:54 Top
Andrei Smolin


Add-in Express team


Posts: 18817
Joined: 2006-05-11
Hello,

You can use the ADXRTDTopic.Connect event to add the topic to a list of topics, and periodically convert the list to a request (or series of requests) to the web service and fetch data. When a new data portion is received, you can tap Excel on the shoulder asking it to take the data; you do this by calling ADXRTDServerModule.UpdateTopic() or ADXRTDServerModule.UpdateTopics(). Note that these methods are also called by the timer which you control using the ADXRTDServerModule.Interval property; you can set Interval=0 to stop the timer.


Andrei Smolin
Add-in Express Team Leader
Posted 26 Feb, 2013 04:49:59 Top
psycho




Posts: 18
Joined: 2013-02-25
Thanks for the quick reply Andrei, you're the best! I'm going to do some more reading then give your suggestions a try :) Hope all is well in Belarus~~ Cheers.

- Minh
Posted 26 Feb, 2013 09:09:38 Top