From owner-freebsd-hackers Tue Sep 10 20:34:10 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8205337B400 for ; Tue, 10 Sep 2002 20:34:07 -0700 (PDT) Received: from search.sparks.net (d-207-5-180-136.gwi.net [207.5.180.136]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A62743E3B for ; Tue, 10 Sep 2002 20:34:07 -0700 (PDT) (envelope-from dmiller@sparks.net) Received: by search.sparks.net (Postfix, from userid 100) id 85AE6D984; Tue, 10 Sep 2002 23:30:08 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by search.sparks.net (Postfix) with ESMTP id 75F12D983; Tue, 10 Sep 2002 23:30:08 -0400 (EDT) Date: Tue, 10 Sep 2002 23:30:08 -0400 (EDT) From: hackers@d.sparks.net X-Sender: dmiller@search.sparks.net To: Dan Nelson Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Dell 2650 SMP perf question In-Reply-To: <20020910214001.GB84648@dan.emsphone.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 10 Sep 2002, Dan Nelson wrote: > In the last episode (Sep 10), hackers@d.sparks.net said: > > I'm stumped at how little improvement using an SMP kernel gives in a > > Dell 2650. System is dual 2400 xeon processors, 2 GB ram. It's > > intended to be used as a database processor, among other things. A > > perl process that read and input file and updates simple records in a > > mysql database actually run much more slowly: processing ~2million > > records takes 817 seconds with SMP enabled and 262 seconds with it > > disabled. > > > > Simple things like some_program.pl < some_big_file | another_program.pl > > > > seem to take full advantage of the second processor, but this system > > is supposed to run mysql. > > Mysql is a threaded database, and FreeBSD's pthreads are user-space. > This means that mysql will only ever use one CPU, and disk I/O in one > thread will block all other threads. I'd be happy to see perl running on one CPU and mysqld on the other. What I understand that mysql is thread based and that it will only run on one CPU at a time. What I don't understand is why it take 3.5 times as long to run the same job when I enable SMP. > You can try: > > * Rebuilding the mysql port with USE_LINUXTHREADS=yes. This will help > lots if your mysql process is CPU-bound, and will help some if you > are heavily I/O bound. It's definately CPU bound. I'm building mysql independently of the ports, but I can figure out what that does. > * Switching to InnoDB tables, which cache much better than MyISAM > tables so you are more likely to get your data from RAM instead of a > blocking disk read. That's not a problem - disk IO is on the order of tens per second, tops. > * Splitting your single perl program into multiple ones that hit the > database simultaneously. You might be seeing a synchronization > effect where your perl and mysql processes are competing for a SMP > lock or something and the wrong one always wins. Now that would be interesting. Running multiple tasks on a single CPU system always slowed things down, but it's worth a try:) Thanks for the suggestions! --- David To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message