From owner-freebsd-hackers Tue Sep 10 14:40:12 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 9C5A937B400 for ; Tue, 10 Sep 2002 14:40:07 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 12CAA43E42 for ; Tue, 10 Sep 2002 14:40:07 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.6/8.12.5) id g8ALe2tw052651; Tue, 10 Sep 2002 16:40:02 -0500 (CDT) (envelope-from dan) Date: Tue, 10 Sep 2002 16:40:02 -0500 From: Dan Nelson To: hackers@d.sparks.net Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Dell 2650 SMP perf question Message-ID: <20020910214001.GB84648@dan.emsphone.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.1i 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 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. 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. * 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. * 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. -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message