2010-02-17

Speeding up database-bound tests with MySQL

In my day job we use MySQL a lot, and we also like to pretend that we have tests.

It's a good idea to run tests using the same database you're using in production, but MySQL ain't exactly a speed demon compared to memory-backed databases like Hypersonic, H2 or even Derby.

But wait - we can have our cake and eat it, too!

The trick is to tell MySQL to store its data files in memory; more specifically, the InnoDB files should be stored on a memory-backed filesystem like tmpfs.

So, create a directory somewhere (I use /var/lib/mysql/innodb) and mount tmpfs on it (mount -t tmpfs none /var/lib/mysql/innodb, or set it up in /etc/fstab).

After that, tell MySQL to store the InnoDB files there by sticking the following lines in /etc/mysql/my.cnf:

innodb_data_home_dir=/var/lib/mysql/innodb
innodb_log_group_home_dir=/var/lib/mysql/innodb

Now restart MySQL, and run your now-speedier tests!

32 comments:

Dan Dukeson said...

Nice idea, do you have any figures on the actual speedup that you achieved?

espenhw said...

It's not really scientific, but for one set of database-bound integration tests total runtime for the test set went from 48 to 31 seconds; that's a speedup of ~35%.

Adam Monsen said...

Great idea, thanks! The "tests" for the project I'm working on (Mifos) are also insanely database-intensive, and I was able to reduce test time by placing MySQL data on a tmpfs partition.

Kayal said...

This was a very good thing and it is also a very interesting blog. I like your great post, Thanks for giving the valuable post. Do well!!!

Oracle DBA Training in Chennai
Oracle DBA Course in Chennai
Excel Training in Chennai
Oracle Training in Chennai
Spark Training in Chennai
Tableau Training in Chennai
Embedded System Course Chennai
Unix Training in Chennai
Oracle DBA Training in OMR


Data Science Hyderabad said...

Awesome article with top quality information and found very interesting looking forward for next blog thank you.
Data Science Course in Hyderabad 360DigiTMG

EXCELR said...

Im really impressed by it.I am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing. Great efforts. data science training

Huongkv said...

Aivivu mua vé máy bay, tham khảo

vé máy bay đi Mỹ hạng thương gia

ve may bay tu my ve vietnam

vé giá rẻ đi đà nẵng

vé máy bay đi đà lạt bao nhiêu tiền

đặt vé máy bay phú quốc

Bm Faruk Zaman said...

Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.


เว็บแทงบอล
ufabet
ufa
พวงหรีด
โควิด
บาคาร่า

Bm Faruk Zaman said...

This article is increasing the interest to learn more about this topic. Continue sharing your new updates, regularly for my future.


คาสิโนออนไลน์
ufabet
ufa
เว็บบอล
relx

Alexander Debrah said...

Movie-watching websites that are more than movie-watching websites Because we are the number 1 free movie site in Thailand for a long time, including new movies, Thai movies, Western movies, Asian movies, we have all kinds of ways for you Including new series Full of all stories without interstitial ads to keep annoying anymore. One place sa-movie.com.

Android and IOS operating systems. Watch online movies, Thai movies, Western movies, Asian movies, Cartoon movies, Netflix Movie, Action Movies, Comedy Movies, Crime Movies, Drama Movies, Horror Movies, Adventure Movies, Crash Movies and still have many new movies to watch. You can watch for free anytime, anywhere 24 hours a day at see4k.com.


GangManga read manga, read manga, read manga online for free, fast loading, clear images in HD quality, all titles, anywhere, anytime, on mobile, tablet, computer. Android and IOS operating systems. Read top comics, action dramas, comedy, adventure, horror and manga. New coming every day to watch many more. Can be read for free anytime anywhere 24 hours a day at gangmanga.com..

It is no secret that football is among the most popular and widely watched sports. Everybody who likes football tries to find the best platform for free soccer streaming. So, what are the best free sports streaming sites? We are going to answer this question. On this page, you can find a detailed overview of the most widespread soccer streaming websites. Keep on reading and make the best choice for you live24th.me.

Priya Rathod said...

The content is well acknowledged, so no one could allege that it is just one person's opinion yet it covers and justifies all the applicable points. I have read such a startling work after a long time!
Data Science Training in Hyderabad
Data Science Course in Hyderabad

360DigiTMG said...

great article!! sharing these type of articles is the nice one and i hope you will share an article on data science.By giving a institute like 360DigiTMG.it is one the best institute for doing certified courses
data science malaysia

360DigiTMGAurangabad said...

Amazing blog.Thanks for sharing such excellent information with us. keep sharing...
machine learning course in aurangabad

Marty Sockolov said...

