-
-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling multiple requests #352
Comments
1000 requests at a time? Are you developing a DDoS attack app? |
No. Forgive me if that seems a bit unrealistic, it is a specification of the person overseeing the product. The idea is that a user should be able to get updated data for their stocks from our backend. My boss has some experience using bloomberg excel api, so I assume that is where he is getting the idea from. As it is right now a user can make multiple requests, but this slows down once the number of queries increases. I’m looking for a way to reduce this time. Thanks |
You should rewrite your API so that you can collect the 1,000 stock ids and submit them in a single request, and return the results in a single response. This will result in far better performance. |
But if you have to submit requests in parallel, this is possible using the async approach. You may need to manually apply the code in #206 if you want to use the Async code I developed as this has not been merged by the code owner. |
Appreciate the feedback Sophist. I was able to run the requests in parallel like you suggested, but it raises another concern. I'm assuming that in order to get this to work, the client need the WinHTTP Services reference selected. I want this add in to be ready to go out of the box, and not require the user to have to do configuration. So now I ask, am I wrong in my assumption? If not, is there a way for me to turn this reference on with my add-in? Thanks |
I don't know - but the reference is turned on in the VBA project i.e. the Excel spreadsheet or Excel Addin. So distribute it as one of these and you should be OK. |
Got it to work. |
Did you make your API support multiple stocks in one call - believe me, in real life over a slow connection populating 1,000 stock details using 1,000 calls will be unbelievably slow. So if 1,000 is your design point, your API should support at least 100 or 200 stocks in one call. |
Hi @KD33 I'm sure others will have the same question, care to elaborate on your final solution / include some sample code? (@Sophist-UK Thanks for helping out here) |
@Sophist-UK we're using NodeJS, so my thought was that it would be able to handle multiple incoming requests at once due to it's asynchronous nature. @timhall gladly, although I found myself running into another problem The function that makes a request to our API
End Function`
What I would like to be able to do is have the response from my API parsed in the callback and sent back to the ConnectToAPI function, but this isn't the case. I checked that the callback is receiving the response (it is), but my guess is that the response from the callback isn't ready by the time As for why I need the parsed data sent back to the original function, I'd like for the function to be callable from a cell in Excel. That way a user can have in their cell What I tried to do is pass the address of the cell calling the function down to the callback, then putting the parsed data in that cell address. However, this doesn't allow the user to F9 refresh the function to get the most recent values (a constraint placed by my boss). |
Thanks for the details. I've looked into ways of creating a wrapper for running multiple requests at once that handles the asynchrony for you, but haven't had the chance to look at it in a while. |
Hello, I am working on an add-in that needs to be able to make multiple requests at once. The idea is:
Get user input from cell -> Package this in a web request -> Our backend sends back a response based on what's sent in the web request. I have no trouble setting up the request response cycle, but am having some issues with latency, and am wondering if anyone has suggestions so that I can make about 1000-1500 queries at a time.
I thought about making the request, then saving the response content to the excel file, but the problem with this is that the backend data updates on an unpredictable schedule. Therefore, a user using this saved response could end up with old data in their spreadsheet.
Thanks
The text was updated successfully, but these errors were encountered: