tessel / openwrt-tessel

OpenWrt build scripts and package feed for Tessel 2
Other
32 stars 14 forks source link

Increase memory space to 30MB. #76

Closed huseyinkozan closed 7 years ago

huseyinkozan commented 7 years ago

75% of MemAvailable.

Could not find a test tool that fills the memory. If you can share, I can test with it.

HipsterBrown commented 7 years ago

@tcr @johnnyman727 @LinusU Are you familiar with the space requirements for Tessel?

Frijol commented 7 years ago

also cc @kevinmehall

johnnyman727 commented 7 years ago

@HipsterBrown I seem to recall that OpenWRT takes up about 8M of Flash but I'm not sure about RAM usage. I don't know much more than that.

huseyinkozan commented 7 years ago

75% is coming from #lede-dev channel:

<huseyinkozan> Hi all. I am creating a PR for Tessel like this one : https://github.com/tessel/openwrt-tessel/pull/73
<huseyinkozan> I want to set proper values to v8 options. Can I use MemAvailable value at /proc/meminfo for max memory value ?
<huseyinkozan> MemFree is ~20MB and MemAvailable is ~40MB while no running node app
* rajeevn çıkış yaptı (Read error: Connection reset by peer)
* rajeevn (~rajeevn@unaffiliated/rajeevn) giriş yaptı
<jmv2009> huseyinkozan: Maybe stay at 757
<jmv2009> 75% of that
<jmv2009> ?
* Eli2| (~Eli2@pdpc/supporter/professional/eli2) giriş yaptı
<swalker> updated lede/upstream, https://sdwalker.github.io/uscan/lede.html
* Eli2_ çıkış yaptı (Ping timeout: 258 seconds)
<jmv2009> huseninkozan: https://unix.stackexchange.com/questions/261247/how-can-i-get-the-amount-of-available-memory-portably-across-distributions
<jmv2009> huseninkozan:http://elixir.free-electrons.com/linux/v4.7/source/mm/page_alloc.c#L4211
huseyinkozan commented 7 years ago

@rwaldron Will you add this to next release ?

rwaldron commented 7 years ago

Well, I didn't include it when I built the bin earlier today. I will start over tomorrow.

huseyinkozan commented 7 years ago

This may not a solution to my problem. After some profiling at computer, I got ~16-20 MB RAM usage. I developed a gui with expressjs, and we are at the end of deadline. It works for one client with 30MB, but second fills memory, and exit.

Can we add an external USB memory as a swap ? Found extroot, but want to ask before trying to invent the wheel. Do we have any ready solution to this ?

Edit: Also, I want to know if I manage to invent USB swap wheel, do I need to set this V8 options and use a custom firmware ?

Edit 2: I thing, extroot is not what I need. I will try to mount a swap partitioned USB disc with fstab.

huseyinkozan commented 7 years ago

I have solved my problem with the command below:

node --max_old_space_size=1024 --max_semi_space_size=128 --max_executable_size=128 --nooptimize_for_size /app/remote-script/dist/index.js

We can cancel this PR. Maybe we can add a t2-cli option to set memory limits. And a guide to use external swap to increase memory. Also, configuring OpenWRT to auto on the swap partitions may be useful.

Edit: To auto mount swap partitions, add these to /etc/config/fstab

config 'global' 'autoswap'
        option 'from_fstab' '1'
        option 'anon_swap' '1'
rwaldron commented 7 years ago

Sorry everyone, I was out sick and offline almost all of this past week

huseyinkozan commented 7 years ago

I hope you'll get better soon