SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Using Apache as an
Application Server
    Phillip J. Windley, Ph.D.
       Founder and CTO
             Kynetx
Assumptions
You’ve heard of Apache
You’ve heard of Perl
You’d like to build Web applications with less
effort
Anti-Assumptions
You’re familiar with mod_perl
You’re an Apache expert
You know what an application ser ver is and
why you’d want one
Application Server
Program that supplies support for running
applications:
  Process and thread management
  Security
  Logging
  Interprocess communication
  Request dispatching
Popular Application Ser vers

You might have heard of
  Tomcat
  JBoss
  WebLogic
  WebSphere
Application Server Benefits
  Flexibility through indirection (intermediary)
  Resource management
  Focused developer roles
  Maintainability
  Security
  Scalability
  Feature augmentation
Kynetx
Context automation
  services to link tasks
across multiple Web-sites
Dynamically rearrange the
 DOM (post-delivery) based
on client supplied rules, Web
   services, and browser
           context
Rule Language
rule frequent_archive_visitor is active {
    select using "/archives/d+/d+/" setting ()

      pre {
        c = counter.archive_pages;
      }

      if counter.archive_pages > 2 within 3 days then {
        replace_html("prize_div",
           "You win the prize! You've seen " +
           c +
           " pages from the archives!")
      }

      fired {
        clear counter.archive_pages;
      } else {
        counter.archive_pages += 1 from 1;
      }

  }
Kynetx Information Flow
We need a rule
 interpreter that
dynamically serves
    Javascript
Rule execution must
be as fast as possible
Amazon AWS
  deployment and
scaling a necessity
Possible Architectures

Standard Web application
Custom HTTP server
Apache module
Architecture Decisions

Implement rule interpreter as an
Apache module
No database for scalability
No session pinning
Store rules in versioned repository
Detailed Architecture
Apache as an
Application Server
Apache
Fast and efficient
Portable
Well supported
Won’t go away (open source)
Stable and reliable
Plenty of features
Extensible
Easy to administer
Apache Modules
Modules are NOT CGI Programs
   Modules run inside the Apache process
   architecture
   Modules have access to and can replace
   all Apache ser vices
   Uses the ser ver API - not an embedded
   interpreter
   Access to every part of the HTTP
   request lifecycle
Apache Server Lifecycle
HTTP Request Lifecycle
We’ve got both kinds:
      C & Perl!
Apache Application Ser vices
 Configuration
 Process and thread management
 Security
 Logging
 Interprocess communication
 Request dispatching
Configuration Support


Via Apache configuration file
Setting variables that can be seen in Perl
$r->dir_config('memcached_hosts')
Configuration
<LocationMatch /kobj/>
 # env var to turn on rule logging
 PerlSetEnv KOBJ 1

 # host names
 PerlSetVar init_host init
 PerlSetVar log_host logger
 PerlSetVar action_host cs
 PerlSetVar frag_host frag

 # mode => development, production, test
 PerlSetVar run_mode development

 PerlSetVar memcached_hosts 192.168.2.2
 PerlAddVar memcached_hosts 192.168.2.3

 SetHandler perl-script
 PerlHandler Kynetx # Perl module name
</LocationMatch>
Process & Thread Management
Apache 2.X uses multi-processing modules
(MPMs) to provide a flexible way to change the
execution model
  prefork - Apache 1.3
  worker - Hybrid, based on pthreads
  OS specific - Windows, BeOS, etc.
  perchild - virtual hosts with custom UID’s
Process & Thread Management

 <IfModule prefork.c>
 StartServers          5
 MinSpareServers       8
 MaxSpareServers      15
 MaxClients         150
 MaxRequestsPerChild 0
 </IfModule>
Apache manages the
    processes
Start with one
process model and
switch to another
      later
Security
Apache HTTP access, authentication, and
authorization (AAA) isn’t very good for
people
HTTP AAA works fine for machines (usually)
Standard
  mod_auth
  mod_access
You can also override the AAA phases of the
HTTP request cycle
Avoid AAA code in
 your application
Interprocess Communication
 Lots of Perl Modules
  IPC::SysV
  IPC::Shareable
  IPC::Semaphore
  IPC::ShareLite
  Cache::Cache
  Apache::Session
Apache::Session
Apache::Session Example
my $mem_servers =
     Kynetx::Memcached::get_memcachedb_servers();
tie %{$session}, 'Apache::Session::Memcached', $cookie, {

     Servers => $mem_servers,

     NoRehash => 1,

     Readonly => 0,

     Debug => 1,

     CompressThreshold => 10_000
   };
return $session;
Logging

Apache has a great logging facility
   Use the standard Apache logging
   commands
