What Assumptions Make: Filesystem I/O from a database perspective

94
What Assumptions Make: Performance Testing with P4 Portland PostgreSQL Performance Pad Selena Deckelmann [email protected] End Point Corporation twitter: @selenamarie

description

The Linux operating system provides a number of file systems that can be used, as well as volume management and hardware or software RAID. We are running performance benchmarks for database tuning, and are curious if the file systems really behave like we expect them to, especially when used in conjunction with RAID or volume management. Are these file systems being used in manners for which they were designed? There is also more to file systems than how fast we can read to them or how fast we can write to them. How reliable is the file system, and how do be prove it? We have collected data and will have a server available for development during the conference.

Transcript of What Assumptions Make: Filesystem I/O from a database perspective

Page 1: What Assumptions Make: Filesystem I/O from a database perspective

What Assumptions Make:Performance Testing with P4

Portland PostgreSQL Performance Pad

Selena [email protected] Point Corporationtwitter: @selenamarie

Page 2: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Page 3: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Page 4: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Page 5: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Do filesystems do what we expect?

5

Page 6: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

We are volunteers.

6

Page 7: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

We think you should run these tests.

7

Page 8: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

We are:DBAs

SysadminsPerformance tuners

8

Page 9: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

How will this hardware perform?

9

Page 10: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

How will this filesystem perform?

10

Page 11: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Why should you care about filesystem-specific

performance?

11

Page 12: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Expectations

12

Page 13: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

PERSONAL CONFESSION

13

Page 14: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Where to start?

14

Page 15: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

The Defaults.

15

Page 17: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

17

Not addressing reliability

Page 18: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

18

Very Narrow Use Case:A Relational Database

Page 19: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

19

Need for periodic testing.(And we've got some

hardware!)

Page 20: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

20

★Kernel differences★FS patch-level differences★Mount options★mkfs options

Page 21: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

21

Focused on THROUGHPUT

(Because that’s what people who buy large systems look for)

Page 22: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

22

Later:Response Time

Operations per second

Page 23: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

No, we will not be testing ZFS.

23

Page 24: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

BtrFS (nope, not yet)

24

FS

Page 25: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

What do we expect?

25

Page 26: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Some conventional wisdom:

26

Page 27: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“RAID5 is the worst choice

for a database.”

27

Page 28: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“LVM incurstoo much overhead

to use.”

28

Page 29: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“Striping doubles performance.”

29

Page 30: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“Turning off 'atime'is a big

performance gain.”

30

Page 31: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

31

“Getting rid of atime updates would give us more everyday Linux performance than all the pagecache speedups of the last 10 years, _combined_.”

Page 32: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“Journaling filesystems (ext3) will have worse performance than non-journaling filesystems

(ext2).”

32

Page 33: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“Your read-ahead buffer

is big enough.”

33

Page 34: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Now... on to the good stuff.

34

Page 35: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

35

Page 36: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

PostgreSQL’s Portland Performance Pad

36

Hosted by CommandPrompt, Inc.

Page 37: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Our machine:

HP ProLiant DL380G5Smart Array p800

72GB 15,000 RPM SAS (up to 25 disks)32GB RAM

Linux: 2.6.25-gentoo-r6*New tests being run with 2.6.28

37

Page 38: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Our machine:Chosen because

of it’s low, low price.

Thank you, HP.

38

Page 39: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Our tests:fio64 GB working set8 threadsno fadviseno direct i/o8KB blocksizeI/O elevator: deadline

39

Page 40: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Our stats:sarmpstatiostatvmstatreadprofile

40

Page 41: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Our tests:Chosen because of their relevance to PostgreSQL

41

Page 42: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Filesystems Tested:

ext2ext3jfsxfsreiserfsext4 (but having trouble)

42

Page 43: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Disk configs tested:

Single diskRAID-0RAID-1RAID-5RAID-10RAID-6

43

Page 44: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

The Data:http://moourl.com/fsperf

44

Page 45: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Confessions:• May be high standard deviation with results (don’t know yet!)

•No filesystem tuning, all default create and mount options

•No software raid comparison or lvm (volume management test) for 2.6.28 tests

45

Page 46: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Confessions:• Some xfs runs had to be repeated and some ext4 runs did not complete successfully

• Only presenting throughput

• Interested in system performance for a specific application, not code performance

46

Page 47: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Confessions:•I/O profiles don’t exhibit atime or partition alignment issues

•Disk controller firmware not at the latest version in 2.6.25 tests

•Software RAID is on top of 1 disk RAID 0 devices (HP SmartArray doesn’t have JBOD option)

47

Page 48: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

AUDIENCE PARTICIPATIONHigher throughput:

ext2 or ext3?

48

Page 49: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

49

Page 50: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

50

Page 51: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

51

Page 52: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

52

Page 53: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Seek bundling/batching in ext3 is better?

53

Page 54: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

What if we add a disk?

54

Page 55: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

55

Page 56: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

56

Page 57: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

57

Page 58: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

58

Page 59: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

59

Page 60: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

AUDIENCE PARTICIPATIONRAID 0 (stripe) versus

RAID 1 (mirroring)performance?

60

Page 61: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

61

Page 62: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

62

Page 63: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

63

Page 64: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

What happens when we: add disks to a

RAID 0 (stripe) LUN?

64

Page 65: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

65

Page 66: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

66

Page 67: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

67

Page 68: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

68

Page 69: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Adding disks to a RAID 5 LUN

69

Page 70: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

70

Page 71: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

71

Page 72: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

72

Page 73: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Only have 4 disks?What should you do?

73

Page 74: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

74

Page 75: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

75

Page 76: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

76

Page 77: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

77

Page 78: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

In most cases, RAID 5 out performs on sequential writes (xlog).

Random writes is only an improvement on xfs and reiserfs.

78

Page 79: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Are software RAID and LVM are slow?

79

Page 80: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

80

Page 81: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

81

Page 82: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

The Read-ahead buffer

82

Page 83: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

AUDIENCE PARTICIPATIONReadahead buffer:

Default is 128 KWhat do you think it should be?

83

Page 84: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

84

Page 85: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

And is there a cost to increasing the buffer

that much?

85

Page 86: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

86

Page 87: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

http://moourl.com/readaheadconfirm

87

Page 88: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Future Work•OLTP system characterization, sizing

•Daily OLTP regression testing•More presentations•P5 - PostgreSQL Portland Performance Pad PRACTICE

88

Page 89: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

MOAR Hardware?

Thanks again, HP!MSA70, DL380 in 2009 ??

89

Page 90: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

Let’s recap...

90

Page 91: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“RAID5 is the worst choice for a database.” Fast for sequential writes in our tests.

“LVM incurs too much overhead to use. Software RAID is slower.” For reads – throughput is about the same, but saw higher CPU.

“Turning off 'atime' is a big performance gain.” Not in our tests. But, 2-3% for “free”.

91

Page 92: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“Journaling filesystems will have worse performance than non-journaling filesystems.” Turn the data journaling off on ext3, and you do see better performance, but there are edge cases and performance differences we could not explain.

“Striping doubles performance.” Performance is better, but no where near double. Why?

92

Page 93: What Assumptions Make: Filesystem I/O from a database perspective

www.endpoint.com

SCALE 7x Feb 21-22, 2009

“Your read-ahead buffer is big enough.” Your read-ahead buffer IS NOT big enough. Make it 8MB. And can we make that the default?

93