X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EDEADD7115 for ; Thu, 3 Nov 2005 19:30:05 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26912-10 for ; Thu, 3 Nov 2005 23:30:03 +0000 (GMT) X-Greylist: delayed 01:43:21.814595 by SQLgrey- Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7004FD683B for ; Thu, 3 Nov 2005 19:30:04 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 8B43931058; Fri, 4 Nov 2005 00:30:05 +0100 (MET) From: "Qingqing Zhou" X-Newsgroups: pgsql.performance Subject: Re: insert performance for win32 Date: Thu, 3 Nov 2005 18:30:12 -0500 Organization: Hub.Org Networking Services Lines: 76 Message-ID: References: <6EE64EF3AB31D5448D0007DD34EEB3417DD79B@Herge.rcsinc.local> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Response To: pgsql-performance@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.566 required=5 tests=[AWL=0.566] X-Spam-Score: 0.566 X-Spam-Level: X-Archive-Number: 200511/63 X-Sequence-Number: 15320 "Qingqing Zhou" wrote > > Not to 100%, so this means the server is always starving. It is waiting on > something -- of couse not lock. That's why I think there is some problem > on network communication. Another suspect will be the write - I knwo NTFS > system will issue an internal log when extending a file. To remove the > second suspect, I will try to hack the source to do a "fake" write ... > To patch: ------------------------- Here is a quite straight hack to implement "fake" write for both relation and xlog. Now the server becomes pure CPU play. 1. RelationGetBufferForTuple()/hio.c: remove line (if you do not enable cassert, then doesn't matter): - Assert(PageIsNew((PageHeader) pageHeader)); 2. ReadBuffer()/bufmgr.c: remove line - smgrextend(reln->rd_smgr, blockNum, (char *) bufBlock, - reln->rd_istemp); 3. XLogWrite()/xlog.c errno = 0; + goto fake; if (write(openLogFile, from, nbytes) != nbytes) { /* if write didn't set errno, assume no disk space */ ... } + + fake: /* Update state for write */ To use it: ------------------------- 1. have several copies of a correct data; 2. patch the server; 3. when you startup postmaster, use the following parameters: postmaster -c"checkpoint_timeout=3600" -c"bgwriter_all_percent=0" -Ddata Note now the database server is one-shoot usable -- after you shutdown, it won't startup again. Just run begin; many inserts; end; To observe: ------------------------- (1) In this case, what's the remote server CPU usage -- 100%? I don't have several machines to test it. In my single machine, I run 35000 insert commands from psql by cut and paste into it and could observe that: --- 25% kernel time 75% user time 20% postgresql (--enable-debug --enable-cassert) 65% psql (as same above) 10% csrss (system process, manage graphics commands (not sure, just googled it), etc) 5% system (system process) --- (2) In this case, Linux still keeps almost 10 times faster? After this, we may need more observations like comparison of simple "select 1;" to reduce the code space we may want to explore ... Regards, Qingqing