-
Notifications
You must be signed in to change notification settings - Fork 12
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
Question: Nuxt or Angular + Fiery and concurrent requests? #26
Comments
I will let @thomasp85 speak to the specifics, but I think you could do that with the future stack? I am not positive on how the requests are scoped, but given there is an event loop, you may not even need that, and just to use some abstraction like the later/promises to not block while working. That being said, I would think carefully about whether your requests are truly concurrent, or do you need to support parallel requests. That is, if you are using fiery to support more computationally heavy tasks (parallel) vs needing to support tasks like not blocking while waiting on database calls (concurrent) then the implementations would be very different. IMO, for computationally heavy tasks, it may be worth routing them through some other web server then load balance across a number of fiery instances, which will isolate and provide control over throughput. For example, I stand up fiery workers using a go(lang) based web server with a semaphore to keep the current number of requests being executed at a time bounded. And yes fiery supports CORS |
@dpastoor thanks for the reply. Do we need any specific code to enable CORS in Fiery? For instance, if I use ExpressJS or KoaJS and I need CORS support, we need to enable it in our API, e.g.
|
@dpastoor I am a bit confused with parallel requests and concurrent requests - I thought they are they same? The problem in our Shiny apps are:
We hope Fiery is a better alternative to Shiny (which has been a nightmare to us after a few years using it for our apps). |
Hi @lautiamkok To answer your first question about concurrency: R is single threaded and there is no way around that - requests are handled one at a time so the next request will only be started once a response has been returned to the current request. This is not a limit in Alternatively you would pack the Regarding CORS, there is nothing in If you end up implementing CORS support it would be cool if you abstracted it away and implemented it as a I hope this answers your question... |
@thomasp85 thanks for the answers. Just another question - any official documentation for Fiery? |
Not outside of the package itself, but I think I’ve done a decent job with that🙂. Hopefully there will be some online documentation at some point |
CORS is pretty easy, here is how I had it (to just allow everything) . This is old code, from one of the first implementations of fiery, so @thomasp85 I'm guessing at least the request structure may be different?
Point is, at least from an MVP standpoint, you can intercept OPTIONS requests and give back the access control headers. |
@dpastoor thank you for the code. |
@lautiamkok it sounds like your problem is not just an issue with shiny, its an issue with scale, at which point infrastructure considerations are important. concurrency is the ability of a program to manage multiple requests at once - think keep track of what a bunch of users are asking at once. For example, if you just are querying a database (so most of the time is actually waiting on the DB to return results), concurrency is the ability to make those multiple queries at once and wait for them. This is the foundational principle of node, it is highly concurrent as it has an event loop and (much) of the code is written in a way that it asynchronously makes requests then just kind of checks on the status (by cycling through the event loop) of each request over and over until it is done and can do something else. parallelization is the ability to execute multiple tasks at once. For example, running multiple models at the same time for different people. |
The code example will need to be updated to at least use |
After a few years of using Shiny and we have had lots of issues with it, e.g. it is too opinionated and it does not support concurrent requests on the open source version.
I wonder Fiery support concurrent requests?
We would like to use fiery as an API only and use Nuxt or Angular to send the requests, so we need CORS, does Fiery support CORS then?
The text was updated successfully, but these errors were encountered: