Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Splash memory limit (scrapy)

I have splash started from docker. I create big lua script for splash and scrapy, and then it's run i see problem:

Lua error: error in __gc metamethod (/app/splash/lua_modules/sandbox.lua:189: script uses too much memory

How i can encrease memory for splash?

like image 774
Verz1Lka Avatar asked Aug 03 '26 23:08

Verz1Lka


2 Answers

Unfortunately, as of Splash 2.3.2, there is no a built-in way to raise these limits. Limit is hardcoded here: https://github.com/scrapinghub/splash/blob/7b6612847984fc574ebbedf9c3c750180cd93813/splash/lua_modules/sandbox.lua#L176 - you can change the value, and then rebuild Docker image by running docker build -t splash . from Splash source checkout, and then use this image instead of image from DockerHub.

like image 178
Mikhail Korobov Avatar answered Aug 07 '26 13:08

Mikhail Korobov


I solve my problem by optimizing the lua script. It turns out splash:select("a#story-title").node.innerHTML is much heavier than splash:evaljs('document.getElementById("story-title").innerHTML;')

like image 41
Aminah Nuraini Avatar answered Aug 07 '26 11:08

Aminah Nuraini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!