SDC 2015 Santa Clara

Similar documents
Clustered Samba Challenges and Directions. SDC 2016 Santa Clara

SNIA SDC 2018 Santa Clara

SerNet. Samba Status Update. SNIA SDC 2011 Santa Clara, CA. Volker Lendecke SerNet Samba Team

Chapter 4: Threads. Operating System Concepts. Silberschatz, Galvin and Gagne

CS 450 Operating System Week 4 Lecture Notes

PROCESS CONCEPTS. Process Concept Relationship to a Program What is a Process? Process Lifecycle Process Management Inter-Process Communication 2.

SerNet. Async Programming in Samba. Linuxkongress Oktober Volker Lendecke SerNet Samba Team. Network Service in a Service Network

Samba in a cross protocol environment

Asynchronous Events on Linux

Linux Driver and Embedded Developer

Chapter 4: Threads. Chapter 4: Threads

CS 5523 Operating Systems: Midterm II - reivew Instructor: Dr. Tongping Liu Department Computer Science The University of Texas at San Antonio

Implementing SMB2 in Samba. Opening Windows to a Wider. Jeremy Allison Samba Team/Google Open Source Programs Office

CSE 4/521 Introduction to Operating Systems. Lecture 24 I/O Systems (Overview, Application I/O Interface, Kernel I/O Subsystem) Summer 2018

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

Device-Functionality Progression

Chapter 12: I/O Systems. I/O Hardware

Motivation of VPN! Overview! VPN addressing and routing! Two basic techniques for VPN! ! How to guarantee privacy of network traffic?!

HANDLING PERSISTENT PROBLEMS: PERSISTENT HANDLES IN SAMBA. Ira Cooper Tech Lead / Red Hat Storage SMB Team May 20, 2015 SambaXP

Concurrency: Deadlock and Starvation

Chapter 13: I/O Systems

Chapter 4: Threads. Chapter 4: Threads. Overview Multicore Programming Multithreading Models Thread Libraries Implicit Threading Threading Issues

SMB2 and SMB3 in Samba: Durable File Handles and Beyond. sambaxp 2012

Chapter 8: I/O functions & socket options

A Scalable Event Dispatching Library for Linux Network Servers

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads. Operating System Concepts

Agenda. Threads. Single and Multi-threaded Processes. What is Thread. CSCI 444/544 Operating Systems Fall 2008

Chapter 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

Chapter 13: I/O Systems. Operating System Concepts 9 th Edition

Chapter 4: Multithreaded Programming. Operating System Concepts 8 th Edition,

Questions from last time

I/O Systems. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

CISC2200 Threads Spring 2015

Chapter 4: Multi-Threaded Programming

The CephFS Gateways Samba and NFS-Ganesha. David Disseldorp Supriti Singh

LINUX INTERNALS & NETWORKING Weekend Workshop

CS307: Operating Systems

Chapter 3: Processes. Operating System Concepts 8th Edition

CPS 210: Operating Systems

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

Lecture 8: Other IPC Mechanisms. CSC 469H1F Fall 2006 Angela Demke Brown

Topics. Lecture 8: Other IPC Mechanisms. Socket IPC. Unix Communication

Samba. OpenLDAP Developer s Day. Volker Lendecke, Günther Deschner Samba Team

GFS: The Google File System

Samba4 Progress - March Andrew Tridgell Samba Team

Operating Systems. Review ENCE 360

Module 12: I/O Systems

ECE 574 Cluster Computing Lecture 8

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4

CSE 120 Principles of Operating Systems

CSE 451 Midterm 1. Name:

Chapter 13: I/O Systems

OPERATING SYSTEM. Chapter 4: Threads

The State of Samba (June 2011) Jeremy Allison Samba Team/Google Open Source Programs Office

Outline. Threads. Single and Multithreaded Processes. Benefits of Threads. Eike Ritter 1. Modified: October 16, 2012

CMSC421: Principles of Operating Systems

