tuning couchbase server, the os, and the network for maximum performance: couchbase connect 2015

28
PERFORMANCE TUNING: THE OS, NETWORK, AND COUCHBASE SERVER Dean Proctor, Couchbase

Upload: couchbase

Post on 26-Jul-2015

198 views

Category:

Technology


8 download

TRANSCRIPT

Page 1: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

PERFORMANCE TUNING: THE OS, NETWORK, AND COUCHBASE SERVERDean Proctor, Couchbase

Page 2: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 2

Why do we tune?

Page 3: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

Operating System Tuning

Page 4: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 4

Virtual Memory Architecture

Virtual Memory

Swapper

OOM Killer

Physical Memory

Disk Swap Space

Page 5: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 5

Memory Allocation

Swap vm.swapiness=[0,1]

Transparent Huge Pages (THP) grub.conf: transparent_hugepage=never echo never >

/sys/kernel/mm/transparent_hugepage/enabled echo never >

/sys/kernel/mm/transparent_hugepage/defrag

Page 6: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 6

NUMA Architecture

CPU Socket 1

DIMM 1

DIMM 3

CPU Socket 2

DIMM 2

DIMM 4

QPI

Page 7: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 7

NUMA Architecture

CPU Socket 1

DIMM 1

DIMM 3

CPU Socket 2

DIMM 2

DIMM 4

QPI

Node0 Node1

Page 8: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 8

Disable NUMA

Disable in BIOS Disable for Couchbase

Init script: numactl –interleave all $DAEMON vm.zone_reclaim_mode=0

Page 9: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 9

Linux Storage Architecture

Physical

Block

Cache

VFS

Page 10: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 10

Linux Storage Architecture

PhysicalType Allocation RAID

BlockScheduler IO Request Queue

CacheAllocation Flush Frequency

VFSFS Type Mount options

Page 11: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 11

VFS Tuning

Filesystem Type EXT4 XFS

Mount options EXT4: noatime,barrier=0,data=writeback XFS:

noatime,nobarrier,logbufs=8,logbsize=256k,allocsize=2M

Page 12: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 12

Page Cache

Set the limit for dirty bytes in the page cache vm.dirty_bytes vm.dirty_background_bytes

Set the max time for dirty pages vm.dirty_expire_centisecs vm.dirty_writeback_centisecs

Tune VFS cache reclaim vfs_cache_pressure

Page 13: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 13

Scheduler

Scheduler algorithm echo deadline > /sys/block/<dev>/queue/scheduler

IO request queue echo 1024 > /sys/block/<dev>/queue/nr_requests

Page 14: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 14

Physical Devices

Use local storage, 10k+ SATA or SSD Provision separate disks for data and indexes Battery-backed RAID Align your IO!

Page 15: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

Network Tuning

Page 16: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 16

Network Architecture

NIC

TX Ring

TX Queue

TX Socket Buffer

RX Socket Buffer

NIC

RX Ring

RX Queue

Page 17: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 17

Resilience

Buffers net.core.rmem_max net.core.wmem_max net.ipv4.tcp_mem net.ipv4.tcp_rmem net.ipv4.tcp_wmem

Backlogs net.core.netdev_max_back

log net.core.somaxconn net.ipv4.tcp_max_syn_bac

klog

Balance IRQs echo f > /sys/class/net/eth0/queues/rx-0/rps_cpus

Page 18: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 18

Efficiency

Reduce TCP overhead net.ipv4.tcp_sack net.ipv4.tcp_fack

Reduce connection overhead net.ipv4.tcp_fin_timeout net.ipv4.tcp_tw_reuse

Enable auto-tuning net.ipv4.tcp_moderate_rcvbuf net.ipv4.tcp_window_scaling

Page 19: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 19

Jumbo Frames

8KB Object

1500B MTU

9000B MTUifconfig <dev> mtu 9000

Page 20: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

Couchbase Tuning

Page 21: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 21

Bucket Settings

Page 22: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 22

Working Set Management

Memory Quota

mem_low_wat

mem_high_wat

Page 23: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 23

Views

Design documents Fewer reduces threads More increases threads

Automated index updates updateInterval updateMinChanges replicaUpdateMinChanges

POST http://nodename:8091/settings/viewUpdateDaemonupdateInterval=10000&updateMinChanges=1000

Page 24: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 24

XDCR

Page 25: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 25

Compaction

Page 26: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

©2015 Couchbase Inc. 26

Internal Settings

http://nodename:8091/index.html?enableInternalSettings=1

Page 27: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

Thank you.

Page 28: Tuning Couchbase Server, the OS, and the Network for Maximum Performance: Couchbase Connect 2015

Get Started with Couchbase Server 4.0: www.couchbase.com/beta

Get Trained on Couchbase: training.couchbase.com