Queueing in dCache Paul Millar Berlin, 2013.05.28 Mythical - - PowerPoint PPT Presentation

queueing in dcache paul millar berlin 2013 05 28 mythical
SMART_READER_LITE
LIVE PREVIEW

Queueing in dCache Paul Millar Berlin, 2013.05.28 Mythical - - PowerPoint PPT Presentation

Queueing in dCache Paul Millar Berlin, 2013.05.28 Mythical self-organising users? Credit: Florenz Kley @flickr Queues: dealing with uneven loads Credit: toronto_pcu @flickr Always fast-enough too expensive Credit: @flickr Threads and


slide-1
SLIDE 1

Queueing in dCache Paul Millar Berlin, 2013.05.28

slide-2
SLIDE 2

Mythical self-organising users?

Credit: Florenz Kley@flickr

slide-3
SLIDE 3

Queues: dealing with uneven loads

Credit: toronto_pcu@flickr

slide-4
SLIDE 4

Always fast-enough too expensive

Credit: 黒忍者 @flickr

slide-5
SLIDE 5

Threads and ThreadPools

  • A thread is the smallest unit of independent

CPU activity supported by Java (and most OSes)

  • Creating a thread is (relatively) expensive
  • A thread-pool allows a thread to be used for

multiple tasks

slide-6
SLIDE 6

Queue + ThreadPool

Credit: mimi anderson@flickr

slide-7
SLIDE 7

Queues and dCache

Credit: Sarah Macmillan@flickr

slide-8
SLIDE 8

Queue overflowing are a symptom

Credit: Alexandre Duret-Lutz@flickr

slide-9
SLIDE 9

Queues and dCache

  • Impossible to get a comprehensive talk on this subject
  • It's far, far to big a topic!
  • Instead, take a worked example:
  • Uploading a file using SRM and FTP
  • Client chooses to write file into a specific space-reservation
  • File is custodial/nearline, so flushed to tape
  • With the following limitations:
  • Everything runs smoothly (no errors)
  • only presenting some of the interactions between components

Skip over some details, when they are unenlightening.

  • No advise on tuning
  • Many details are specific for this worked example.
slide-10
SLIDE 10

Helicopter view

  • Client connects to...
  • SRM and issues a prepareToPut.
  • GridFTP door, preparing dCache for upload
  • Pool, delivering data
  • SRM and issues a putDone command.
  • Independent from the putDone, the pool

flushes file to tape

slide-11
SLIDE 11

The communication: srmPrepareToPut

client SRM gPlazma PnfsManager Space Manage prepareToPut() login login OK Does file already exist? No request parent directory metadata <metadata> Check user can write mark space in use Select door Increase READY turl count <turl>

slide-12
SLIDE 12

Communication: FTP (part 1)

client FTP door gPlazma PnfsManager Space Manager PoolManager Pool USER 200 User logged in PUT create file <PnfsId>,<SI> SelectWritePool select LinkGroup SelectWritePool <pool> store <PnfsId> <pool> PoolAcceptFile lookup AL & RP PoolAcceptFile Update load-model PoolAcceptFile <moverId> <moverId> update status <moverId>

slide-13
SLIDE 13

Communication: FTP (part 2)

client FTP door gPlazma PnfsManager Space Manager PoolManager Pool Billing TransferStarted 127 PORT Connect & send data Last byte & close connection <size>,<AL>,<RP>,<checksum> Log transfer TransferFinished Update load-model TransferFinished update status TransferFinished Log transfer 226 Transfer complete. QUIT 221 Goodbye

slide-14
SLIDE 14

Communication: srmPutDone

client SRM gPlazma PnfsManager prepareToPut() login login OK file exists? yes decrease READ TURL count SUCCESS

slide-15
SLIDE 15

Communication: pool-flush

Pool PnfsManager Space Manager Time to flush file to tape File exists? Yes Run tape integration script FileFlushed Update storage info FileFlushed Free space

slide-16
SLIDE 16

Queues: messages

slide-17
SLIDE 17

Messaging

Cell Cell

Thread Thread

Domain

slide-18
SLIDE 18

Messages: generating quick reply

Cell Cell

Thread Thread

Domain

Message Queue

Generate quick Reply

slide-19
SLIDE 19

Messages: slower replies

Cell Cell

Thread Thread

Domain

Message Queue Thread

Slower Reply

Another queue

slide-20
SLIDE 20

Messages: replying (blocking)

Cell Cell

Thread Thread

Domain

Message Queue

Generate quick Reply WAIT

slide-21
SLIDE 21

Messages: registered call-back

Cell Cell

Thread Thread

Domain

Message Queue

Generate quick Reply

Callback Queue Thread

slide-22
SLIDE 22

Messages: pure asynchronous

Cell Cell

Thread Thread

Domain

Message Queue

Generate quick Reply

Thread Message Queue

slide-23
SLIDE 23

Messages: tunnel

Thread Message Queue

TCP socket Write

Thread

Read

Tunnel Cell

slide-24
SLIDE 24

SRM: srmPrepareToPut

slide-25
SLIDE 25

srmPrepareToPut: Jetty server

Thread Thread Thread Connection Queue

  • 1. Wait for request:

Disconnect if client takes too long

  • 2. Parse request
  • 3. Run SRM code to build reply
  • 4. Send reply
  • 5. If client requested it or HTTP/1.0

Disconnect

  • 6. Loop

srmJettyThreadsMaxQueued (500) srmJettyConnector- BackLog (1024)

TCP Backlog

srmJettyThreadsMin (10) srmJettyConnector- Acceptors (1) srmJettyThreadsMax (500) srmJettyThreads- IdleTime(30s)

slide-26
SLIDE 26

srmPrepareToPut: generating reply

Thread Thread Thread Thread Queue Priority ThreadQueue Thread Manager ReadyQueue

200

SURL

srmPutReq ThreadPool Size (250) srmPutReq ThreadQueue Size (10,000)

PnfsManager: Does file exist?

Thread

No PnfsManager: Get parent dir metadata <metadata>

Thread

SpaceManager: use space Done

Thread

TURL

Thread

srmPutReq ReadyQueue Size (250) srmPutReqMax ReadyRequests (1,000)

gPlazma: login OK

unbounded

slide-27
SLIDE 27

SRM and databases

Thread Thread Jdbc Queue

DB Query

srmMaxNumber OfJdbcTasksInQueue (1,000) srmJdbcExecution ThreadNum (5)

DB Connection Pool

min(0) max (50) Never Expires

slide-28
SLIDE 28

gPlazma

Thread

gPlazmaNumber OfSimultaneous Requests (30)

Process login attempt Deliver login result

MessageQueue

slide-29
SLIDE 29

PnfsManager

Thread MessageQueue

PnfsQueue MaxSize (0) pnfsNumberOfThreads(4) pnfsNumber OfThread Groups (1) Single Thread

slide-30
SLIDE 30

PnfsManager

Thread PnfsThread DB Connection Pool

min(30) max (90) idle (4 hours)

Send Result Folding

slide-31
SLIDE 31

SpaceManager

Thread MessageQueue

200 Unbounded

ThreadManager Thread DB Connection Pool

min(0) max (30)

Send Result

idle (4 hours)

slide-32
SLIDE 32

FTP upload and pool flush

slide-33
SLIDE 33

FTP door

Thread Thread

(50)

TCP Backlog Create Thread Create Command Queue

FTP Cmd

Unbounded

Thread

Single Thread

Thread MessageQueue

Process Command React on notification

slide-34
SLIDE 34

PoolManager

SelectWrite Pool

Thread MessageQueue Thread Create

Reply with result AcceptFile

Thread

Forward message

slide-35
SLIDE 35

Pool: AcceptFile

Thread MessageQueue

(1,000) max=50 min=5 Idle=1 min

Mover Queue

maxActive Movers

Thread

(50)

TCP Backlog

Reply TransferStarted Open socket PnfsManager: update Billing:Info Door:TransferFinished Notify: new precious file

slide-36
SLIDE 36

Pool: flush

Thread StorageClass Queue Thread

Notify: new precious file

Storage Queue

PnfsManager:file exists? Yes run script PnfsManager:FileFlushed SpaceManager:FileFlushed

slide-37
SLIDE 37

Billing

Thread MessageQueue Write to file Write to db

slide-38
SLIDE 38

SRM srmPutDone

slide-39
SLIDE 39

srmPutDone: Jetty server

Thread Thread Thread Connection Queue

  • 1. Wait for request:

Disconnect if client takes too long

  • 2. Parse request
  • 3. Run SRM code to build reply
  • 4. Send reply
  • 5. If client requested it or HTTP/1.0

Disconnect

  • 6. Loop

srmJettyThreadsMaxQueued (500) srmJettyConnector- BackLog (1024)

TCP Backlog

srmJettyThreadsMin (10) srmJettyConnector- Acceptors (1) srmJettyThreadsMax (500) srmJettyThreads- IdleTime(30s)

slide-40
SLIDE 40

srmPutDone: generating reply

Thread

PnfsManager: Does file exist? Yes gPlazma: login OK Decrease READY count

slide-41
SLIDE 41

Summary

  • Queues are not evil
  • Queues should be tuned for good

performance, even under heavy load

Simply increasing queues isn't always optimal

  • Quite a number of queues in dCache:

not all are obvious, not all are tunable