1 / 44

APACHE WEBSERVER

Learn about Apache web server, different components of system architecture, client-server interaction, and accessing web servers. Understand the features of Apache web server such as scalability, reliability, and stability.

stodd
Download Presentation

APACHE WEBSERVER

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. APACHE WEBSERVER

  2. Introduction • Web server • Responds to client requests by providing resources • URI (Uniform Resource Identifier) • Web server and client communicate with platform-independent Hypertext Transfer Protocol (HTTP)

  3. WEB SERVERS

  4. HTTP Request Types • Request methods • get • post • Retrieve and send client form data to Web server • Post data to a server-side form handler

  5. System Architecture • Multi-tier application (n-tier application) • Information tier (data or bottom tier) • Maintains data for the application • Stores data in a relational database management system (RDBMS) • Middle tier • Implements business logic and presentation logic • Control interactions between application clients and application data • Client tier (top tier) • Application’s user interface • Users interact directly with the application through the client tier

  6. Client-Side Scripting versus Server-Side Scripting • Client-side scripts • Validate user input • Reduce requests needed to be passed to server • Access browser • Enhance Web pages with DHTML, ActiveX controls, and applets • Server-side scripts • Executed on server • Generate custom response for clients • Wide range of programmatic capabilities • Access to server-side software that extends server functionality

  7. Accessing Web Servers • Request documents from Web servers • Host names • Local Web servers • Access through machine name or localhost • Remote Web servers • Access through machine name • Domain name or Internet Protocol (IP) address • Domain name server (DNS) • Computer that maintains a database of host names and their corresponding IP address

  8. What makes a good Web Server? • Correctness • Reliability • Scalability • Stability • Speed

  9. Correctness • Does it conform to the HTTP specification? • Does it work with every browser? • Does it handle erroneous input gracefully?

  10. Reliability • Can you sleep at night? • Are you being paged during dinner? • It is an appliance?

  11. Scalability • Does it handle nominal load? • Have you been Slashdotted? • And did you survive? • What is your peak load?

  12. Speed (Latency) • Does it feel fast? • Do pages snap in quickly? • Do users often reload pages?

  13. Apache the General Purpose Webserver Apache developers strive forcorrectness first, andspeed second.

  14. Apache Web Server • Currently the most popular Web server • Stability • Efficiency • Portability • Open-source

  15. Apache 1.3 • Fast enough for most sites • Particularly on 1 and 2 CPU systems.

  16. Apache 2.0 • Adds more features • filters • threads • portability (has excellent Windows support) • Scales to much higher loads.

  17. Apache HTTP ServerArchitecture Overview

  18. Classic “Prefork” Model • Apache 1.3, and • Apache 2.0 Prefork • Many Children • Each child handles one connection at a time. Parent Child Child Child … (100s)

  19. Multithreaded “Worker” Model • Apache 2.0 Worker • Few Children • Each child handles many concurrent connections. Parent Child Child Child … (10s) 10s of threads

  20. Dynamic Content: Modules • Extensive API • Pluggable Interface • Dynamic or Static Linkage

  21. In-process Modules • Run from inside the httpd process • CGI (mod_cgi) • mod_perl • mod_php • mod_python • mod_tcl

  22. Out-of-process Modules • Processing happens outside of httpd (eg. Application Server) • Tomcat • mod_jk/jk2, mod_jserv • mod_proxy • mod_jrun Parent Tomcat Child Child Child

  23. Architecture: The Big Picture Parent 100s of threads 10s of threads Tomcat Child Child Child … (10s) DB mod_jk mod_rewrite mod_php mod_perl

  24. “HTTP” • HyperText Transfer Protocol A network protocol used to communicate between web servers and web clients (eg. a Web Browser).

  25. “Request” and “Response” Request • Web browsers request pages and web servers respond with the result. • Multi-Processing Module • An MPM defines how the server will receive and manage incoming requests. • Allows OS-specific optimizations. • Allows vastly different server models (eg. threaded vs. multiprocess). Response Web Browser(Mosaic) Web Server (Apache)

  26. “Client” • Single HTTP connection (eg. web browser). • Note that many web browsers open up multiple connections. Apache considers each connection uniquely. Web Browser(Mosaic) Web Server (Apache)

  27. “Thread” • In multi-threaded MPMs (eg. Worker). • Each thread handles a single connection. • Allows Children to handle many connections at once.

  28. Apache Configuration httpd.conf walkthrough

  29. Prefork MPM • Apache 1.3 and Apache 2.0 Prefork • Each child handles one connection at a time • Many children • High memory requirements • “You’ll run out of memory before CPU”

  30. Prefork Directives (Apache 2.0) • StartServers- The number of child processes to create at start-time • MinSpareServers-The minimum number of idle children to have at any time • MaxSpareServers-The maximum number of idle children to have at any time • MaxClients-The maximum number of concurrent client connections to allow at any time • MaxRequestsPerChild-The maximum number of requests that each child is allowed to serve before it must terminate and be replaced. Useful for starting with a clean slate every once in awhile, and particular useful for buggy 3rd party modules that leak precious system resources

  31. Worker MPM • Apache 2.0 and later • Multithreaded within each child • Dramatically reduced memory footprint • Only a few children (fewer than prefork)

  32. Worker Directives • MinSpareThreads • MaxSpareThreads • ThreadsPerChild • MaxClients • MaxRequestsPerChild

  33. KeepAlive Requests • Persistent connections • Multiple requests over one TCP socket • Directives: • KeepAlive • MaxKeepAliveRequests • KeepAliveTimeout

  34. Apache 1.3 and 2.0Performance Characteristics Multi-process, Multi-threaded, or Both?

  35. Prefork • High memory usage • Highly tolerant of faulty modules • Highly tolerant of crashing children • Fast • Well-suited for 1 and 2-CPU systems • Tried-and-tested model from Apache 1.3 • “You’ll run out of memory before CPU.”

  36. Worker • Low to moderate memory usage • Moderately tolerant to faulty modules • Faulty threads can affect all threads in child • Highly-scalable • Well-suited for multiple processors • Requires a mature threading library(Solaris, AIX, Linux 2.6 and others work well) • Memory is no longer the bottleneck.

  37. Benchmarking Metrics • What are we interested in testing? • Recall that we want our web server to be • Correct • Reliable • Scalable • Stable • Fast

  38. Benchmarking Metrics: Correctness • No errors • No data corruption • Protocol compliant • Should not be an everyday concern for admins

  39. Benchmarking Metrics: Reliability • MTBF - Mean Time Between Failures • Difficult to measure programmatically • Easy to judge subjectively

  40. Benchmarking Metrics: Scalability • Predicted concurrency • Maximum concurrent connections • Requests per Second (rps) • Concurrent Users

  41. Benchmarking Metrics:Stability • Consistency, Predictability • Errors per Thousand • Correctness under Stress • Never returns invalid information • Common problem with custom web-apps • Works well with 10 users, but chokes on 1000.

  42. Benchmarking Metrics:Speed • Requests per Second (rps) • Latency • time until connected • time to first byte • time to last byte • time to close • Easy to test with current tools • Highly related to Scalability/Concurrency

  43. Web Resources • www.microsoft.com/msdownload/ntoptionpack/askwiz.asp • www.w3.org/Protocols • www.apache.org • httpd.apache.org • httpd.apache.org/docs-2.0 • www.apacheweek.com • linuxtoday.com/stories/18780.html • www.iisanswers.com • www.iisadministrator.com

  44. The End Thank You!

More Related