developing scalable and portable cifs server - snia · mark rabinovich – project manager 4...

41
Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved. Developing Scalable and Portable CIFS Server Single solution for any CIFS application

Upload: hoangnguyet

Post on 25-Sep-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Developing Scalable and Portable CIFS Server

Single solution for any CIFS application

Page 2: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Plan

IntroductionThe ChallengeArchitecture In GeneralDecompositionsModelingPorting & IntegrationQ & A

2

Page 3: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Introduction

3

Page 4: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Who We Are

CompanyVisuality Systems Ltd.Embedded/Mobile CIFSCIFS Acceleration

SpeakerMark Rabinovich – Project Manager

4

Page 5: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Experience To Share

NQ – Client/Server CIFS solutionAbove 80 customers in more than 15 industriesPortable solutionCurrently suites embedded and mobile markets

Page 6: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Today’s Theme

- We will discuss the CIFS Server – the CIFS Client not covered

- We will analyze requirements introduced by various and, sometimes, contradicting markets

- We will see how to satisfy those requirements in a framework of a single solution

Page 7: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

The Challenge

7

Page 8: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Dimensions of Flexibility

Industries…introduce various and, usually, contradicting requirements

Operating Systems…not only have different APIs but require very polar approaches sometimes

CPU…not as crucial as the OS, but might introduce certain challenge

Compiler…might apply additional difficulties

8

Page 9: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Industries

Consumer products: media players, set-top boxes, printers, scannersNetwork appliances: home routersMedical equipmentMilitaryAerospaceMobile telephony…and more

9

Page 10: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

More Industries

And of course – the traditional CIFS consumersPDAsDesktops and notebooksServersNAS

10

Page 11: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Operating Systems

A partial list of operation systems to be considered:VxWorksLinux (numerous flavors)IntegrityThreadXWindows CEITRON (numerous flavors)Mobile OS (Symbian, SE-OS, etc.)Others...

11

Page 12: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Operating Systems (cont.)

Posix versus Object-OrientedNative API may be either functional (Linux, VxWorks, etc.) or object-oriented (Symbian)

Where is my “printf”?Basic OS services may differ in syntax and even in semantics

“Select” or not “select”?Main mechanisms may have incompatible models: like select-controlled sockets versus event-driven socketsFortunately, most of operating systems feature comparable File System models although APIs may differ.

12

Page 13: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

CPU + Compiler

Hardware and compiler introduce more challenges:

Byte order: Big Endian or Little Endian?

Alignment: bet Odd or bet Even?

Structure packingStack size

13

Page 14: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Architecture In General

Page 15: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Architecture

15

Startup

Core

Project

Native OS API

System

Page 16: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Layers

Core – shared by all solutionsStartup – system-dependent, may be modified per projectSystem – reusable by projects sharing the same platform Project – per a project

API between the Core layer and System/Project layers is an abstraction layer API

16

Page 17: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Goals

The Core component should cover as much code as possible (at least 90% expected)It should be configurable to suite different applications/industriesHigh level of abstractions in APIs between layers

Page 18: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Decomposition

Page 19: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Application Types

EmbeddedLow-scale. Provide CIFS services “as is” regardless of the performance. A couple of client connections. An integrated service.

MobileAs above but runs as a loadable application.

DesktopAssumes limited number of client connections with medium-to-high performance.

Servers and NASUpper-scale. Serves numerous client connections with high performance.

19

Page 20: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Resources Per Application

Embedded Mobile Desktop Servers

Shares 1-3 1-2 Unlimited Unlimited

Concurrent clients

1-3 1-2 10 Unlimited

Tree connections 2-6 2-4 20-30 Unlimited

Files 20 10 100 Unlimited

Open files 20 10 150 Unlimited

Searches 5 3 20 Unlimited

The numbers are for an SMB1 Server. SMB2 Server requires more open file and search resources. The numbers are for consideration only and they do not necessarily reflect each application.

Page 21: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Features

Memory usageStatic = preallocatedDynamic = heap

ResourcesLimited = fixed size tablesMedium = limited allocationUnlimited = free allocation

Performance: Low – “as is” SMB ServerMedium – emphasis on performance without applying extra mechanisms High – the maximum performance

21

Page 22: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Mechanisms

MultithreadingThread per client connectionThread pool

PipeliningTransferring payload between protocol layers: SMB/Transaction/RPCHappens because of different buffer limits

