关于R plumber的基本问题
Basic questions about R plumber
我是 R plumber 的新手,它是一个 REST 服务器,可以将 R 函数公开为 rest API。
我会问以下问题:
- R plumber server 是否足够强大,可以在生产环境中采用?
- 暴露为rest的函数api,如果函数做复杂且耗时的逻辑,如何设置超时的东西来保持连接?
- R plumber 支持多少并发请求?
(偏见:我是水管工的作者)
- Is R plumber server strong enough to be adopted in production environment?
Plumber 还很年轻,但我知道现在有很多人在生产中使用 Plumber。这是一个这样的例子的文章:https://www.mango-solutions.com/blog/production-r-at-ons
- The function,which is exposed as rest api, If the function does complex and time consuming logic, how to set the time out things to keep the connection alive?
目前没有办法在特定端点上强制超时。这将取决于 API 作者确保函数保持足够轻量,以便它们能够 return 在合理的时间内。否则,您可能希望启动一个单独的进程来处理一项耗时 运行 的任务,以便您可以快速响应传入的请求。
- How many concurrent requests does R plumber support?
R 在单线程中,所以在任何给定时刻它只能做一件事(没有特殊的解决方法)。这也适用于管道工。您在单个 R 进程中的管道工 API 运行 在任何给定时刻只能执行一个 function/endpoint。其他传入请求将排队等待,直到 R 进程准备好开始处理它们。
解决方案是 运行 多个并行的 R 进程,并对这些进程的传入流量进行负载平衡。更多讨论:https://plumber.trestletech.com/docs/hosting/ and a solution: https://plumber.trestletech.com/docs/docker-advanced/
我是 R plumber 的新手,它是一个 REST 服务器,可以将 R 函数公开为 rest API。
我会问以下问题:
- R plumber server 是否足够强大,可以在生产环境中采用?
- 暴露为rest的函数api,如果函数做复杂且耗时的逻辑,如何设置超时的东西来保持连接?
- R plumber 支持多少并发请求?
(偏见:我是水管工的作者)
- Is R plumber server strong enough to be adopted in production environment?
Plumber 还很年轻,但我知道现在有很多人在生产中使用 Plumber。这是一个这样的例子的文章:https://www.mango-solutions.com/blog/production-r-at-ons
- The function,which is exposed as rest api, If the function does complex and time consuming logic, how to set the time out things to keep the connection alive?
目前没有办法在特定端点上强制超时。这将取决于 API 作者确保函数保持足够轻量,以便它们能够 return 在合理的时间内。否则,您可能希望启动一个单独的进程来处理一项耗时 运行 的任务,以便您可以快速响应传入的请求。
- How many concurrent requests does R plumber support?
R 在单线程中,所以在任何给定时刻它只能做一件事(没有特殊的解决方法)。这也适用于管道工。您在单个 R 进程中的管道工 API 运行 在任何给定时刻只能执行一个 function/endpoint。其他传入请求将排队等待,直到 R 进程准备好开始处理它们。
解决方案是 运行 多个并行的 R 进程,并对这些进程的传入流量进行负载平衡。更多讨论:https://plumber.trestletech.com/docs/hosting/ and a solution: https://plumber.trestletech.com/docs/docker-advanced/