N
N
Nikita Kit2016-11-08 13:47:20
linux
Nikita Kit, 2016-11-08 13:47:20

How to save RAM resources when coding in Ubuntu?

Hello.
Need advice from experienced linuxoids. I have a computer with the following characteristics at work:
f0fbe82535e14cdca379c6c92463506c.png
When I sit down to layout, I start gulp (usually gulp watch + browserSync in the background), sublime 3, chrome, playOnLinux + Photoshop CS6.
After 3-4 hours of layout, some kind of fierce stuffing begins. chrome extensions start to fall first. All sorts of PageRuler, UA switcher, Gmail checker, chrome itself starts to lag furiously. The same trick starts to happen in Photoshop and so on until the response rate drops to zero. Creaking process at such a moment, I can only open the terminal and enter reboot. After 3-4 hours, everything repeats again.
I didn’t really try to open htop at the moments of lags - I’m afraid then the system unit will explode ... On the system monitor, the load suddenly flies up to 80-90%.
At first, the hard drive thought, but it is illogical for him to hang in such a strict schedule. And even more so if the winch hangs, then there is already a paragraph and a reboot on the button.
I have 8 gigs of RAM, although on screenfetch 4/8 - this is strange - maybe it's that I only have 4 available? The system is x64.
Mb someone knows some chips that will help to moderately distribute the load on the RAM?
Thanks everyone for your answers.
Result of conanda free -h:
6ebc88ce942c455ca983162e48e512a3.png

Answer the question

In order to leave comments, you need to log in

9 answer(s)
T
theurs, 2016-11-08
@ShadowOfCasper

screenfetch shows used/total memory
try installing zram-config package and reboot

M
Melkij, 2016-11-08
@melkij

swap available. So the described behavior is quite normal when free memory starts to run out and the OS goes into swap (which can be controlled by calling free when problems start). Extension drops look a little strange, but maybe they are fired by chrome for taking too long to respond.
To begin with, it is worth twisting the swappiness so that the OS gets into the swap only as a last resort.
Then play Zswap, zram. Which will hurt the performance of the CPU, but will help against the lack of memory.
Since there is not enough memory for everything - that is, options for action:
- desperately slow down in the swap
- call the OOM killer for help, which will kill some useless process at its discretion. To do this, just disable swap and the kernel itself will call if necessary.
- add memory
- reduce memory consumption. Keep track of who eats how much memory, maybe someone you don’t really need is just flowing from memory. You can run current processes in a cgroup with a hard memory limit, then they will shoot back when the limit is exceeded.

P
polifill, 2016-11-08
@polifill

At work?
This is a management problem. Put them before the fact to modernize the computer.
Because it is necessary for work.

E
Evangelist, 2016-11-09
@Evangelist

To develop under linux, you need a sufficient amount of RAM and a normal disk (aka SSD).
I, on the current gallery, was initially given a PC with 4GB of RAM, a 10-year-old HDD with 2 MB of cache, without a video card. I just refused to do it.
As a result, they provided 16 GB of RAM, an SSD disk, a video card - the flight was normal. Honestly, 16 is sometimes not enough for me. Photoshop works through win7 in virtualbox (7 GB allocate).
The home office has 32 gb RAM and everything else is much better. I support the polifill
position , face the fact that you were given a cramp, and not a computer for modern development (or do they want projects from 5 years ago of complexity from you, like the computer you were given?).
I also recommend switching from ubuntu to xubuntu (lightweight ubuntu). Thus, the OS can start up faster.
plus the already mentioned recommendations:
- swap is not needed;
- worth trying to work with avocode (I use both avocode and photoshop);

M
Maxim Kudryavtsev, 2016-11-08
@kumaxim

The root of your problems is SWAP - this is not a solution to the problem, it is such a crutch.
As soon as the system starts to climb there, hard brakes begin ...
From myself, I can recommend the following:
1) Gulp and everything related to it in a Docker container. Container limit on RAM.
2) In playOnLimux, can I set a limit on RAM? Yes, put it on.
3) In Chrome, see if there are extra extensions.
4) Turn off swap
As for extensions in Chrome.
There is an Extension Automation extension. Let's say your development environment only works when you open the host.my-dev domain. You also have 2 extensions that you only need when working with it. Set up Extension Automation like this: if I have the host.my-dev site open, then activate such and such extensions. By default, they are, of course, disabled in the settings of the chrome itself.
Similarly, if there are any extensions that you never use when working with Gulp and everything related to it.
Also, Chrome is very fond of eating memory if it stores too much history.
The solution is quick: "More tools => Clear browser data => Older than 1 week" The method is automatic: download the Limit History Lifetime
extension , which itself removes all data older than N days.

A
Alexander Alexandrovich, 2016-11-09
@tatu

1) Remove the swap partition

sudo nano /etc/sysctl.conf
And paste the following command at the end of the file:
vm.swappiness=1
Then save the file and reboot the system
The set value means to connect the swap partition only when the RAM is full
2) Try not to use photoshop, we switched to avocode

A
Alexander Kubintsev, 2016-11-17
@akubintsev

I would venture to suggest that the matter is in some 32-bit application, and it is not able to address the entire memory. I don’t know how under Linux, but under Windows, as far as I remember (it’s the application, not the OS), it can only get 2GB of RAM. If it is the same under Linux, then the application starts actively swapping when the limit is exceeded.

T
tagplus5, 2016-11-21
@tagplus5

Ubuntu 16.04; Chrome 54.0.2840.100; 8GB RAM; 8gb swap; 4gb zram swap swappiness=10
For some time there were no problems with memory consumption, during active work Chrome ate 5-8 GB, this is tolerable.
Suddenly, problems began in the form of clogging all memory, swapping and complete freezing.
I watched the state, noticed that all this happens when built-in notifications arrive (I have them enabled for gmail. google drive, trello). Disabled notifications, everything returned to its previous state. Zram won't help here.

D
Dima Sokolov, 2016-12-26
@dimka11

Made up under windows xp with 512 mb frames. You start firefox, it starts for 2 minutes, after which sublime gives an error. Switching between apps takes minutes!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question