1

I have an embedded Geode-based application server with 512MB RAM and I'm about to try to maximize free memory during applications workload, which uses MySQL database 5.5 with InnoDB quite aggressively.

As part of the whole optimization I'd want to introduce

echo 1 > /proc/sys/vm/drop_caches
sleep 5
echo 0 > /proc/sys/vm/drop_caches

in crontab.

How often is it safe to execute something like this?

Any other observation/suggestion is welcome.

BerserkEVA
  • 153
  • 1
  • 1
  • 5
  • I'd suspect you need more RAM. Running drop_caches at such a frequent interval seems like a bad workaround for lack of resources. – ewwhite Nov 07 '13 at 09:19
  • 1
    This doesn't make any sense as cache memory is still considered "free". Therefore you do not gain any additional free memory doing this. – etagenklo Nov 07 '13 at 09:28

1 Answers1

2

There's a really good article here on caching in Linux;

http://www.linuxatemyram.com/play.html

In short, if you keep clearing your caches, disk reads will take considerably longer to perform and if you read to the bottom of the article;

A fully used store of ram on Linux is efficient hardware use, not a warning sign.

You might find some better optimisation of your MySQL configuration will greatly help performance over continuously removing the caches in RAM.

I've had some success using MySQLTuner.pl -> https://github.com/major/MySQLTuner-perl

sgtbeano
  • 340
  • 5
  • 14
  • thanks for your reply; anyways my concern about free memory is due to the fact that our applications often fail while writing to MEMORY (HEAP) tables. Unfortunately I cannot intervene on RAM amount. – BerserkEVA Nov 07 '13 at 09:45
  • Have you considered using a SWAP if you're not already to alleviate pressure on RAM, you could also investigate memory compression? Although this would give you a CPU performance hit. – sgtbeano Nov 07 '13 at 09:47
  • Yeah, swap is not an option, as my storage is a flash disk. I'll investigate memory compression, though, as you suggest. – BerserkEVA Nov 07 '13 at 09:49
  • Sounds like you're in a tight spot, I'll do some research and see if I can offer alternatives. – sgtbeano Nov 07 '13 at 09:57