Top Banner
Rick Reed WhatsApp Half a Billion 600M+ Unsuspecting FreeBSD Users
32

600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Aug 20, 2015

Download

Technology

iXsystems
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Rick ReedWhatsApp

Half a Billion 600M+Unsuspecting FreeBSD Users

Page 2: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

topics

historystatisticsarchitecturewinschallenges

Page 3: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

rr

Joined WhatsApp server team in 2011Performance, multimedia, security, opsPreviously: Yahoo!, SGI, Metaphor, AionFirst FreeBSD: 2.2.8 at Yahoo!

Page 4: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Why FreeBSD?

Previous Yahoo! experienceHigh-quality, high-performance TCP stackScaleStability

Page 5: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
Page 6: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Numbers

Over 600M monthly users140M concurrent connections440k connections per second1.1M messages sent per second1B pics sent per day

Page 7: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Numbers

~800 servers (incl. 200 chat + 350 mms)

Page 8: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
Page 9: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
Page 10: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Performance

SMP scaling is greatkernel relatively free of contentionErlang (actor model)BEAM (Erlang VM) very SMP-aware

Page 11: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
Page 12: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
Page 13: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
Page 14: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
Page 15: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

System metrics

Page 16: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Hardware (typical)

SoftLayer bare-metal1U/2U/4U Supermicrodual E5-2690v2 (40 threads)(public, private) x 2 lagg x 1g igb (some 10g ix)64-768GB RAM1-12 800GB SSD (12x4TB HDD for video)JBOD w/ mobo, Adaptec, and LSI controllers

Page 17: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Software Platform

FreeBSD 9.1 - 9.3ufsgmirror for HDD video serversstarting to evaluate 10.1

Page 18: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Software Platform

Erlang R16B01 (w/ our patchset)rtpriopatches address specific contention issuesschedulers bound to cpusallocators tuned for superpage promotionyaws for web-serving (but disable sendfile)

Page 19: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Software Platform

stud for SSL termination (proxy via loopback)

Page 20: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Data storage

Erlang mnesiaaccount data, group membership, etc.in-memory + dump/log persistence

Flat-file on hashed directory treeoffline mailboxes, mediafs layout tuned per workload

Page 21: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

System metrics

6 x 800GB SSD per offline storage server

Page 22: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Versions

FreeBSD 7: 2009-2010goodbugs: some

Page 23: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Versions

FreeBSD 8: 2011-2012betterbugs: zero-copy sockets, igb, tsc tctuning got us to ~2.8M conns/server

Page 24: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Versions

FreeBSD 9: 2013-yes!bugs: very, very rare panicenhancements:

>2G dirhash sizemax tcp rexmit interval

Page 25: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Tuning

kernconfremove unused modulesenable debugging/tracing

Page 26: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Tuning

loader varsigb (numq=8, rx_process_limit=-1, r/txd=4k)kern.nbuf=128kkern.max{files,filesperproc,proc}net.inet.tcp.tcbhashsize=512knet.inet.tcp.hostcache.bucketlimit=1

Page 27: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Tuning

Networkcapacity (mbufs, sockets, etc.)

Page 28: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Tuning

vfsufs.dirhash_maxmem (patched for >2G)dirty buffer limits & sync delays

Page 29: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Issues

ufs panics (fs inconsistencies after crash/pfail)bursty syncer behaviorfiledesc table contentionpcb table contention (1.5m igb + 3m loopback)

Page 30: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Now vs. then

machdep.panic_on_nmiVM pressure

Page 31: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Wishlist

Multipath TCPFaster large RAM boot

Page 32: 600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)

Questions?