Re: Linux v.s. Mac OS-X Performance

Greg Smith <gsmith@gregsmith.com>

From: Greg Smith <gsmith@gregsmith.com>
To: Wes <wespvp@msg.bt.com>
Cc: pgsql general <pgsql-general@postgresql.org>
Date: 2007-11-30T06:18:11Z
Lists: pgsql-general
On Thu, 29 Nov 2007, Wes wrote:

> Perhaps PostgreSQL isn't heavily threaded enough to make a difference

PostgreSQL doesn't use threads at all; it forks processes.  See 1.14 in 
http://www.postgresql.org/docs/faqs.FAQ_DEV.html

> The benchmark that got us looking at this was a MySQL benchmark showing 
> performance scaling by number of threads on various linux operating 
> systems.

Presumably you mean this one:  http://ozlabs.org/~anton/linux/sysbench/

The threading/malloc issues in MySQL are so awful that similar approaches 
have already been suggested for other operating systems.  Check out 
http://developers.sun.com/solaris/articles/mysql_perf_tune.html for 
comments about this under Solaris for example.

The fact that PostgreSQL scalability doesn't fall off like this suggests 
it doesn't have this particular issue.  Note that the curve in that 
sysbench run is awfully similar to the MySQL results at 
http://tweakers.net/reviews/649/7 (just shifted to the right because there 
are many more cores in that system).  Then look at their PostgreSQL 
results running the same test.  Forgive the error where they state 
"PostgreSQL might be called a textbook example of a good implementation of 
multithreading"; it's actually a good multi-process implementation. 
Interestingly, those results are from a Solaris system.

It's good to know about the Google perftools allocator, as there are 
plenty of client applications that could benefit as yours has from this 
technique (like the multi-threaded C++ apps it appears aimed at).  I just 
wouldn't expect it to be a big win for the PostgreSQL server itself.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD