Rob Saccoccio robs@InfiniteTechnology.com FastCGI Rob Saccoccio robs@InfiniteTechnology.com.

Slides:



Advertisements
Similar presentations
IS 6116 Introduction – 10 Jan Lecturer Details Aonghus Sugrue Website: aonghussugrue.wordpress.com
Advertisements

Other Web Application Development Technologies. PHP.
CGI programming. Common Gateway Interface interface between web server and other programs (cgi scripts) information passed as environment variables passed.
M-V-C for web applications. Model for Web Applications model consists of data and system state database tables –persistent data session information –current.
FastCGI Rob Saccoccio
Lecture plan Information retrieval (from week 11)
Adding Dynamic Content to your Web Site
1 CGICGI Common Gateway Interface Server-side Programming Lecture.
Introduction to Computing Using Python CSC Winter 2013 Week 8: WWW and Search  World Wide Web  Python Modules for WWW  Web Crawling  Thursday:
PHP syntax basics. Personal Home Page This is a Hypertext processor It works on the server side It demands a Web-server to be installed.
1 Database Driven Web Application Clients Application Servers including web servers Database Server Traditional client-server (2-tier architecture): client:
Running PHP on Windows Server 2008 and IIS 7 Rob Cameron Developer Evangelist, Communications Sector Microsoft.
DT228/3 Web Development WWW and Client server model.
Java Servlet & JSP © copyright 2005 SNU OOPSLA Lab.
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services Matt Welsh, David Culler, and Eric Brewer Computer Science Division University of.
Servlets and a little bit of Web Services Russell Beale.
WEB1P servintro1 Introduction to servlets and JSP Dr Jim Briggs.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Web architecture Dr Jim Briggs Web architecture.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
Guide To UNIX Using Linux Third Edition
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Lecture 13 Dynamic Web Servers & Common Gateway Interface CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Session-01. What is a Servlet? Servlet can be described in many ways, depending on the context: 1.Servlet is a technology i.e. used to create web application.
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
PHP and MySQL Week#1  Course Plan.  Introduction to Dynamic Web Content.  Setting Up Development Server Eng. Mohamed Ahmed Black 1.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Server-side Technologies
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
Applets & Servlets.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
HTTP; The World Wide Web Protocol
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Beyond DHTML So far we have seen and used: CGI programs (using Perl ) and SSI on server side Java Script, VB Script, CSS and DOM on client side. For some.
Week 7 Lecture Web Database Development Samuel Conn, Asst. Professor
Nic Shulver, Intro: Developing Server Applications What is a server? Many types of server – File server – file: networked file.
Pradeep Tallogu Deepak Avanna Sharath Madathil
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
Webcommerce Computer Networks Webcommerce by Linnea Reppa Douglas Martindale Lev Shalevich.
10/20/2015 ©2006 Scott Miller, University of Victoria 1 Alternative Content Distribution Methods Non-CGI/SSI Content Serving.
Architecture of the web Client Server retrieved or generated web page.
1 CS122B: Projects in Databases and Web Applications Spring 2015 Notes 03: Web-App Architectures Professor Chen Li Department of Computer Science CS122B.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
RUBRIC IP1 Ruben Botero Web Design III. The different approaches to accessing data in a database through client-side scripting languages. – On the client.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.

David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
Lecture 19 Overview. Hyper Text Transfer Protocol HTTP is the protocol that supports communication between web browsers and web servers. – A “Web Server”
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
(ITI310) By Eng. BASSEM ALSAID SESSIONS 10: Internet Information Services (IIS)
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
Lect5.ppt - 02/23/06 CIS 4100 Systems Performance and Evaluation Lecture 6 by Zornitza Genova Prodanoff.
Lesson 11. CGI CGI is the interface between a Web page or browser and a Web server that is running a certain program/script. The CGI (Common Gateway Interface)
1 The Internet Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Java Server Pages Can web pages be created specially for each user?
CS122B: Projects in Databases and Web Applications Spring 2017
CS122B: Projects in Databases and Web Applications Winter 2017
CS 330 Class 7 Comments on Exam Programming plan for today:
WWW and HTTP King Fahd University of Petroleum & Minerals
Processes The most important processes used in Web-based systems and their internal organization.
CS122B: Projects in Databases and Web Applications Winter 2018
CS122B: Projects in Databases and Web Applications Spring 2018
Architecture of the web
CS122B: Projects in Databases and Web Applications Winter 2019
Information Retrieval and Web Design
Presentation transcript:

Rob Saccoccio robs@InfiniteTechnology.com FastCGI Rob Saccoccio robs@InfiniteTechnology.com

FastCGI is.. A language and server independent, scalable, open extension to CGI that provides high performance and persistence A protocol for data interchange between a web server and a FastCGI application The set of libraries that implement the protocol Enough of that ..