Processes, Threads and Processors

Process. Program Vs. process. During execution, the process may be in one of the following states

Chapter 4 Multithreaded Programming

Chapter 4: Multithreaded

Chapter 13: I/O Systems

GFS: The Google File System. Dr. Yingwu Zhu

Light & NOS. Dan Li Tsinghua University

csdesign Documentation

Module 12: I/O Systems

Chapter 6 Concurrency: Deadlock and Starvation

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits

I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 4: MULTITHREADED PROGRAMMING

Multiprocessors 2007/2008

Sistemas Operacionais I. Valeria Menezes Bastos

ECE 598 Advanced Operating Systems Lecture 23

IX: A Protected Dataplane Operating System for High Throughput and Low Latency

IPC, Threads, Races, Critical Sections. Operating Systems Principles. IPC, Threads, Races, Critical Sections. What is a thread?

Cliff Moon. Bottleneck Whack-A-Mole. Thursday, March 21, 13

Lecture 2: February 6

CHAPTER 3 - PROCESS CONCEPT

Chapter 5: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads

Chapter 4: Multithreaded Programming

Networks and distributed computing

Chapter 13: I/O Systems

CS 475. Process = Address space + one thread of control Concurrent program = multiple threads of control

Advanced Topic: Efficient Synchronization

Chapter 4: Threads. Chapter 4: Threads

Network File System (NFS)

Retrieval Exercises for CS 3733 Operating Systems. Instructor: Dr. Turgay Korkmaz Department Computer Science The University of Texas at San Antonio

EF HLD on SMP machines. Sub-farm design Inter-thread communications and error handling Future developments. Andrea NEGRI D.F.N.T. and I.N.F.N.

Network File System (NFS)

Overview. Last Lecture. This Lecture. Daemon processes and advanced I/O functions

Chapter 13: I/O Systems

Concurrency: Mutual Exclusion and

COMMON INTERNET FILE SYSTEM PROXY

Threads. CS-3013 Operating Systems Hugh C. Lauer. CS-3013, C-Term 2012 Threads 1

Chapter 5: Processes & Process Concept. Objectives. Process Concept Process Scheduling Operations on Processes. Communication in Client-Server Systems

Bullet Cache. Balancing speed and usability in a cache server. Ivan Voras

CSE 410: Systems Programming

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

Transcription:

SDC 2015 Santa Clara Volker Lendecke Samba Team / SerNet 2015-09-21

(2 / 17) SerNet Founded 1996 Offices in Göttingen and Berlin Topics: information security and data protection Specialized on Open Source Software Samba: Windows/Linux interoperability, clustering and private cloud SAMBA+: Samba for Enterprise Linux verinice.: Open Source ISMS Tool Firewalls and VPN solutions for mid-size and large corporations Old economy: no venture capital, no loans

(3 / 17) Overview General motivation for Samba s IPC Basic standard Posix IPC mechanisms Past Samba messaging implementation: tdb and signals Current mechanism: Unix Domain Datagram sockets Future developments

(4 / 17) Parallelism based on messages Wikipedia: An actor is a computational entity that, in response to a message it receives, can concurrently: send a finite number of messages to other actors; create a finite number of new actors; designate the behavior to be used for the next message it receives. There is no assumed sequence to the above actions and they could be carried out in parallel. Many languages embed message passing these days Erlang, Google go, Akka for JVM Some problems with threaded programming disappear with message-based parallelism Others of course get created :-)

(5 / 17) Why Inter *Process* Communication? Erlang, Go and others provide intra-os-process messages Threading based on OS threads plus VM threads All in one memory space Dependency on the virtual machine Distribution to processes possibly more reliable A crash in one OS process has less effect on others Better NUMA affinity Isolated memory maps Process architecture has helped Samba to go clustered Interoperability to other languages