Apache2::Log
Logging
LogFormat "%h %t %{TOTAL_SECS}e %{SITE}e %{TXN_ID}e "%{CALLER}e" %
{SID}e "%{REFERER}e" "%{TITLE}e" [%{RULE_NAMES}e] [%{RESULTS}e] [%
{ACTIONS}e] [%{TAGS}e] [%{LABELS}e] " KOBJ

CustomLog "|/web/sbin/cronolog --period=5 --symlink=/web/logs/
kynetx_log /web/logs/kynetx/KOBJ-%Y%m%d-%H%M.log" KOBJ env=KOBJ
Logging
$r->subprocess_env(SITE =>
    $request_info->{'site'});

$r->subprocess_env(RULE_NAMES =>

 join(',', @{ $rule_env->{'names'}}));

$r->subprocess_env(RESULTS =>

 join(',', @{ $rule_env->{'results'}}));
Request Dispatching

Request dispatching says what to do for
each URL or URL pattern
Turns out that Apache is really good at this
Request dispatching is known as “routes” in
Rails
Dispatch Example

Translate
http://example.com/news/20021031/09/index.html

to
http://example.com/perl/news?
date=20021031;id=09;page=index.html

before news sees it.
Three Methods

Use configuration file
Use mod_rewrite
Use custom Translation stage handler
   You can do anything you want here
Request Dispatching Example
<LocationMatch /kobj/>
 SetHandler perl-script
 PerlHandler Kynetx # Perl module name
</LocationMatch>

<LocationMatch /js/>
 SetHandler perl-script
 PerlHandler Kynetx::KOBJ # Perl module name
</LocationMatch>

<LocationMatch /cb/>
 SetHandler perl-script
 PerlHandler Kynetx::Callbacks # Perl module name
</LocationMatch>
What’s Missing?


Event monitoring
Timers
Long running processes
Other Tools You Might Use

  mod_header
  mod_deflate
  Authentication modules
  Authorization modules
The End




   46
Contact Information
Contact me
 phil@windley.org
 www.windley.com
 www.kynetx.com

Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
oazabir
 

Was ist angesagt? (20)

Introduction to Flask Micro Framework
Introduction to Flask Micro FrameworkIntroduction to Flask Micro Framework
Introduction to Flask Micro Framework
 
RESTful Web Applications with Apache Sling
RESTful Web Applications with Apache SlingRESTful Web Applications with Apache Sling
RESTful Web Applications with Apache Sling
 
MuleSoft ESB Filtering data instead of Looping
MuleSoft ESB Filtering data instead of LoopingMuleSoft ESB Filtering data instead of Looping
MuleSoft ESB Filtering data instead of Looping
 
Intro to Node
Intro to NodeIntro to Node
Intro to Node
 
RESTFul development with Apache sling
RESTFul development with Apache slingRESTFul development with Apache sling
RESTFul development with Apache sling
 
Tips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsTips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC Applications
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter LehtoJavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
 
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
 
Moving a Windows environment to the cloud - DevOps Galway Meetup
Moving a Windows environment to the cloud - DevOps Galway MeetupMoving a Windows environment to the cloud - DevOps Galway Meetup
Moving a Windows environment to the cloud - DevOps Galway Meetup
 
Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101Altitude SF 2017: Debugging Fastly VCL 101
Altitude SF 2017: Debugging Fastly VCL 101
 
Sinatra
SinatraSinatra
Sinatra
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
 
Powerhsell dsc for chef veterans
Powerhsell dsc for chef veteransPowerhsell dsc for chef veterans
Powerhsell dsc for chef veterans
 
Gruntwork Executive Summary
Gruntwork Executive SummaryGruntwork Executive Summary
Gruntwork Executive Summary
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
Firebase slide
Firebase slideFirebase slide
Firebase slide
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
 
How to connect AngularJS to servers
How to connect AngularJS to serversHow to connect AngularJS to servers
How to connect AngularJS to servers
 

Ähnlich wie Using Apache as an Application Server

C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityC# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
Darren Sim
 

Ähnlich wie Using Apache as an Application Server (20)

CloudConnect 2011 - Building Highly Scalable Java Applications on Windows Azure
CloudConnect 2011 - Building Highly Scalable Java Applications on Windows AzureCloudConnect 2011 - Building Highly Scalable Java Applications on Windows Azure
CloudConnect 2011 - Building Highly Scalable Java Applications on Windows Azure
 
App fabric introduction
App fabric introductionApp fabric introduction
App fabric introduction
 
Sun Web Server Brief
Sun Web Server BriefSun Web Server Brief
Sun Web Server Brief
 
Exposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using SwaggerExposing Salesforce REST Services Using Swagger
Exposing Salesforce REST Services Using Swagger
 
Sun Web Server Brief
Sun Web Server BriefSun Web Server Brief
Sun Web Server Brief
 
