0

I've got the following output of the free -m command screenshot

So as far as I understand, 6501MB is available for using. The problem is that I have a cron job executing some SQL and I've noticed that if the job takes more memory then the "free" value in the first line (1154 mb), the sql server crashes. Why does that happen if it should be 6.5 GB available?

ps the first line free value was about 500 MB before, I've decreased the mysql innodb buffer pool size and it's became 1200. So apparently the job had taken more then 500 mb when the crash happened. Anyway that fact is that is seems that the job can only use the free mem from the first line, if it's insufficient, the job crashes.

Could you guys help me please?

1

Create one img file (equal or 1.5 of total physical mem) and foramt as swap file system and mount it. Then try to run the job once again.

  • Without swap, your system can't use RAM effectively. The OP is confusing physical memory (RAM) with backing store. You are crashing because you're running out of backing store even though you have plenty of usable physical memory. (You might have $10,000 in the bank but you still can't write a check for $50 because you've already written too many checks. RAM is like money in the bank. Swap is like a line of credit to cover your checks.) – David Schwartz Jan 11 '17 at 12:13
  • @DavidSchwartz thank you guys. I'll add a swap volume, but one thing is still confusing me despite the example with the bank. I have 6.5GB of usable physical memory, why it can't be used without a swap file? Is it reserved by some services for their use only, like when I decreased the mysql innodb buffer size, I've got more free ram, so I assume it was reserved by MySQL? – super.t Jan 11 '17 at 12:48
  • reading from HDD is required more mem than u expecting, since IO wait will be very high during this time. – Manoj K Jan 11 '17 at 12:52
  • @Sergey Programs often do things that may take up a large amount of RAM but don't. The OS has to reserve some combination of RAM+swap just in case or risk having to forcibly terminate processes. – David Schwartz Jan 11 '17 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.