(6 / 17) Samba architecture Traditional Unix architecture One listener process Every client gets its own worker process Helper Threads for asynchronous I/O Linux has no good general kernel-level aio Multi process single thread is vastly simpler than multi thread to us Samba has to communicate: The oplock break Process A needs to ask process B to release an oplock Architecture makes clustered SMB possible Multi-process enforces IPC discipline Going more async: Notifyd

(7 / 17)

(8 / 17) Unix Signals One of the oldest Unix IPC mechanism Asynchronous delivery Almost no information transferred Difficult to use together with threads If possible, receive signals in one thread only When used, not much can be done in a signal handler Posix lists only 135 functions as aync signal safe Watch out for EINTR result of most syscalls

(9 / 17) Shared Memory Same memory pages visible in multiple processes Blurs the distinction between threads and processes Fastest IPC mechanism No kernel involvement for data transfer Good for transferring mass data Limited use for message passing No good signalling mechanism Needs coordinated access Locks, Mutexes

(10 / 17) fcntl locks Advisory byte range locks Shared (F RDLCK) or exclusive (F WRLCK) locks Just an IPC mechanism: fcntl locks do not block read/write Weird semantics regarding duplicated file descriptors Closing any fd on a file loses locks on dup ed fds Very bad scaling fcntl locks maintained in a linked list Posix suggests deadlock detection locks are not per-file Linux has (had?) one big global spinlock for all fcntl lock operations Thundering herd when thousands of waiters are unblocked Automatic cleanup at process exit Lock waiters are not notified that a process crashed

(11 / 17) Process Shared Robust Mutexes pthread mutex t: pthread API to implement critical sections Originally intended for multiple threads within a single process Implementation under Linux with atomic operations No syscall in the non-contended case Waiting for a locked mutex uses a syscall PTHREAD PROCESS SHARED: Mutexes in shared memory Downside: If a mutex holder crashes, nobody can clean up PTHREAD MUTEX ROBUST: EOWNERDEAD When a mutex holder dies, a subsequent pthread mutex lock gets EOWNERDEAD Linux and Solaris only

(12 / 17) Samba Messaging Samba has a multi-writer key/value hash table: TDB Shared Memory Coordination via fcntl locks Where available: Process Shared Robust Mutexes Very fast for heavy concurrent small record updaters Messaging based on tdb: Every process has a record in a tdb as a mailbox Signalling via SIGUSR1 Simple, but bad under high load fcntl load brings system down With robust mutexes it is okay

(13 / 17) Unix Domain Datagram Sockets UDP on the local box Contrary to UDP, AF UNIX DGRAM sockets are reliable One socket per participating process Limited message size, sender must fragment FD passing possible via sendmsg() Asynchronous send into full queue: Poll with nonblocking send: High load by senders Blocking connected send scales well under Linux No thundering herd, contrary to thousands of writers into a pipe Well tuned for syslog via /dev/log Access to the socket dir can become a bottleneck

(14 / 17) Replace ctdb messaging All cluster communication goes through ctdbd Single Process, Single Threaded Only 1 CPU used for inter-node messaging Samba assumes reliable messaging Stream Socket, i.e. TCP between nodes TCP connection setup too expensive per message One proxy process per peer Open a normal Unix DGRAM socket Forward to another node Sender process decides which proxy to use

(15 / 17) Unix Domain Stream Sockets Datagram Sockets not overload-safe on FreeBSD ENOBUFS returned under overload Unlike Linux, FreeBSD can t do graceful blocking send Every message involves namespace operations Not truly scalable, requires a read lock on the socket directory File Descriptors are cheap epoll/kqueue designed to scale N M Stream Sockets between processes

(16 / 17) tmond How to pass stream socket fds? Every smbd listens on a stream socket connect() does not behave nicely under overload tmond provides a central hub Every messaging process connects() once Fresh stream to a peer: socketpair() and sendmsg() via tmond Process Monitoring via tmond Locks in user space: Wait for a process to go away, retry General replacement for ctdb watch us/ctdb unwatch

(17 / 17) Questions? vl@samba.org / vl@sernet.de