Difference between #1 and #2 of
Speedup unit tests by moving MySql data to memory (in Ubuntu)

Revision #2 has been created by François Gannaz on Dec 20, 2012, 3:24:37 PM with the memo:

Warning about the dangers
« previous (#1)

Changes

Title unchanged

Speedup unit tests by moving MySql data to memory (in Ubuntu)

Category unchanged

Tips

Yii version unchanged

Tags unchanged

mysql, unit test

Content changed

[...]
* Refactor code and tests and do not touch db in tests
* Use sqlite db in memory instead of MySql
* Use MySql MEMORY engine
* Move MySql data to memory

> Each method has drawbacks:
 

 
> * Not using DB in unit tests means that parts of the code won't be tested.
 
> * Using SQLite only for tests may induce different behavior. This is against the very meaning of unit tests.
 
> * Like SQLite, the MySQL Memory engine is different from InnoDB and MyISAM. For example, FK are ignored.
 
 
> The following process moves **every MySQL database** into a memory filesystem.
 
> If you have databases other than the test DB, the copy/restore process may be slow,
 
> and **you can loose data** if something goes wrong.
 
> You've been warned, do not use this when you have important data in any database of your MySQL server.
 
 
It is better to try other listed approaches and I think of last method as of quick temporary hack, but here it is:

* stop mysql
* move /var/lib/mysql to /dev/shm/mysql
* link /var/lib/mysql to /dev/shm/mysql
* start mysql
[...]
1 1
3 followers
Viewed: 23 175 times
Version: 1.1
Category: Tips
Written by: seb
Last updated by: François Gannaz
Created on: Dec 17, 2012
Last updated: 11 years ago
Update Article

Revisions

View all history