!== !== Architecture.txt for IServerd snapshot 04 Nov 2000 !== Contributor: Dmitry A. Panov Date: 04 November 2000 Updated: 14 May 2001 by Regressor Subject: IServerd architecture ============================================================================ ‚€€€€€€€€€€€€€€<€€€€€€€€€€€€€€€€€€€€€<€€€€€€ƒ V  ‚€‰€€ƒ ‚€ ƒ ‚€€€€€€ƒ ‚€€€€€€ƒ ‚€€€‰€€€€€ƒ ฅ         จ  MS †€€€€€€€€€€€€>‡ SP †==>‡ PP1 +†===>‡ + EP  ก DB ก „ˆ€€€… poll()   „€€€€€ฝ… „€ˆˆ€ฝ€€ˆ€… ก       ก  ‚€€€€ƒ   daemon ‚€€€€€ฝƒ  ก  ก Online ก   US †€€€€€€€€€>‡ †==>‡ PP2 +†===>€€… ซ  ผ        < > ต       ก  „€ˆ€€… „ €… „€ˆ€ˆ€€… „€€€€€ฝ…   ก Users ก     ก   ก       ก  „<€ wwp,info...   ... ฑ        ผ    ผ        < > ต Msgs ก    ก   ก       ก  ‚€€€€€€ƒ   ‚€€€€€ฝƒ  ‚€€‰€€ƒ ก ก „€<<€‡ BP †<======… „=====>‡ PPn +†===>€€€… Timer ซ         ฎ „€€€€€€… „€€€€€€… „€€€€€… MS -- Main socket (UDP socket for clients) US -- Webpager socket (unix domain socket for wwp messages) SP -- Socket Processor (control socket, manage childs) PP -- Packet Processors (n) (process messages) EP -- Event Processor (confirm and timeout actions processing) BP -- Busy processor (live-time limited kamikaze-process) ==> -- IPC pipe (IPC pipe based on unix domain sockets )   > -- database connection (connection to main database) Socket processor listen sockets and put all data in interprocess pipe. Also it manage childrens - if any child exits SP fork new one to keep mininum number of childs correct. Packets processors read from interprocess unnamed pipe and process packets (they work with database server directly). They (PP's) send ask packets directly to socket and reply packets to second pipe (pipe to event-processor). Read and write to pipe are coordinated by semaphores. Event processor keep list of unconfirmed packets and resend them after timeout, also it keep online users cache-list and track their keep-alive timeout. If packet-processor receive ask message it send SYSV IPC message to event-processor, which delete confirmed packet from list. If socket processor detect server overloading (number of packets in first pipe exeeds limit) it fork special children with limited livetime this children read packets from pipe and send "busy" reply. This special children called "Busy processor" - it doesn't use any blocking call and can help if server are flooded.