Your SlideShare is downloading. ×
0
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Choosing a Web Architecture for Perl

7,680

Published on

This talk was presented at OSCON 2009 and YAPC::NA 2009. The choices discussed here are still relevant, although Plack has opened up some new options. For a more up-to-date take on this material I …

This talk was presented at OSCON 2009 and YAPC::NA 2009. The choices discussed here are still relevant, although Plack has opened up some new options. For a more up-to-date take on this material I would recommend Tatsuhiko Miyagawa's most recent Plack/PSGI talks.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
7,680
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Choosing a Web Architecture for Perl Perrin Harkins We Also Walk Dogs
  • 2. This used to be an easy decision <ul><li>Netscape, or Apache for you hippies
  • 3. CGI, or NSAPI if you enjoy core dumps </li></ul>
  • 4. Server-side development matured, and it stayed easy <ul><li>Apache became the standard web server
  • 5. mod_perl became the way to run Perl
  • 6. FastCGI was looking peaky </li><ul><li>Outside of Amazon's reality distortion field anyway </li></ul></ul>
  • 7. Then two things happened <ul><li>Ruby came along </li><ul><li>Renewed interest in FastCGI
  • 8. Thanks, Ruby! </li></ul><li>Non-blocking I/O became fashionable </li><ul><li>Memcached
  • 9. Lighttpd
  • 10. Nginx </li></ul></ul>
  • 11. Now we have many choices <ul><li>Web servers </li><ul><li>Apache
  • 12. Lighttpd
  • 13. Nginx
  • 14. Squid
  • 15. Perlbal
  • 16. Varnish </li></ul></ul><ul><li>Protocols </li><ul><li>FastCGI
  • 17. HTTP
  • 18. SCGI </li></ul></ul>
  • 19. FastCGI <ul><li>Many implementations for different servers
  • 20. Daemons are managed by the web server or an external process
  • 21. Has hooks for auth, logging, and filtering, but not always implemented and rarely used </li></ul>
  • 22. HTTP <ul><li>Reverse proxy forwards HTTP requests to apache/mod_perl backend </li></ul>
  • 23. SCGI <ul><li>”Simple CGI”
  • 24. Stealing good ideas from Python
  • 25. Simpler than FastCGI, so theoretically could be faster </li></ul>
  • 26. The graveyard of alternative Perl daemons <ul><li>SpeedyCGI
  • 27. PersistentPerl
  • 28. Both replace the #! line and daemonize your program </li></ul>
  • 29. Biases <ul><li>Long-time mod_perl contributor
  • 30. Member of Apache Software Foundation </li></ul>Don't believe a word I say!
  • 31. Apache 2.2 mod_proxy + mod_perl <ul><li>Frontend apache runs threaded worker MPM
  • 32. Backend apache runs prefork MPM
  • 33. All popular apache modules (mod_ssl, mod_rewrite, mod_security, mod_deflate, caching, auth) are available
  • 34. mod_proxy_balancer provides load balancing </li></ul>
  • 35. Apache 2.2 mod_fastcgi <ul><li>Frontend runs threaded worker MPM
  • 36. As with mod_proxy, all popular apache modules are available
  • 37. Three poorly-named configurations: </li><ul><li>”Static” starts a set number of procs at server startup
  • 38. ”Dynamic” starts a new proc every time it gets a request up to a configured limit
  • 39. ”Standalone” sends requests to daemon you start </li></ul></ul>
  • 40. Apache 2.2 mod_fastcgi <ul><li>Can run separate versions of same package name in separate daemons </li><ul><li>True for mod_perl too if you run multiple backends, but less obvious </li></ul><li>Seamless restart for code upgrades in standalone mode </li><ul><li>Start a new set of procs on same socket and shut down the old ones
  • 41. Could get close with two mod_perl backends, but not simple </li></ul></ul>
  • 42. Lighttpd mod_fastcgi <ul><li>Non-blocking I/O server
  • 43. Supports static and standalone FastCGI
  • 44. Supports Authorizer role
  • 45. Solid selection of modules with equivalents of most popular apache ones
  • 46. Same restart advantages as FastCGI on Apache
  • 47. Load balancing across FastCGI daemons </li></ul>
  • 48. Lighttpd mod_scgi <ul><li>Same Lighttpd, different protocol
  • 49. Sketchy docs </li></ul>
  • 50. nginx FastCGI <ul><li>Another non-blocking I/O server
  • 51. Supports standalone FastCGI only
  • 52. Does not support Authorizer role
  • 53. Good module selection
  • 54. Same restart advantages </li></ul>
  • 55. nginx proxy + mod_perl <ul><li>Load balancing </li></ul>
  • 56. What about running naked mod_perl? <ul><li>Static requests
  • 57. Buffering for slow clients
  • 58. Keep-Alive </li></ul>
  • 59. Benchmark methodology <ul><li>Very simple Catalyst app </li><ul><li>Sleeps for 0.1 seconds
  • 60. Returns 35K of HTML (perl.com homepage) </li></ul><li>Brief run of ab (Apache Bench) with intended concurrency to warm up server
  • 61. ab tests at concurrency of 10, 50, 150, 200 </li></ul>
  • 62. General findings <ul><li>FastCGI static mode is difficult to use with apache/mod_fastcgi </li><ul><li>Trial and error to find magic number
  • 63. Worked better with Lighttpd </li></ul><li>FastCGI standalone mode is unusable on Lighttpd </li><ul><li>Load balancing feature marks daemons as down if they're too busy to answer right away and rejects requests </li></ul><li>SCGI Perl implementations incomplete </li></ul>
  • 64. Benchmark results
  • 65. Not really apples to apples <ul><li>mod_perl does other things
  • 66. Filters on non-perl content (PHP, etc.)
  • 67. Customize server and request phases
  • 68. Replace HTTP with your own protocol </li><ul><li>Apache 2 + mod_perl 2 is a server kit </li></ul></ul>
  • 69. Thanks! And please help me add more servers...

×