Web Server - CGI Relationship stdin CGI stdout stderr

Web Server - FastCGI Relationship full-duplex socket Server API based solutions embed the application in the web server. FastCGI Protocol

Backend FastCGI Server Web Server socket FastCGI Application socket Of course because TCP sockets can be used, the application doesn’t have to be cohosted with the webserver. This can be a big advantage if your web server is exposed and your application requires access to sensitive/protected data behind a firewall. If your application is really heavy and the goal is just to distribute it for performance purposes, you could certainly run it on the web server over Unix domain sockets as well. And of course you can see how this can continue to scale. FastCGI Protocol

Piles of Servers FastCGI Protocol Web Server socket FastCGI Application Using a DNS round-robin or another more sophisticated HTTP distribution approach you can have a pile of front-end web servers working with a pile of back-end FastCGI applications. Of course, this sort of capability isn’t unique to FastCGI, what makes it different and worthwhile is that its an open solution. FastCGI is totally reasonable request to make of a web server vendor. Of course, this crowd probably isn’t using anything but Apache or another open source solution so you could implement it there as well. Many of FastCGI applications interface to a database. The database(s) can run on another tier of servers. FastCGI Protocol

FastCGI Application Organization Initialization Response Loop { Response Handler }

Perl FCGI API accept() – Accepts a new FastCGI connection request, implicitly finishes the current request flush() – Flushes output buffers finish() – Finishes the current request finish() can be used to complete a request and perform other (maintenance related tasks between requests because the accept() is an implicit finish Lincoln Stein’s CGI module also can be used A new FCGI API is in the works that object oriented, its being developed to support Perl Threads.

Hello World - Perl use FCGI; $count = 0; while (FCGI::accept() == 0) { print "Content-type: text/html\r\n“, "\r\n“, "<h1>Hello World</h1>\n“, "Request “, ++$count, “ from server “, $ENV{'SERVER_NAME'}; } This too will do both CGI and FastCGI depending on how it was invoked.

Hello World – Perl, CGI.pm use CGI::Fast qw(:standard); $count = 0; while (new CGI::Fast) { print header, h1(“Hello World"), "Request “, ++$count, “ from server “, $ENV{'SERVER_NAME'}; } You can also use the object oriented CGI interface.

How Fast? What’s the fork/exec mean to performance? Compare a tiny fcgi_stdio application in both CGI and FastCGI mode. #include "fcgi_stdio.h“ main(void) { while (FCGI_Accept() == 0) { printf("Content-type: text/html\r\n“ "\r\n“ "<h1>FastCGI Hello</h1>"); } Apology for non-Perl. If there’s time, we can run a quick example.

Pretty Useless Statistics (PUS) Using Apache’s ab (Apache benchmark) program with 20 simultaneous requests, 100/1000 total requests Data represents the number of requests/sec tiny1 sleeps for 1 sec in the middle of handling 1tiny sleeps for one second at initialization tiny.c tiny1.c 1tiny.c Static File (968) CGI 184 16 13 FastCGI 516 1 409 Its how it works in the real world. Machine Stats: and idle PII 350, 128M, Apache 1.3.6 Much of the benefit of FastCGI isn’t literally in the “fast”. Its in the persistence and distributed nature. Someone recently wrote to the developers list: CGI is faster for sending large responses.. The difference in speeds between the CGI and FastCGI in tiny.c show the relevance of the fork()/exec().

Considerations How long will a typical request take? Are there any external dependencies? What type of load will the application have? How much data is sent to/from the client? Run as many processes/threads as you need Don’t send content if a redirect will do (e.g. banner ads) Both the module and the lib use 8K buffers. In the module there’s also the Apache buffers (4K).

Reasons for Using FastCGI No learning curve, everyone knows CGI Same binary works with Netscape, IIS, OpenMarket, and Apache Same code works across SPARC and Intel Allows mix-n-match OS/servers Choice of standard programming languages Flexible deployment No vendor tie or proprietary languages

Which Solution? Whether to use FastCGI, an embedded interpreter, a server API, or an application server depends on the project, personal experience and preferences. They’re all fast and persistent. Oreilly’s “Apache Modules” book provide a short but nice discussion of each of the approaches.

Summary FastCGI is a protocol and the set of libraries that implements it FastCGI provides a fairly low level toolkit for developing fast, persistent, and portable solutions

FastCGI Servers Apache - mod_fastcgi (free) http://www.fastcgi.com/ Zeus - http://www.zeustech.net/ Microsoft & Netscape – FastServ plug-in http://www.fastengines.com/

Links The FastCGI Home Page These slides http://www.fastcgi.com http://www.fastcgi.com/docs/OpenSource99 I’ll post these slides when I get back later in the week.