Bulk data transferSocket-to-fileFile-to-socket

22

Page 23: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Features Per Application

Embedded Mobile Desktop Servers

Memory usage Static Dynamic Dynamic Dynamic

Resources Limited Limited Medium Unlimited

Performance Low Low Medium High

Multithreading - - V V

Thread pool - - - V

Pipelining - - V V

Bulk transfer - - - V

Page 24: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Modeling

Page 25: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

The Approach

We have to put at least 90% of the code into the “Core” component.The trade-off: use a set of alternative (replaceable) solutions to:

better abstract the API between the Core layer and system-and-project-dependent layers;better suite conflicting application requirements

25

Page 26: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Assembling The LEGO

26

NetworkingNetworking

DispatcherDispatcherDispatcher

Context Database

PipeliningPipelining

SMB processing

Data Transfer

This model is suitable for any application but Server/NAS

Some components have optional solutions

Context DatabaseContext Database

Page 27: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Networking

Select()-based approachEvent-driven approach

27

Why two solutions?

Implementing Select()-based API on top of event-driven sockets involves writing too much system-dependent code. … and vise versa.

See also Porting below

Page 28: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Packet Dispatcher

Single-threadedEasy to implement and maintain

Thread-per-connectionFor a limited number of connectionsAssumes light-weight threads

Thread poolFor numerous connections

28

Page 29: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Context Database

Keeps the context of SMB conversationPart of the context may be external to SMB.The following data types are likely to be internal:

ConnectionsSharesTree connectionsUsers

Some data types can be external and shared with NFS, FTP, etc. This is suitable for Server/NAS applications

FilesOpen filesSearches (directory scans)

29

Page 30: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Context Database (cont.)

30

Optional solutions:Fixed size tables Dynamic allocation with pre-allocation and limitsUnlimited dynamic allocation

Page 31: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Pipelining

Pseudo-pipelining – limited functionalityThe same buffer is usedProcessing happens in the same threadLimited Transaction/Transaction2SPOOLSS not available

Full pipelining – requires threads for:Transaction/Transaction2/NtTransactRPC

31

Page 32: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Server/NAS framework

Server/NAS

32

Context Database (extra)

Pipelining

SMB processing

Context Database may be fully/partially implemented inside SMB

Networking

Dispatcher

Context Database (basic)

File systems

Networking, Dispatcher, etc., when implemented outside SMB may be shared between SMB/FTP/NFS/etc.

Page 33: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Data Transfer

Suites Server/NAS applicationsCan be compared to DMASeparates between SMB processing and data transfer:

Socket SMB processing FileFile SMB processing socket

May be internally implemented as yet another Core component, or …May be implemented outside SMB as a bulk transfer

33

Page 34: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

SMB header

command parameters

Data Transfer Outside SMB

FRAMEWORK

CORE

FileSystem

NBT header

data length

data

Page 35: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Data Transfer API

This is an conceptual example of Data Transfer API

Framework calls:smbParseRequest(callback);

callback->receive(buffer, 4);callback->receive(buffer, HEADERSIZE);callback->receive(buffer, commandSize);

…on Write(WriteAndX) calls:callback->transferDownstream(fileID, dataSize); callback->send(nbtHeader, 4);callback->send(smbHeader, HEADERSIZE);callback->send(commandPaylod, commandLength);

…on Read(ReadAndX) calls:callback->transferUpstreams(fileID, size);

35

Page 36: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Porting and Integration

Page 37: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Porting and Integration

OSCompilerHardwareProject-dependent solutions

37

“Porting” stands for modifying the CIFS solution to suite yet another platform – a combination of:

“Integration” stands for modifying the CIFS solution for yet another project on the same platform

Page 38: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Issues and Goals

It is virtually impossible to support some 20 OS solutions. Modular approach to share solutions between OS-esInherit yet another solution from sample solutions

LinuxVxWorks

Separate between System Layer and Project Layer

38

Page 39: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Decomposition

System LayerFile SystemNetworkingGeneral servicesCPU + CompilerTrace log

Project LayerUsers and passwordsSharesHome domain

39

Page 40: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Q & A

Page 41: Developing Scalable and Portable CIFS Server - SNIA · Mark Rabinovich – Project Manager 4 Storage Developer Conference 2009

Storage Developer Conference 2009 © 2009 Insert Copyright information here. All rights reserved.

Thank you