1、Server Programming in C+,Wesley Bao, November 2005,Agenda,The myth and reality of design Purpose and overview of the slides Architectural perspectives Implementation perspectives Its decision time Analysis of real-world implementations Q & A,The Myth of Design,Rumor had it that you can follow some d
2、esign process/methodology and come out with a great design from scratch Rumor had it that you can explore and prototype alternatives, learn from failures and then choose the most suitable architecture/designThat is the case in research labs and (to some extent) OSS world,The Reality of Design,In rea
3、lity, you seldom program to a brand new domain; you seldom have the luxury to explore alternatives; prototypes can prove something wrong but cannot prove something right. Thats why they hire experienced engineers who had already familiarized with the domain and explored alternatives elsewhere before
4、 to architect and design solutions people are not very much willing to pay for trial-and-error Patterns are a good way to document and pass on experience (due diligence),Purpose and Overview,Server programming domain knowledge in a nutshell Explore architecture, design and implementation alternative
5、s, demonstrate their pros and cons backed by real data Analyze a few real-world examples to see why they choose certain alternatives,Architectural Perspectives,Iterative Kernel thread (process) per Connection User space thread (fiber) per Connection Thread per Request (active connection) Leader/Foll
6、ower Half Sync/Half Async Active Objects Reactor (level triggered) Proactor (edge triggered) How to manage session state Clustered servers + load balancing routing server,blocking I/O in threads select, poll, dev/poll epoll, rt signal, aio kqueue IOCP Build server into the kernel A survey of platfor
7、m capabilities Resource Pooling,Its Decision Time,Short vs. long-duration sessions Fixed packet length or you have to find the boundary How long will the idle time likely be Request/Response characteristics Protocol Examples Target user: SMB? Enterprise? xSP? Target platforms: cross-platform? Dedicated to few platforms? Appliance? Use wrappers to build in flexibility? How flexible can it be?,Real-world Implementations,Frameworks (aka half-cooked applications) ACE Indy Infrastructures JVM on various platforms Server-side applications QTSS others,