what makes a ldap server running fast ? an bit of insight about the various bottlenecks and...

43
What makes a LDAP server running fast ?

Upload: ldapcon

Post on 18-Nov-2014

1.110 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

What makes a LDAP server running fast ?

Page 2: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Apache Software Foundation member

Chairman of MINA project

PMC of Apache Directory Project

IKTEK Owner (www.iktek.com)

www.iktek@com, [email protected]

Emmanuel Lécharny

Page 3: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Latency numbers every programmer should know !

(https://gist.github.com/hellerbarde/2843375)

3

Main memory reference ...................... 100 ns

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

Read 1 MB sequentially from SSD* ..... 1,000,000 ns = 1 ms

Send 1 MB over 1 Gbps network ....... 10,000,000 ns = 10 ms

Disk seek ........................... 10,000,000 ns = 10 ms

Read 1 MB sequentially from disk .... 20,000,000 ns = 20 ms

Page 4: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

A request...

Page 5: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Search : From client to client

Page 6: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

ASN/1

Page 7: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

ASN/1 codec

7

0x30, 0x33, // LDAPMessage ::=SEQUENCE { 0x02, 0x01, 0x01, // messageID MessageID 0x60, 0x2E, // CHOICE { ..., bindRequest BindRequest, ... // BindRequest ::= APPLICATION[0] SEQUENCE { 0x02, 0x01, 0x03, // version INTEGER (1..127), 0x04, 0x1F, // name LDAPDN, 'u', 'i', 'd', '=', 'a', 'k', 'a', 'r', 'a', 's', 'u', 'l', 'u', ',', 'd', 'c', '=', 'e', 'x', 'a', 'm', 'p', 'l', 'e', ',', 'd', 'c', '=', 'c', 'o', 'm', ( byte ) 0x80, 0x08, // authentication AuthenticationChoice // AuthenticationChoice ::= CHOICE { simple [0] OCTET STRING, // ... 'p', 'a', 's', 's', 'w', 'o', 'r', 'd'

connection.bind( "uid=akarasulu,dc=example,dc=com", "password" );

TO :

FROM :

Page 8: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Searching

Page 9: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Search, search, search

It's all about

Search performance !

Page 10: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Check, please !

Page 11: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Search Request Checks

11

Checks done before the first entry is returned :

- Normalize the filter- Check if the password should be reset- Check if the user is authenticated- Check the filter attributes- Find the backend

This represents 9% of the initial search processing

(for a search returning one entry).

Page 12: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

The candidates

Page 13: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Selecting candidates

Candidates are referencesto

entries

(in other words, they are just pointers...)

Page 14: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Selecting candidates

AND OR NOT

No index ∀ ∀ ∀

Index ∩ ∪ ∀

Remember : We don't actually fetch any entry !

Page 15: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Candidates & AND filter

Maximum = min(filters candidates)

Minimum = min(filters candidates)

Here, max = 72 and min = 72

Page 16: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Candidates & OR filter

Maximum = sum(filters candidates)

Minimum = sum(filters candidates)

Here, max = 8098 and min = 8098

Page 17: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Cost of creating candidates

Looking for the best index

+

Creating the set of references

=

20% of the search processing

Page 18: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Index

No index,

no Gain

Page 19: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Filters

Build your search

Filterswith caution

Page 20: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

The Cache

Page 21: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Cache

It's all about Memory

Vs

Disklatency

Page 22: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Reminder

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

Read 1 MB sequentially from SSD* ..... 1,000,000 ns = 1 ms

Read 1 MB sequentially from disk .... 20,000,000 ns = 20 ms

Disk is from 4x to 80x slower !

Page 23: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Cache, the good

No Disk access =>

Fast (very!)

Page 24: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Entry Cache

It caches ObjectsHash map

Or

Ordered data structure

Page 25: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Cache, the bad

Locks...Algorithms...

Memory...

Page 26: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Cache, the ugly

L Has to be 'warm'L Immutable objects

=> A kind of copy is needed

45% of the search processing time

Page 27: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

DISK

Page 28: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Backend

Storage !

Page 29: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Backend

Remember :

memory vs disk latency...

Page 30: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Memory

Page 31: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Of Price and Men

Memory : 64 GB = 1000$

vs

1 day of consulting to 'tune'

your servers for little gain = ???

Page 32: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Machines

Page 33: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

(Olivia) Newton (John) Theory

Let's get physical,

physical

Page 34: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

VM vs Bare metal

http://www.altechnative.net/2012/08/04/virtual-performance-part-1-vmware/

Page 35: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

VM vs Bare metal

From 16h to 16 mins...Most certainly IOs and/or disk access

(Spinning disks on a SAN)

Page 36: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Disk

Own your Disks !Don't share them...

SSD is a winner !SSD 1TB = 600$

HD 1TB = 100$

Page 37: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Network

Own your network !

Don't share it...

Page 38: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Network

Page 39: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Network

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

Read 1 MB sequentially from SSD* ..... 1,000,000 ns = 1 ms

Send 1 MB over 1 Gbps network ....... 10,000,000 ns = 10 ms

It's 4x to 40x times slower than memory :

But still : you can send up to 100 000 1kb entries per secondThrough 1Gbps network...

Page 40: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Network

Get a fast network !

Page 41: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Misceallenous

Page 42: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Authorization

AUTHzIs

NotFree.

Page 43: What makes a LDAP server running fast ? An bit of insight about the various bottlenecks and solutions to avoid them

Thanks!