Automating Compliance with InSpec - AWS North Sydney
Automating Compliance with InSpec - AWS North SydneyAutomating Compliance with InSpec - AWS North Sydney
Automating Compliance with InSpec - AWS North Sydney
 
Apache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's NextApache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's Next
 
Divide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsDivide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.js
 
Building Scalable Applications with Laravel
Building Scalable Applications with LaravelBuilding Scalable Applications with Laravel
Building Scalable Applications with Laravel
 
Delivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWSDelivering High-Availability Web Services with NGINX Plus on AWS
Delivering High-Availability Web Services with NGINX Plus on AWS
 
DevOps and the Future of Enterprise Security
DevOps and the Future of Enterprise SecurityDevOps and the Future of Enterprise Security
DevOps and the Future of Enterprise Security
 
C# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access SecurityC# and ASP.NET Code and Data-Access Security
C# and ASP.NET Code and Data-Access Security
 
Automating AWS Compliance with InSpec
Automating AWS Compliance with InSpec Automating AWS Compliance with InSpec
Automating AWS Compliance with InSpec
 
Ecom 1
Ecom 1Ecom 1
Ecom 1
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
Servers names
Servers namesServers names
Servers names
 
Servers names
Servers namesServers names
Servers names
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
 
IT Operations for Web Developers
IT Operations for Web DevelopersIT Operations for Web Developers
IT Operations for Web Developers
 
Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula
 

Mehr von Phil Windley

Introducing Personal Event Networks
Introducing Personal Event NetworksIntroducing Personal Event Networks
Introducing Personal Event Networks
Phil Windley
 

Mehr von Phil Windley (20)

Trust, Blockchains, and Self-Soveriegn Identity
Trust, Blockchains, and Self-Soveriegn IdentityTrust, Blockchains, and Self-Soveriegn Identity
Trust, Blockchains, and Self-Soveriegn Identity
 
A University API
A University APIA University API
A University API
 
Rule Language for IoT
Rule Language for IoTRule Language for IoT
Rule Language for IoT
 
Events, Picos, and Microservices
Events, Picos, and MicroservicesEvents, Picos, and Microservices
Events, Picos, and Microservices
 
Picos, CloudOS, and Connecting Things
Picos, CloudOS, and Connecting ThingsPicos, CloudOS, and Connecting Things
Picos, CloudOS, and Connecting Things
 
Events, Picos, and Microservices
Events, Picos, and MicroservicesEvents, Picos, and Microservices
Events, Picos, and Microservices
 
Relationships: Modeling the Vehicle Ecosystem with Fuse
Relationships: Modeling the Vehicle Ecosystem with FuseRelationships: Modeling the Vehicle Ecosystem with Fuse
Relationships: Modeling the Vehicle Ecosystem with Fuse
 
Fuse 2
Fuse 2Fuse 2
Fuse 2
 
Connecting Things
Connecting ThingsConnecting Things
Connecting Things
 
Persistent Compute Objects and the Fabric of Cyberspace
Persistent Compute Objects and the Fabric of CyberspacePersistent Compute Objects and the Fabric of Cyberspace
Persistent Compute Objects and the Fabric of Cyberspace
 
Persistent Compute Objects - Picos
Persistent Compute Objects - PicosPersistent Compute Objects - Picos
Persistent Compute Objects - Picos
 
Fuse Technical Presentation
Fuse Technical PresentationFuse Technical Presentation
Fuse Technical Presentation
 
Personal Cloud Application Architectures
Personal Cloud Application ArchitecturesPersonal Cloud Application Architectures
Personal Cloud Application Architectures
 
Why Personal Clouds
Why Personal CloudsWhy Personal Clouds
Why Personal Clouds
 
Personal Cloud Operating Systems
Personal Cloud Operating SystemsPersonal Cloud Operating Systems
Personal Cloud Operating Systems
 
Introducing Personal Event Networks
Introducing Personal Event NetworksIntroducing Personal Event Networks
Introducing Personal Event Networks
 
The Live Web #SCITDA11 Keynote
The Live Web #SCITDA11 KeynoteThe Live Web #SCITDA11 Keynote
The Live Web #SCITDA11 Keynote
 
Shaping strategies and Startups
Shaping strategies and StartupsShaping strategies and Startups
Shaping strategies and Startups
 
Shaping Strategies and the Live Web - Kynetx Impact 2011
Shaping Strategies and the Live Web - Kynetx Impact 2011Shaping Strategies and the Live Web - Kynetx Impact 2011
Shaping Strategies and the Live Web - Kynetx Impact 2011
 
The Evented Web Makes Users Happy
The Evented Web Makes Users HappyThe Evented Web Makes Users Happy
The Evented Web Makes Users Happy
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Kürzlich hochgeladen (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Using Apache as an Application Server

Hinweis der Redaktion

  1. My book is about building IMAs