+ All Categories
Home > Data & Analytics > PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Date post: 02-Dec-2014
Category:
Upload: jlb666
View: 484 times
Download: 6 times
Share this document with a friend
Description:
Presentation de postgresql chez leboncoin.fr a l'occasion des PGDAY FR, le 6 juin 2014 a Toulon.
38
2TB of RAM ought to be enough for anybody PG Day FR 2014
Transcript
Page 1: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

2TB of RAM ought to be enough for anybodyPG Day FR 2014

Page 2: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

The Presenter2

Jean-Louis Bergamo - @jlb666Paris, France

Page 3: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

The Presenter – short bio3

• 2000-2006 : Easynet• 2007-2010 : Skyrock.com

● European biggest blog platform

• 2010-2011 : Winamax.fr• #1 Online poker game

• 2011-2012 : Cadremploi.fr• 2013-03-01: Infra manager

Page 4: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Schibsted Classified MediaFrom 1 to 30+ Countries in 7 years

4

Page 5: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

5

Page 6: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Templated deployment in 30 countries w/ shared technology

6

• Technology originally inherited from Blocket.se

• Has since evolved to power all 30 sites

• Focus on performance and ease of local modifications

PostgreSQL

Middleware(data access, business

rules)

Index

Presentation layer

APIs Web

Search C

C

C

PHP

C/PHP

CPL/SQL

Page 7: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

PostgreSQL in the SCM Platform

7

100+ servers running PostgreSQL

8TB of data

50+ million classified ads

Page 8: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Schibsted Classified Media & PostgreSQLmarried…and in love

8

Page 9: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

#1 Classified Web site in France

9

Page 10: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

History

10

Project initiated in 2006

Site launch: early 2007

Based on technology

from 1 to 230 people, challenger to #1 in 7 years

Page 11: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

11

Page 12: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

12

Page 13: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

13

Page 14: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Explosive growth…with a few bumps along the way!

14

Page 15: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Big Audience

15

250M page views / day

5M unique visitors / day

18M UV / monthThat’s 1/3 of French internet population…

600000+ new ads / day

25M live ads

#7 most visited Website in France

Page 16: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Big Ops

16

300+ servers in 2 DCs

20 servers hosting PG databases

(in production)

Page 17: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Built on SCM Technology

17

PostgreSQL

Middleware(data access, business

rules)

Index

Presentation layer

APIs Web

Search

Page 18: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Built on SCM Technology

18

Website Data

MasterSlave(hot

standby)

Slave(short

queries)

Slave(Long

queries)

Middleware(data access, business

rules)

Index

Presentation layer

APIs Web

Search

Page 19: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Built on SCM Technology

19

Website Data

MasterSlave(hot

standby)

Slave(short

queries)

Slave(Long

queries)

Middleware(data access, business

rules)

Index

Presentation layer

APIs Web

Search

+15 support DBs

Page 20: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Website Data

+15 support DBs

We use PostgreSQL everywhere!

20

Backoffice & Analytics

MasterSlave(hot

standby)

Slave(short

queries)

Slave(Long

queries)ODS

OLAP

BI & CRM Middleware(data access, business

rules)

Index

Presentation layer

APIs Web

Search

Page 21: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

We try to limit writes!

21

• Index/Search acting as a structured cache

• Master DB workload = 70% writes• Slaves used to offload read queries

• Main database = 6TB on disk…• +4TB archived away…

• 20K LOCs of PL/SQL

Website Data

+15 support DBs

MasterSlave(hot

standby)

Slave(short

queries)

Slave(Long

queries)

Index

Search

Page 22: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

PostgreSQL works beautifully as a DW!

22

Website DataBackoffice & Analytics

MasterSlave(hot

standby)

Slave(short

queries)

Slave(Long

queries)ODS

OLAP

ETL moving 500GB / day into

the DW

2.2TB

Adding 6GB/day

Page 23: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Big Iron: HP DL980, 2TB of RAM, 64-80 cores

23

Page 24: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

HTOP on the Master

24

Page 25: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Physical storage for the main PostgreSQL instances

25

DL980 DL980

3Par V800(SAN)

Fusion-IO

DL980DL980

3Par V800(SAN)

Fusion-IO

Fib

erC

hann

el

Fib

erC

hann

el

Master Slave SlaveSlave

DC 1 DC 2

Page 26: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Big Iron: 3Par V800 SAN

26

Page 27: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Big Iron: thin provisioning with mix of SSD and FC disks

27

Page 28: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Big Iron: high performance…

28

Page 29: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Bragging about it ;)

29

Page 30: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Despite the caches and the search engine, we get impressive workloads on the master DB

30

600 tx/sec

Page 31: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

How did we get there?

31

2x DL980 w/ Fusion-IO

2x 3Par V8002x DL980 w/

FC to the V800s

Page 32: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

We did go through growing pains and near disasters

32

The « Big One »

Page 33: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Our own « worst day of our lives »: March 1st 2013 (1/2)

33

Master DB is slowing down dramatically

We find that Slony replication is the culprit

We don’t know what to do…

Until we find a solution on the net that involves cleaning up slony metadata…

…(you know where this is going)…

We fumble. We notice. The slave is borked.

Rebuilding the Slave with slony brings the Master down. Oh. God…

We take the Master off the stack, and start rebuilding the slave w/ Slony

…5 days later, we are done (!)…

Page 34: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Our own « worst day of our lives »: March 1st 2013 (2/2)

34

…but we are not out of the woods yet!...

Pent up demand is bringing the site down!

We decide to switch to native replication!

…but the network cards are maxed out by the replication data…

…triggering a kernel bug…

…(Murphy, could you please step out of the room?)…

We implement network card bonding, and start moving support tables off the main instance

…and we are done!

Page 35: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

What’s Next?

35

Page 36: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Vertical Scalability has limits!

36

We are already running on the biggest HW money can buy

Past certain volume levels, execution plans can change radically

Huge instances are difficult to maintain & backup safely

Rebuilding the slave in March 2013 took a full 5 days…

Although we are maxing out the HW available to us, especiallyon the writes/s,

We are committed to PostgreSQL at the heart of our platform

Page 37: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

Key ideas to take our platform to the next level

37

Sharding

Unbundling of

the schema

PGQ

Spread the reads & writes horizontally

Move parts of the schema (that can be decoupled) to other instances. Spread the

workload

Reduce application-level transaction interleaving by moving parts of the

transactions to asynchronous workers

Page 38: PGDAY FR 2014 : presentation de Postgresql chez leboncoin.fr

38


Recommended