Re: [nslu2-general] Re: Swap partition
- On Fri, Mar 2, 2012 at 9:55 AM, Bill <yahoo@...> wrote:
> Some programs such as apache took more memory than the NSLU2 had just to start-up.IMHO if you had programs like that, it's a sign of bad configuration.
You should be able to easily reduce memory usage for a web server by
- changing from mpm_prefok to mpm_worker/mpm_event, and if you use php
also change it to use fcgi + php_fpm.
- change any program that spawns multiple process (e.g. apache with
mpm_prefork, php_fpm, etc) to use as little process as possible. For
example, php_fpm should run fine with just 1 process max, while for
apache you could probably limit it to 4 (or switch to worker/event).
It's a for-personal-use embedded device anyway, not like you're going
to have several hundred users accessing it at once.
- switch to a more memory-efficient server (e.g. lighttpd)
> But so long as the actual system load (usage) was light it worked out fineTrue.
But if it were me I'd rather limit the max amount of memory a program
is going to use in it's lifetime. And if there's higher load (e.g.
many users accessing the web server) I want them to wait in queue, or
outright rejected. I don't want it to suddenly grind to a halt due to
- Sorry I should have been more specific /swap.img is just a place holder value. You need to actually create it somewhere that is externally mounted. I do not know if you are using SlugOS, or Optware with a custom firmware, Debian. With Debian /swap.img will work, because it won't be an in-memory device. If you / is a just a memory mount then it won't work, because linux is smart enough not to let you use a ramdisk or such as swapspace.
--- In email@example.com, "adamant628" <adam.suhy@...> wrote:
> I did use the mkswap command, just as noted in the how-to. I just tried again and got the same error message.
> Can you also address my other concern about the swap putting wear on the USB flash? Is it an issue to use the swapfile on the plug?
> So how does it work if the swapfile is larger than the actual memory?
> --- In firstname.lastname@example.org, "Bill" <yahoo@> wrote:
> > You can make your swap file any size you want. (Within reason.) A small amount of non-swappable memory is used to map data in the swap file, so I would not recommend much more than 8 times the actual amount of memory you have on the device. Most people say 2 times the actual memory is a good size to use.
> > Did you remember to use the mkswap command before activating your swap?
> > Bill
> > --- In email@example.com, "adamant628" <adam.suhy@> wrote:
> > >
> > > I am pretty sure that I need to create some swap space, as one of the programs I am running is complaining on not having enough memory. I was following the instructions on http://www.nslu2-linux.org/wiki/HowTo/AddAdditionalSwapSpace to add a swap file. I am a linux newbie, but I have been learning. I successfully have programs running on my optware enabled pogoplug.
> > >
> > >
> > > Regarding the link above, the command: "dd if=/dev/zero of=/mnt/swapfile1 bs=1024 count=256k" is creating the swap file from the flash memory of the device? The how-to mentions that this will create a 256 MB swap file. I only have 125MB available on my device, so I assume that I shouldn't exceed that amount.
> > >
> > > I attempted to follow these instructions (made my swapfile 64MB), but when I used "swapon" I was given an error: "swapon failed: Invalid argument". This stumped me, so I don't know how to proceed at this point.
> > >
> > >
> > > My basic understanding of swap is that it is basically the same as virtual memory in windows. I have also read that it can burn out a USB flash drive fairly quickly due to the increased read/write cycles. Is it safe to do this on the pogoplug itself, or should I dedicate a portion of one of my externals for the task? I assume that if I use an external, I would skip the part about making the file, then direct mkswap to that partition's mount?
> > >
> > > Thanks for your help.
> > >
- --- In firstname.lastname@example.org, "Fajar A. Nugraha" <fajar@...> wrote:
>I agree. I used apache as a specific example, because it was one for awhile I had no choice to use. I had all the memory reducing options set at the time, but during startup apache would still use more memory than an NSLU2 has available. Once started though, apache would drop it's memory usage to more reasonable.
> On Fri, Mar 2, 2012 at 9:55 AM, Bill <yahoo@...> wrote:
> > Some programs such as apache took more memory than the NSLU2 had just to start-up.
> IMHO if you had programs like that, it's a sign of bad configuration.
Eventually, the bugs with lighttpd that prevented it from being usable for streaming videos were fixed and I switched to that. Although once running both lighttpd and apache use about the same amount of memory...