The Web Stack for Dummies (like me)


pancake stacks are better than web stacks

Let’s follow some bytes as they make the journey from their source server  to a client system over HTTP.

  1. Server Hardware
  2. Server Software
  3. Script + Web Page Markup
  4. Routing Hardware/Network
  5. Client Browser
  6. Client Hardware

Choice layers explained

Server Software

  • App Server
    • Logic/Algorithm
    • Web Framework
    • ORM
    • Database
  • Web Server (Reverse Proxy)

The App Server creates the dynamic web content for a site and is the culmination of customized logic that leverages a web framework, ORM, and database to serve up web pages.

Web Framework defined:

A Ruby framework is collection of pre-written libraries, functions and controls that can be downloaded and used to make your programming task easier. In addition to a time saving, there is also a significant benefit in terms of programming efficiency and implicitly a more consistent programming style (since so much is pre-defined, one begins to use or utilize the paradigm of the underlying framework when writing a program)

ORM defined:

Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.

Web server Reverse Proxy defined:

Another Web Server?

At this point you may be wondering why people are talking about using Apache or Nginx in their stack. Don’t we already have a web server? We do, but the Ruby app server is not a full-featured web server, and it’s not very good at sending images and other kinds of static files (in fact all app servers are terrible at this, which is why it’s better to call them “app servers” than “web servers,” though the two terms are often used interchangeably). So what we want to do is use a general purpose web server for static files, and pass other requests along to our app server.

This is one of the most complicated and least standardized parts of Ruby web app configuration. Serving static files and handing off requests doesn’t take much processor power, so for a small web site our web server shouldn’t be too busy. The app server, on the other hand, is running our complicated Ruby application, and could be quite busy. For this reason one usually deploys multiple app servers (listening on different ports) for the web server to choose from when a request comes in. The process of handing requests off to these servers is called reverse proxy.

(If you’ve worked for a large company you’re probably familiar with accessing the Internet through a forward proxy server. Forward proxy is for outbound—client-side—requests, reverse proxy is for inbound—server-side—requests.)

Ron called out an incorrect mixing of layers, so here’s a shot at clearing up the discrepancy.
Script + Web Page Markup

  • content (text, audio, video)
  • Graphics, Image editing
  • CSS styling
  • scripting (Javascript/AJAX)
  • HTML page

Routing Hardware/Network Layer
Client Browser

  • script interpreted at Client side (Javascript/AJAX)
  • final HTML page rendered and interpreted

Simple Example of Server Software

Sinatra (framework) using Datamapper (ORM) with Sqlite (database) & Thin (web server)

References:

  • The last time I talked about HTTP details was a Peer 2 Peer notion
  • Alex Reisner’s Anatomy of a Ruby Web Application
  • I was happy to get additional inspiration for this post from this SoloSignal.com post after a little searching. Here’s Solo’s web stack:
    1. Physical Server and Infrastructure
    2. Web Server Software
    3. Database Management System
    4. Business Logic Programming
    5. HTML and Markup
    6. Cascading Style Sheets
    7. Graphic Design
    8. Client-side Scripting
Enhanced by Zemanta
Share and Enjoy:
  • Digg
  • Facebook
  • Google Bookmarks
  • HackerNews
  • Reddit
  • StumbleUpon
  • Twitter

About Mark Essel

I’m Mark Essel, a dataminer & systems engineer that’s added cofounder, web developer and author to my bag of tricks. My quest is to rediscover my life’s passions, and leverage that drive into profitable business ventures.
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.
  • http://steamcatapult.com/ Dave Pinsen

    Figures you'd post that pic when I'm on Atkins. :)

  • http://www.victusspiritus.com/ Mark Essel

    Darn this post title. Finally satisfied my pancake craving at IHOP last night.

  • Ron E Wolf

    i don't know if you want nerdy discussion on this. if so, your layer
    3. Web Page Markup, HTML
    isn't really a layer in the sense that you are using it. instead HTML (and Flash & pdf & javascript … are more of a transport here. the overwhelming % of HTML (etc) is generated by apps running in the app server (i think what you refer to as logic). also, there is an increasingly thick app layer (javascript, flash, java, …) running on the client. yes, in the browser container, but, a critical and significant layer, it 'should' get a layer of its own.

    ____________Ron Wolf

  • http://www.victusspiritus.com/ Mark Essel

    First off-> always appreciate nerdy discussion, thanks for bringing it you pointed out some wrongness which is awesome.

    I need to rethink the layers I describe, which is great for posts. I didn't give enough attention to the Client Browser, which includes some of what you refer to.

    Fixing it now.

blog comments powered by Disqus