I'm maintaining a network of 8 Pandaboards. One of them is acting as server to host a php-based browser game, others are clients running that game.
The server runs Debian Wheezy from SD card, which is pretty slow. To improve game performance on clients I moved mysql data dir and tmp dir to tmpfs and changed my.cnf accordingly. Data doesn't need to be synced back to SD because it isn't changed, only temporary game statistics are written to db.
Right now this is accomplished through additions to rc.local:
# mount tmpfs sudo mount -t tmpfs tmpfs /var/tmpfs # put a fresh copyy of mysql data there sudo rsync -a /var/lib/mysql/ /var/tmpfs/mysql/ # restart mysql service sudo service mysql restart
This solution is working but I suppose it's not the most elegant one, since mysql starts with modified my.cnf, won't find data in tmpfs yet and produces errors on first start. I worked around this by delaying the clients' initial game page request for 3 seconds.
How can I start mysql AFTER all data is synced to tmpfs? Add a script which does mount and rsync to all /etc/rc*.d where there's a Sxxmysql? Are rc*.d directories for services only?
Any help is appreciated.