I realize there's been stuff about ramdisk before but haven't really found one that matches me, so I'm trying :)
RHEL5.5, MySQL 5.0.77. Table data is free to go away and doesn't need to be kept across restart of MySQL or reboot of the system. I tried using Memory/Heap engine but kept getting jammed up by the table-locking. I tried using InnoDB (on normal disk) to use row-locking but the writes to the logs (even with innodb_flush_log_at_trx_commit = 0/2) kept slowing things down, even with binlog off (I guess it's transaction logs or whatever they're called that still gets written to disk.) The entire data fits easily into memory (given the correct buffer_sizes, etc of course). It's the disk-writes during update, delete, etc that seems to be hurting.
So I thought I'd put datadir = /dev/shm/mysql/ (that's the location of the ramdisk on RHEL5). But that means it expects the mysql database itself to be there, and of course it isn't so mysqld doesn't start. So I put datadir=/var/lib/mysql/ (default for RHEL's RPM mysql server) and the mysql database is there and I have permissions, etc again.
So I then set innodb_log_group_home=/dev/shm/mysql/. This put the three ib_logfile0/1/2 there, so I figure that's good. But it still keeps the ibdata1 in the datadir. But this setup seems to work. I reboot the system (thus losing ib_logfile*) but the ibdata1 file remains, and a random SELECT or two shows my data is still there. That's ok, but not a big deal either way.
So I then set innodb_data_home_dir=/dev/shm/mysql/. This put the ibdata1 file also on ramdisk. Unfortunately now, rebooting the system (and thus now losing both the ib_logfile* and ibdata) renders my database unusable. I can "use mydb", but a "desc tablename" says the table doesn't exist, but "create tablename" says the table exists.
I'm guessing this is because datadir/testdb/ still contains info about the table testtable? I then found I couldn't even mysqladmin drop testdb. I can however of course, rm -fr datadir/testdb/ and then it's fairly happy. Setting aside the problem with not being able to drop a database (I can rm -fr datadir/testdb/ and mysqladmin create testdb as part of the mysqld startup script), I then created an init-file which would create all the tables during the mysqld startup. This too doesn't work, and I can't find any particular errors about it. As the docs state, each command is on a single line, no comments (or blank lines or anything, just one line after another.)
So rather than fighting to put ibdata on ramdisk, I may opt to just keep it on physical disk. I was wondering if anyone knew what the performance of that would be. Also what difficulties I might run into, if the server crashes. I lose the iblogfiles which is ok, but if the crash puts the database in some unusable state and doesn't have a way to recover (because the logs aren't there), then using the rm -fr/mysqladmin create database) seems like an odd way to fix that. I can do that always, or only when I have a problem?
If I do the rm -fr/mysqladmin create method always, I may as well put ibdata on the ramdisk too.
I guess the question here is, how good/bad is having the ib_logfile on ramdisk but the ibdata1 on physical disk?
And is there a better/easier way to get row-locking, in-memory tables, high-writes-ok setup? I'm trying the "single node cluster" method using ndb. But that has its own problems I'm trying to resolve (see Cluster forum.) This one seemed great, but I'm running into init-file problems there, but that's a thread for the other forum.
Thank you,
PH
RHEL5.5, MySQL 5.0.77. Table data is free to go away and doesn't need to be kept across restart of MySQL or reboot of the system. I tried using Memory/Heap engine but kept getting jammed up by the table-locking. I tried using InnoDB (on normal disk) to use row-locking but the writes to the logs (even with innodb_flush_log_at_trx_commit = 0/2) kept slowing things down, even with binlog off (I guess it's transaction logs or whatever they're called that still gets written to disk.) The entire data fits easily into memory (given the correct buffer_sizes, etc of course). It's the disk-writes during update, delete, etc that seems to be hurting.
So I thought I'd put datadir = /dev/shm/mysql/ (that's the location of the ramdisk on RHEL5). But that means it expects the mysql database itself to be there, and of course it isn't so mysqld doesn't start. So I put datadir=/var/lib/mysql/ (default for RHEL's RPM mysql server) and the mysql database is there and I have permissions, etc again.
So I then set innodb_log_group_home=/dev/shm/mysql/. This put the three ib_logfile0/1/2 there, so I figure that's good. But it still keeps the ibdata1 in the datadir. But this setup seems to work. I reboot the system (thus losing ib_logfile*) but the ibdata1 file remains, and a random SELECT or two shows my data is still there. That's ok, but not a big deal either way.
So I then set innodb_data_home_dir=/dev/shm/mysql/. This put the ibdata1 file also on ramdisk. Unfortunately now, rebooting the system (and thus now losing both the ib_logfile* and ibdata) renders my database unusable. I can "use mydb", but a "desc tablename" says the table doesn't exist, but "create tablename" says the table exists.
mysql> desc testtable; ERROR 1146 (42S02): Table 'testdb.testtable' doesn't exist mysql> create table testtable ( a int); ERROR 1050 (42S01): Table 'testtable' already exists mysql> drop table testtable; ERROR 1051 (42S02): Unknown table 'testtable'
I'm guessing this is because datadir/testdb/ still contains info about the table testtable? I then found I couldn't even mysqladmin drop testdb. I can however of course, rm -fr datadir/testdb/ and then it's fairly happy. Setting aside the problem with not being able to drop a database (I can rm -fr datadir/testdb/ and mysqladmin create testdb as part of the mysqld startup script), I then created an init-file which would create all the tables during the mysqld startup. This too doesn't work, and I can't find any particular errors about it. As the docs state, each command is on a single line, no comments (or blank lines or anything, just one line after another.)
So rather than fighting to put ibdata on ramdisk, I may opt to just keep it on physical disk. I was wondering if anyone knew what the performance of that would be. Also what difficulties I might run into, if the server crashes. I lose the iblogfiles which is ok, but if the crash puts the database in some unusable state and doesn't have a way to recover (because the logs aren't there), then using the rm -fr/mysqladmin create database) seems like an odd way to fix that. I can do that always, or only when I have a problem?
If I do the rm -fr/mysqladmin create method always, I may as well put ibdata on the ramdisk too.
I guess the question here is, how good/bad is having the ib_logfile on ramdisk but the ibdata1 on physical disk?
And is there a better/easier way to get row-locking, in-memory tables, high-writes-ok setup? I'm trying the "single node cluster" method using ndb. But that has its own problems I'm trying to resolve (see Cluster forum.) This one seemed great, but I'm running into init-file problems there, but that's a thread for the other forum.
Thank you,
PH