Presentation is loading. Please wait.

Presentation is loading. Please wait.

Code Development for High Performance Servers Topics Multithreaded Servers Event Driven Servers Example - Game Server code (Quake) A parallelization exercise.

Similar presentations


Presentation on theme: "Code Development for High Performance Servers Topics Multithreaded Servers Event Driven Servers Example - Game Server code (Quake) A parallelization exercise."— Presentation transcript:

1 Code Development for High Performance Servers Topics Multithreaded Servers Event Driven Servers Example - Game Server code (Quake) A parallelization exercise for game server code

2 – 2 – Goals Maximize server utilization and decrease its latency. Server process doesn’t block! Robust under heavy loads. Relatively easy to develop.

3 – 3 – One thread per request executing the request handler. Each thread is listening on a socket A thread blocking on I/O doesn’t block the server. Ex: Apache, MySql. Request Handler A B C Function Calls Multi-threaded Servers

4 – 4 – Multi-threaded Servers (Cont.) Advantages: + Relatively easy to develop.Disadvantages: Poor performance. Poor performance. Thread scheduling. Context switching. Doesn’t scale. Doesn’t scale. Under heavy load, many threads would be created exhausting kernel’s memory, crashing the server.

5 – 5 – Single thread (event loop). + High performance. + Scalable/Robust. -Hard to write Event Driven Servers Event Loop A1 B1 C1 A2 B2 C2 “Blocking” operation

6 – 6 – Background: AIO Asynchronous I/O mainly used for disk reads/writes. Issue disk request and return immediately without blocking for results. On completion an event is raised.

7 – 7 – Single thread (event loop). Hard to write (server can’t block !) -AIO operations. -Requests (events) put in Event Queue. -Continuations (for requests) - When receiving a reply Event Driven Servers (cont) Event Loop A1 B1 C1 A2 B2 C2 “Blocking” operation

8 – 8 – Summary YesNo High Performance NoYes Thread / request? NoYes >1 thread Zeus Web Server Apache, MySQL Examples NoYes “Easy” to build YesNoScalable Event Driven Multi- Threaded


Download ppt "Code Development for High Performance Servers Topics Multithreaded Servers Event Driven Servers Example - Game Server code (Quake) A parallelization exercise."

Similar presentations


Ads by Google