Shiny.io 内存不足

Shiny.io out of memory

我正在尝试使用 R 中的 shiny web 应用程序创建交互式地图。在创建应用程序并将其部署到我的 shiny.io 帐户后,应用程序的 URL 实际上不显示地图,但只显示侧面板和主面板。打开网页约15秒后,会提示与服务器断开连接

这是 shint 应用程序的 link:https://www.shinyapps.io/admin/#/application/2621249

这是 shiny.io 的日志:

2020-07-29T02:44:56.206023+00:00 shinyapps[2621249]: Loaded GDAL runtime: GDAL 2.2.2, released 2017/09/15
2020-07-29T02:44:56.206025+00:00 shinyapps[2621249]: Loaded PROJ runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
2020-07-29T02:44:56.206025+00:00 shinyapps[2621249]: Path to PROJ shared files: (autodetected)
2020-07-29T02:44:56.206025+00:00 shinyapps[2621249]: Linking to sp version:1.4-2
2020-07-29T02:44:56.223035+00:00 shinyapps[2621249]: The following object is masked _by_ ‘.GlobalEnv’:
2020-07-29T02:44:56.222229+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.223036+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.222232+00:00 shinyapps[2621249]: Attaching package: ‘ggplot2’
2020-07-29T02:44:56.222232+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.223037+00:00 shinyapps[2621249]:     mpg
2020-07-29T02:44:56.223037+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.753980+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.753982+00:00 shinyapps[2621249]: Attaching package: ‘plotly’
2020-07-29T02:44:56.753983+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.754327+00:00 shinyapps[2621249]: The following object is masked from ‘package:ggplot2’:
2020-07-29T02:44:56.754641+00:00 shinyapps[2621249]:     filter
2020-07-29T02:44:56.754640+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.754328+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.754639+00:00 shinyapps[2621249]: The following object is masked from ‘package:stats’:
2020-07-29T02:44:56.754949+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.754329+00:00 shinyapps[2621249]:     last_plot
2020-07-29T02:44:56.754950+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.754950+00:00 shinyapps[2621249]:     layout
2020-07-29T02:44:56.772112+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.772476+00:00 shinyapps[2621249]: The following objects are masked from ‘package:stats’:
2020-07-29T02:44:56.772114+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.772476+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.754329+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.772477+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.754641+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.772113+00:00 shinyapps[2621249]: Attaching package: ‘dplyr’
2020-07-29T02:44:56.754948+00:00 shinyapps[2621249]: The following object is masked from ‘package:graphics’:
2020-07-29T02:44:56.772808+00:00 shinyapps[2621249]: The following objects are masked from ‘package:base’:
2020-07-29T02:44:56.772808+00:00 shinyapps[2621249]: 
2020-07-29T02:44:56.772809+00:00 shinyapps[2621249]:     intersect, setdiff, setequal, union
2020-07-29T02:44:56.772477+00:00 shinyapps[2621249]:     filter, lag
2020-07-29T02:44:56.772809+00:00 shinyapps[2621249]: 
2020-07-29T02:45:08.209263+00:00 shinyapps[2621249]: trying URL 'https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_state_500k.zip'
2020-07-29T02:45:08.390900+00:00 shinyapps[2621249]: downloaded 3.2 MB
2020-07-29T02:45:08.390902+00:00 shinyapps[2621249]: 
2020-07-29T02:45:08.459882+00:00 shinyapps[2621249]: OGR data source with driver: ESRI Shapefile 
2020-07-29T02:45:08.459895+00:00 shinyapps[2621249]: Source: "/srv/connect/apps/USMapWithCountyPolygon/cb_2018_us_state_500k.shp", layer: "cb_2018_us_state_500k"
2020-07-29T02:45:08.459896+00:00 shinyapps[2621249]: with 56 features
2020-07-29T02:45:08.459896+00:00 shinyapps[2621249]: It has 9 fields
2020-07-29T02:45:08.459908+00:00 shinyapps[2621249]: Integer64 fields read as doubles:  ALAND AWATER 
2020-07-29T02:45:11.681534+00:00 shinyapps[2621249]: Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
2020-07-29T02:45:11.681536+00:00 shinyapps[2621249]: Please use `arrange()` instead.
2020-07-29T02:45:11.681537+00:00 shinyapps[2621249]: See vignette('programming') for more help
2020-07-29T02:45:11.681538+00:00 shinyapps[2621249]: This warning is displayed once every 8 hours.
2020-07-29T02:45:11.681538+00:00 shinyapps[2621249]: Call `lifecycle::last_warnings()` to see where this warning was generated.
2020-07-29T02:45:31.135291+00:00 shinyapps[system]: Out of memory!

最后一行说 shinyapps 系统内存不足。在这种情况下我应该怎么做才能解决它?

您可以尝试增加内存大小,使用仪表板或使用以下代码。 rsconnect::configureApp("APPNAME", size="xlarge")

默认情况下 shinyapp.io 应用有 1024MB,xlarge 增加到 2048MB。最大的是xxxlarge,8192MB。

我假设应用程序在本地 运行 时正常运行。在本地 运行ning 时,您可以使用任务管理器或类似工具来查看您的应用程序内存使用情况。您可能需要优化您的应用内存使用。