Probably the most genuine football betting UFABET that's beyond description Find fun, excitement and excitement with slot video games, hundred totally free recognition, quick withdrawal. If you desire to have fun slots for money No need to deposit a great deal, no minimum, no need to share, squander moment for the reason that UFABET is in fact reduced, given seriously, many great offers are waiting for you. Prepared to ensure pleasurable, regardless of whether it's Joker SlotXo fruit slot, we are able to phone it an internet slot website for you personally especially. Ready to have fun Like the support staff which is going to facilitate slot formulas as well as techniques of actively playing So you will be certain that each minute of fun and pleasure We will be there for one to give your customers the best appearance as well as fulfillment.
บาคาร่า
สล็อต
ufa
แทงบอล

lionelmessi said...

Hi, Thanks for sharing huge content...

Python Training in Hyderabad

Priya Rathod said...

Great post! I am actually getting ready to across this information, It’s very helpful for this blog. Also great with all of the valuable information you have Keep up the good work you are doing well.
DevOps Training in Hyderabad
DevOps Course in Hyderabad

Priya Rathod said...

This blog was really great, never seen a great blog like this before. I think I’m going to share this to my friends.
Data Science Training in Hyderabad
Data Science Course in Hyderabad

training institute said...

I am impressed by the information that you have on this blog. It shows how well you understand this subject.
data science course


Nikita jawanjal said...


Informative blog
Data science course in pune

traininginstitute said...

Very awesome!!! When I seek for this I found this website at the top of all blogs in search engine.
data science training

traininginstitute said...

Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post .
data scientist course in malaysia

Rebecca Grundy said...

I can't believe I've never been to this site before, but after going through some of the posts I realized it's new to me. Anyhow, I'm glad I found it and I'll be bookmarking and checking back often. You can fill your visa application form online within 5 to 10 minutes and pay your India visa cost once you complete the form. India evisa cost depends on your nationality and your visa type. cost of Indian visas are always submitted after form submission.

Allen smith said...


Thanks for your great article which is both informative and innovative: with the latest updates. It was highly invaluable. Travelers have the question: can US citizen travel to India? The answer is yes. You can apply directly for e-visas online. Therefore, the Indian government has developed an easy-to-use online Indian visa application form that makes it easy to apply for a visa.

Anonymous said...

Borgata Hotel Casino & Spa - JTR Hub
Located in Atlantic City, 토토 사이트 모음 Borgata Hotel Casino & Spa offers 출장마사지 the finest in amenities and entertainment. It also https://vannienailor4166blog.blogspot.com/ provides a seasonal 토토 사이트 outdoor swimming www.jtmhub.com

Roman said...


Hello all , Many people ask, What is the Indian visa photo size? You can get more info about India visa photo size via our Indian e page.

Nikkitr Godman said...

Hello everyone! Amazing post! Many people ask, ``How to apply for a e visa Turkey?Eligible travelers only need a good internet connection and a computer, laptop or tablet to complete and submit a visa application.

PSW550 said...

เล่นเกมต่างๆได้อย่างรวดเร็วทันใด สมัครPG ทำกำไรได้อย่างมากมายผ่านเว็บไซต์ PGSLOTGAMES เล่นได้อย่างมากมาย ทั้งสล็อตออนไลน์ คาสิโนออนไลน์ อาเขต และยิงปลา ทำกำไรได้ตลอด 24 ชั่วโมง

slot said...

เล่นได้ ไม่ผิดหวัง บริการทุกๆท่านให้ได้เล่นมากมายกว่า 300 เกม กับเว็บไซต์ PGSLOTGAMES เล่นต่างๆได้ตลอด 24 ชั่วโมง มอบประสบการณ์การเล่นสุดแปลกใหม่ PG SLOT AUTO รวมไปถึงกิจกรรมต่างๆ ให้คุณได้สนุกสนานไปกับการปั่นสล็อต พร้อมรับเครดิตให้คุณได้ทำการเล่นมากถึง 70 เปอร์เซนต์

Hallebose said...

Helpful time saver

JAke Leonel said...

I am also a specialist in this topic so I can understand your effort.Keep it up. Keep blogging. Looking to reading your next post.Very interesting to read this article.Actually Magnificent.
electric masturbator cup
water based lubricant.

henryisabella said...

Here is the travel to Turkey requirements list. Traveling to Turkey requires certain essential requirements to ensure a smooth and hassle-free experience. Travelers need a valid passport, which should be valid for at least six months beyond the intended departure date. The e-Visa can be easily obtained online by completing the application form and making the necessary payment.

henryisabella said...

The Kenya visit visa for Indian nationals can be obtained through the eVisa system. To apply, you can visit our website dedicated to visa applications. Once you have completed the application and paid the visa fee securely online.