<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 10/24/2011 03:32 PM, Lukas Zapletal wrote:
<blockquote cite="mid:4EA568DC.1070103@redhat.com" type="cite">Hey,
<br>
<br>
since we started using PostgreSQL for our unit tests I did some
quick-googling today and found this postgresql.conf setting:
<br>
<br>
# tail /var/lib/pgsql/data/postgresql.conf
<br>
fsync=off
<br>
synchronous_commit=off
<br>
full_page_writes=off
<br>
bgwriter_lru_maxpages=0
<br>
<br>
Those four lines will set your database instance to highly
asynchronous mode, that means everything is much faster (no
synchronized hdd writes - my hdd LED literally does not blink
during whole test). While this improves database performance a
lot, it can cause loss of data in case of power outage. Please DO
NOT use this for production systems :-)
<br>
<br>
I did not do any measurements but unit test run is notable faster.
Feel free to share your numbers.
<br>
<br>
</blockquote>
Cool.<br>
This is output from my testing:<br>
<br>
<b>Without this settings:</b><br>
1075 examples, 0 failures, 20 pending<br>
<br>
real 4m35.818s<br>
user 3m29.188s<br>
sys 0m7.560s<br>
<br>
one spec file:<br>
real 0m18.987s<br>
user 0m10.995s<br>
sys 0m1.894s<br>
<br>
<b><big><br>
</big>With this settings:</b><br>
real 4m39.068s<br>
user 3m34.858s<br>
sys 0m7.772s<br>
<br>
one spec file:<br>
real 0m14.200s<br>
user 0m10.897s<br>
sys 0m1.893s<br>
<br>
<br>
It's faster when running few tests (e.g. a single spec file) -
faster preparation of the database. There is no difference for the
whole test suite. However, this measurement doesn't include the
saving of the disk.<br>
<br>
-- Ivan<br>
</body>
</html>