and zooming in for additional detail on the second level Web apps are

And zooming in for additional detail on the second

This preview shows page 82 - 84 out of 517 pages.

and zooming in for additional detail on the second level, Web apps are structured as three
Image of page 82
logical tiers . The presentation tier usually consists of an HTTP server (or simply “ Web server ”), which accepts requests from the outside world (i.e., users) and usually serves static assets. We’ve been using WEBrick to fulfill that role. Because application servers sit between the Web server (presentation tier) and your actual app code, they are sometimes referred to as middleware . The web server forwards requests for dynamic content to the logic tier , where the actual application runs that generates dynamic content. The application is typically supported by an application server whose job is to hide the low-level mechanics of HTTP from the app writer. For example, an app server can route incoming HTTP requests directly to appropriate pieces of code in your app, saving you from having to listen for and parse incoming HTTP requests. Modern application servers support one or more Web application frameworks that simplify creation of a particular class of Web applications in a particular language. We will be using the Rails framework and the Rack application server, which comes with Rails. WEBrick can “speak” to Rack directly; other Web servers such as Apache require additional software modules to do so. If you were writing in PHP, Python, or Java, you would use an application server that handles code written in those languages. For example, Google AppEngine, which runs Python and Java applications, has proprietary middleware that bridges your app’s Python or Java code to the Google-operated infrastructure that faces the outside world. Finally, since HTTP is stateless, application data that must remain stored across HTTP requests, such as session data and users’ login and profile information, is stored in the persistence tier . Popular choices for the persistence tier have traditionally been databases such as the open-source MySQL or PostgreSQL, although prior to their proliferation, commercial databases such as Oracle or IBM DB2 were also popular choices. LAMP. Early SaaS sites were created using the Perl and PHP scripting languages, whose availability coincided with the early success of Linux, an open-source operating system, and MySQL, an open-source database. Thousands of sites are still powered by the LAMP Stack —Linux, Apache, MySQL, and PHP or Perl. The “tiers” in the three-tier model are logical tiers. On a site with little content and low traffic, the software in all three tiers might run on a single physical computer. In fact, RottenPotatoes has been doing just this: its presentation tier is just WEBrick, and its persistence tier is a simple open-source database called SQLite, which stores its information directly in files on your local computer. In production, it’s more common for each tier to span one or more physical computers. As Figure 2.7 shows, in a typical site, incoming HTTP requests are directed to one of several Web servers, which in
Image of page 83
Image of page 84

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors