How to save RAM when coding in Ubuntu?

Hi all.
Need advice of experienced Linux users. On my work computer with that kind of characteristics:
f0fbe82535e14cdca379c6c92463506c.png
When I sit down to layout, make gulp (the background is usually gulp watch + browserSync), sublime 3, chrome, playOnLinux + Photoshop CS6.
After 3-4 hours of layout starts some sort of fierce stuffing. first, begin to drop the extensions of chrome. All sorts of PageRuler, UA switcher, Gmail checker chrome itself begins to violently lag. The same thing starts to happen in Photoshop and so as long as the response rate falls to zero. Gritting his percent at this moment is that I am able to open the terminal and enter reboot. After 3-4 hours everything is repeated in the new.
I'm not really in the moments of lag tried to open htop I'm afraid if the system unit will explode... On the system monitor at the same time sharply flies up load up to 80-90%.
At first I thought the hard disk, but it is illogical for him to hang in such a strictly chart. And especially if it hangs the winch, then there is a paragraph and reboot button.
Of RAM I have 8 gigs, although screenfetch 4/8 - it's weird - it may be that I have available only 4? System after x64.
MB someone knows some pieces that will help more moderately to distribute the load on the RAM?
Thank you all for your answers.

The result is teams free-h:
6ebc88ce942c455ca983162e48e512a3.png
July 2nd 19 at 18:26
9 answers
July 2nd 19 at 18:28
Solution
screenfetch shows occupied/total memory
try to install the package zram-config and reload
I read about it. Cool feature. I'll try it. Thank you) - Arely.Casper commented on July 2nd 19 at 18:31
It's just cool as hell! Started all over again, in htop when the usual average number of tasks the consumption of operatives has fallen by half! And I did the configs wasn't picking! Although the cent and began to podkopat stronger, but not trolls. In short - this solution, no options. - Arely.Casper commented on July 2nd 19 at 18:34
July 2nd 19 at 18:30
swap available. So the described behavior is quite the norm when it begins to approach the end of the free memory and the OS climbs in swap (that can be controlled by a call to free at the beginning of the problems). A little strange look drop extensions, but maybe shoot them chrome for too long response.
To get started is to twist swappiness to OS climbed to swap only in extreme cases.
Then play Zswap, zram. That will cut the CPU performance, but it will help from running out of memory.

Once all memory is not enough, then there are options:
desperately slow in the swap
- to call for help OOM killer that will kill any in its sole discretion useless process. It's enough to knock out the swap and the kernel itself will call if necessary.
- add memory
- reduce the memory consumption. Keep track of who eats how much memory, maybe you have somebody not really needed just going from memory. You can run the current processes in the cgroup hard memory limit, then they budutt to shoot if the limit is exceeded.
The OOM killer by the way better to run on the Alt+SysReq+F, and then disable swap that he runs this PPC for a long time. He and so-nifiga not works fast - Arely.Casper commented on July 2nd 19 at 18:33
July 2nd 19 at 18:32
At work?
This is a problem of management. Put them before the fact to upgraded computer.

For this you need to work.
this is of course great, but even 8 gigs operatives I don't need. I understand that I do not need and that the system can be optimized. Besides I so a video card for the 2nd monitor a week shall. - Arely.Casper commented on July 2nd 19 at 18:35
the cost of 8 gigs is peanuts compared to poteryami time programmer. you just need it right to sell to management. moreover, it is one-time spending. - Arely.Casper commented on July 2nd 19 at 18:38
: again, you can ask and SSD to the heap, then the speed will increase - Kendall_Wiso commented on July 2nd 19 at 18:41
:
> that the system can be optimized

This home study.
I need to work on.

