Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wd1lf-0007F6-B9 for pgsql-performance@arkaria.postgresql.org; Wed, 23 Apr 2014 18:19:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wd1le-0004V8-QC for pgsql-performance@arkaria.postgresql.org; Wed, 23 Apr 2014 18:19:34 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wd1ld-0004T7-8S for pgsql-performance@postgresql.org; Wed, 23 Apr 2014 18:19:33 +0000 Received: from mail-bl2lp0209.outbound.protection.outlook.com ([207.46.163.209] helo=na01-bl2-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wd1lY-00008N-CJ for pgsql-performance@postgresql.org; Wed, 23 Apr 2014 18:19:32 +0000 Received: from BN1PR05MB009.namprd05.prod.outlook.com (10.255.202.141) by BN1PR05MB012.namprd05.prod.outlook.com (10.255.202.151) with Microsoft SMTP Server (TLS) id 15.0.921.12; Wed, 23 Apr 2014 18:19:19 +0000 Received: from BN1PR05MB009.namprd05.prod.outlook.com ([169.254.15.211]) by BN1PR05MB009.namprd05.prod.outlook.com ([169.254.15.211]) with mapi id 15.00.0921.000; Wed, 23 Apr 2014 18:19:19 +0000 From: Mel Llaguno To: Josh Berkus , "pgsql-performance@postgresql.org" Subject: Re: HFS+ pg_test_fsync performance Thread-Topic: [PERFORM] HFS+ pg_test_fsync performance Thread-Index: AQHPWDFwlR15YRY8f0KSgkk6+/NESpsfjViX//+ewgA= Date: Wed, 23 Apr 2014 18:19:19 +0000 Message-ID: References: <535800CB.7060609@agliodbs.com> In-Reply-To: <535800CB.7060609@agliodbs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.3.9.131030 x-originating-ip: [184.70.198.10] x-forefront-prvs: 01901B3451 x-forefront-antispam-report: SFV:NSPM; SFS:(10009001)(6009001)(428001)(479174003)(189002)(199002)(51704005)(24454002)(51914003)(377454003)(80976001)(99396002)(83322001)(76482001)(54356999)(46102001)(86362001)(50986999)(76176999)(4396001)(99286001)(85852003)(19580405001)(19580395003)(80022001)(83072002)(2656002)(66066001)(92566001)(92726001)(16601075003)(87936001)(74662001)(74502001)(36756003)(81542001)(20776003)(77982001)(31966008)(79102001)(81342001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR05MB012; H:BN1PR05MB009.namprd05.prod.outlook.com; FPR:EE3EF115.A7E257D9.B1CD2A4F.D2E6D7B2.20569; MLV:sfv; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (: coverity.com does not designate permitted sender hosts) Content-Type: text/plain; charset="iso-8859-1" Content-ID: <5B6538DF74FA44409C5A5E51E906F1CB@namprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: coverity.com X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Josh, Thanks for the feedback. Given the prevalence of SSDs/VMs, it would be useful to start collecting stats/tuning for different operating systems for things like fsync (and possibly bonnie++/dd). If the community is interested, I=B9ve got a performance lab that I=B9d be willing to help run tests on. Having this information would only improve our ability to support our customers. M. On 4/23/14, 12:04 PM, "Josh Berkus" wrote: >Mel, > >> I was given anecdotal information regarding HFS+ performance under OSX >>as >> being unsuitable for production PG deployments and that pg_test_fsync >> could be used to measure the relative speed versus other operating >>systems > >You're welcome to identify your source of anecdotal evidence: me. And >it's based on experience and testing, although I'm not allowed to share >the raw results. Let's just say that I was part of two different >projects where we moved from using OSX on Apple hardware do using Linux >on the *same* hardware ... because of intolerable performance on OSX. >Switching to Linux more than doubled our real write throughput. > >> Compare file sync methods using one 8kB write: >> (in wal_sync_method preference order, except fdatasync >> is Linux's default) >> open_datasync 8752.240 ops/sec 114 >>usecs/op >> fdatasync 8556.469 ops/sec 117 >>usecs/op >> fsync 8831.080 ops/sec 113 >>usecs/op >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=3D=3D >> fsync_writethrough 735.362 ops/sec 1360 >>usecs/op >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=3D=3D >> open_sync 8967.000 ops/sec 112 >>usecs/op > >fsync_writethrough is the *only* relevant stat above. For all of the >other fsync operations, OSX is "faking it"; returning to the calling >code without ever flushing to disk. This would result in data >corruption in the event of an unexpected system shutdown. > >Both OSX and Windows do this, which is why we *have* fsync_writethrough. > Mind you, I'm a little shocked that performance is still so bad on >SSDs; I'd attributed HFS's slow fsync mostly to waiting for a full disk >rotation, but apparently the primary cause is something else. > >You'll notice that the speed of fsync_writethrough is 1/4 that of >comparable speed on Linux. You can get similar performance on Linux by >putting your WAL on a ramdisk, but I don't recommend that for production. > >But: things get worse. In addition to the very slow speed on real >fsyncs, HFS+ has very primitive IO scheduling for multiprocessor >workloads; the filesystem was designed for single-core machines (in >1995!) and has no ability to interleave writes from multiple concurrent >processes. This results in "stuttering" as the IO system tries to >service first one write request, then another, and ends up stalling >both. If you do, for example, a serious ETL workload with parallelism >on OSX, you'll see that IO throughput describes a sawtooth from full >speed to zero, being near-zero about half the time. > >So not only are fsyncs slower, real throughput for sustained writes on >HFS+ are 50% or less of the hardware maximum in any real multi-user >workload. > >In order to test this, you'd need a workload which required loading and >sorting several tables larger than RAM, at least two in parallel. > >In the words of the lead HFS+ developer, Don Brady: "Since we believed >it was only a stop gap solution, we just went from 16 to 32 bits. Had we >known that it would still be in use 15 years later with multi-terabyte >drives, we probably would have done more design changes!" > >HFS+ was written in about 6 months, and is largely unimproved since its >release in 1995. Ext2 doesn't perform too well, either; the difference >is that Linux users have alternative filesystems available. > >--=20 >Josh Berkus >PostgreSQL Experts Inc. >http://pgexperts.com > > >--=20 >Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) >To make changes to your subscription: >http://www.postgresql.org/mailpref/pgsql-performance --=20 Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance