飞溅内存限制(scrapy)
Splash memory limit (scrapy)
我是从 docker 开始的。
我为 splash 和 scrapy 创建了大的 lua 脚本,然后是 运行 我看到了问题:
Lua error: error in __gc metamethod (/app/splash/lua_modules/sandbox.lua:189: script uses too much memory
如何增加启动时的内存?
不幸的是,从 Splash 2.3.2 开始,没有提高这些限制的内置方法。限制在此处被硬编码:https://github.com/scrapinghub/splash/blob/7b6612847984fc574ebbedf9c3c750180cd93813/splash/lua_modules/sandbox.lua#L176 - 您可以更改该值,然后通过 运行 docker build -t splash .
从 Splash source checkout 重建 Docker 图像,然后使用此图像而不是图像来自 DockerHub.
我通过优化 lua 脚本解决了我的问题。原来 splash:select("a#story-title").node.innerHTML
比 splash:evaljs('document.getElementById("story-title").innerHTML;')
重多了
我是从 docker 开始的。 我为 splash 和 scrapy 创建了大的 lua 脚本,然后是 运行 我看到了问题:
Lua error: error in __gc metamethod (/app/splash/lua_modules/sandbox.lua:189: script uses too much memory
如何增加启动时的内存?
不幸的是,从 Splash 2.3.2 开始,没有提高这些限制的内置方法。限制在此处被硬编码:https://github.com/scrapinghub/splash/blob/7b6612847984fc574ebbedf9c3c750180cd93813/splash/lua_modules/sandbox.lua#L176 - 您可以更改该值,然后通过 运行 docker build -t splash .
从 Splash source checkout 重建 Docker 图像,然后使用此图像而不是图像来自 DockerHub.
我通过优化 lua 脚本解决了我的问题。原来 splash:select("a#story-title").node.innerHTML
比 splash:evaljs('document.getElementById("story-title").innerHTML;')