Ask for upgrade.
No. Not so.
Put before the fact that need an upgrade - Arely.Casper commented on July 2nd 19 at 18:44
July 2nd 19 at 18:34
To develop under linux, you need sufficient amount of RAM and the normal drive (aka SSD).
Me, on the current galley, was originally given a PC with 4GB of RAM, a HDD of 10 years ago with 2 MB cache, without a video card. I just refused to work.
In the end, provided 16 GB of RAM, SSD, graphics card, - normal flight. Honestly, 16 is not enough for me sometimes. Photoshop works using win7 in virtualbox (allocate 7 GB).

In the home office 32 gb RAM and at times better than everything else.

Support the position put before the fact, what gave you cramps, not PC for modern development (or you want a draft 5-year-old of difficulty, like a computer that you gave?).

I also recommend ubuntu to switch to xubuntu (lightweight Ubuntu). Thus, the OS can make money faster.

plus the already mentioned recommendations:
- swap is not needed;
- you should try to work with avocode (I use photoshop and avocode);
xubuntu on laptop Nai*I broke 2 Winchester 3 days, almost immediately after installation. and sablaym anything I would never trade - Arely.Casper commented on July 2nd 19 at 18:37
By the way, avocode, it psd? friends? Paid? On the line there? - Arely.Casper commented on July 2nd 19 at 18:40
Support! swap is not necessary, you should look for a lightweight DE, I use awesome on a normal Windows will not return - Kendall_Wiso commented on July 2nd 19 at 18:43
After I began to use Avocode for the layout, photoshop threw away. ) - Arely.Casper commented on July 2nd 19 at 18:46
July 2nd 19 at 18:36
The root of Your problem is SWAP is not the solution, it's such a crutch.
As soon as the system starts to climb, so start hard brakes...

From myself I can recommend the following:
1)Gulp and everything connected with it in a Docker container. The container limit on RAM.
2)In playOnLimux can limit RAM hocks? Yes, put.
3)In Chrome, see is there any extra extension.
4)Turn off swap

About extensions in Chrome.
Is extension Extension Automation. For example, Your development environment only works when You open a domain host.my-dev. Also You have 2 extensions that You want only when you work with him. Extension Automation set up so that if I open the website host.my-dev, then to activate these extensions. By default, they are, of course, disabled in the settings of chrome.
Similarly, if there are any extensions that You never use when working with Gulp and all that it involves.

Also Chrome loves to eat memory if it stores too much history.
Method of solution fast: the "More tools => Clear browser data => Older than 1 week"
Automatic method: download the extension Limit Lifetime History, which itself destroys all data older than N days.
July 2nd 19 at 18:38
1) Remove swap partition
sudo nano /etc/sysctl.conf
And insert the end of the file the following command:
vm.swappiness=1
Then save the file and reboot the system

The set value means to mount swap partition, only at full employment of RAM
2) Try not to use photoshop, we moved to avocode
July 2nd 19 at 18:40
I would venture to suggest that it in any 32-bit application and it cannot be addressed to the entire memory. Don't know how under Linux, but under Windows as far as I remember (it's the application, not the OS), is able to only 2GB of RAM. If under Linux, then the application begins to actively swapit if the limit is exceeded.
Yes, that's right. playOnLinux uses x32 dev Windows. Therefore, from the FSH I had to give. Now use avocode. It is steeper, however on linux it is portable and I XS how to put it globally... - Arely.Casper commented on July 2nd 19 at 18:43
July 2nd 19 at 18:42
Ubuntu 16.04; Chrome 54.0.2840.100; 8gb RAM; 8gb swap; 4gb zram swap; swappiness=10
Some time had no problems with the memory consumption, when working Chrome ate 5-8 GB, it's tolerable.
Suddenly the problems started in the form of plugging all the memory, swap and complete unresponsiveness.
Watch, noticed that it all priiskhodit when coming built-in notifications (I have enabled for gmail. google drive, trello). Disabled uvedomlenie, everything returned to its previous state. Zram will not help here.
July 2nd 19 at 18:44
Typeset under windows xp with 512 MB RAM. Launch firefox, it starts 2 minutes after that sublime generates an error. Switching between applications takes minutes!

Find more questions by tags Operating systemsLinuxMemoryUbuntu