SlideShare une entreprise Scribd logo
1  sur  28
SYNCHORNOUS AND
ASYNCHROUS EXECUTION
(WEBSERVERS)
EWERE DIAGBOYA
SYNCHRONOUS EXECUTION
• Synchronous processes wait for one to complete before the
next begins
• When you execute something synchronously, you wait for it to
finish before moving on to another task. When you execute
something asynchronously, you can move on to another task
before it finishes.
ASYNCHRONOUS EXECUTION
• Asynchronous refers to processes that do not depend on each
other's outcome, and can therefore occur on different threads
simultaneously
• Asynchronous communication is the exchange of messages,
such as among the hosts on a network or devices in a
computer, by reading and responding as schedules permit
rather than according to some clock that is synchronized for
both the sender and receiver or in real time. It is usually used
to describe communications in which data can be transmitted
intermittently rather than in a steady stream.
SYNCHRONOUS & ASYNCHRONOUS
EXECUTION
SYNCHRONOUS
• You are in a queue to get a movie ticket. You cannot get one until
everybody in front of you gets one, and the same applies to the
people queued behind you.
ASYNCHRONOUS
• You are in a restaurant with many other people. You order your food.
Other people can also order their food, they don't have to wait for
your food to be cooked and served to you before they can order. In
the kitchen restaurant workers are continuously cooking, serving,
and taking orders. People will get their food served as soon as it is
cooked.
SIDE NOTE
• Although asynchronous workflow processes might process
faster, synchronous processing is sometimes preferred. If a
calling application depends on information from the workflow
process, you should run the process synchronously to ensure
that the calling application gets the information it needs from
the process before the workflow finishes and the application
closes.
WHAT IS A WEB SERVER
• A web server is an information technology that processes
requests via HTTP, the basic network protocol used to
distribute information on the World Wide Web. The term can
refer either to the entire computer system, an appliance, or
specifically to the software that accepts and supervises the
HTTP requests
WEB SERVERS
• Lighttpd (asynchronous)
• Apache * (synchronous)
• Nginx * (asynchronous)
• IIS (Internet Information Services) (synchronous)
• AWS Lambda (event, asynchronous), AWS Kinesis
• Apache Tomcat
APACHE WEB SERVER
The Apache HTTP Server, colloquially called Apache is the world's
most used web server software. Originally based on the NCSA
HTTPd server, development of Apache began in early 1995 after
work on the NCSA code stalled. Apache played a key role in the
initial growth of the World Wide Web, quickly overtaking NCSA
HTTPd as the dominant HTTP server, and has remained most
popular since April 1996. In 2009, it became the first web server
software to serve more than 100 million websites.
APACHE WEB SERVER
Instead of implementing a single architecture, Apache provides a
variety of MultiProcessing Modules (MPMs), which allow Apache
to run in a process-based, hybrid (process and thread) or event-
hybrid mode, to better match the demands of each particular
infrastructure.
But Apache slows down under heavy load, because of the need to
spawn new processes, thus consuming more computer memory.
It also creates new threads that must compete with others for
access to memory and CPU. Apache will also refuse new
connections when traffic reaches the limit of processes
configured by the administrator.
• Load Balancing
• Loadable Dynamic Modules
• User and Session tracking
• Concurrent connection limiting
• Embedded Perl, PHP and Lua scripting
• Custom logging with rotation
• Concurrent connection limiting
• Request processing rate limiting
• Bandwidth throttling
• Server Side Includes
• IP address-based geolocation
FEATURES: APACHE WEB SERVER
COMPANIES USING APACHE
NGINX
• Nginx was created to be both a web server and a proxy server.
• Nginx was built to solve the C10k problem
• Uses asynchronous, non-blocking, event-driven connection
handling algorithm.
• This style of connection processing allows Nginx to scale
incredibly far with limited resources. Since the server is single-
threaded and processes are not spawned to handle each new
connection, the memory and CPU usage tends to stay relatively
consistent, even at times of heavy load.
FEATURES: NGINX
• Handling of static files, index files and auto-indexing
• Reverse proxy with caching
• Load balancing with in-band health checks
• FastCGI, SCGI, uWSGI support with caching
• Name- and IP address-based virtual servers
• IPv6-compatible
• HTTP/2 and SPDY protocol support
• FLV and MP4 streaming
• Web page access authentication
• URL rewriting
• Concurrent connection limiting
• Request processing rate limiting
• Quora.com
• Appnexus
• Wix
• Montana
• Mulesoft
• NASA
• Groupon
• Zendesk
COMPANIES USING NGINX
WEB SERVER USAGE
MAY 2014 JUNE 2014
CONTRASTS BETWEEN APACHE AND NGINX
MODULES: APACHE
• Apache's module system allows you to dynamically load or
unload modules to satisfy your needs during the course of
running the server.
• The Apache core is always present, while modules can be turned
on or off, adding or removing additional functionality and
hooking into the main server.
• Apache uses this functionality for a large variety tasks. Due to
the maturity of the platform, there is an extensive library of
modules available.
• These can be used to alter some of the core functionality of the
server, such as ‘mod_php’ which embeds a PHP interpreter into
each running worker.
• Modules are not limited to processing dynamic content, they can
MODULES: NGINX
• Nginx also implements a module system, but it is quite different from
the Apache system.
• In Nginx, modules are not dynamically loadable, so they must be
selected and compiled into the core software.
• While distributions' packages tend to include the most commonly
used modules, if you require a non-standard module, you will have to
build the server from source yourself.
• Nginx modules are still very useful though, and they allow you to
dictate what you want out of your server by only including the
functionality you intend to use.
• Nginx modules allow many of the same capabilities as Apache
modules. For instance, Nginx modules can provide proxying support,
compression, rate limiting, logging, rewriting, geolocation,
• Apache servers can handle static content using its conventional
file-based methods. The performance of these operations is
mainly a function of the MPM methods described above.
• Apache can also process dynamic content by embedding a
processor of the language in question into each of its worker
instances. This allows it to execute dynamic content within the
web server itself without having to rely on external components.
These dynamic processors can be enabled through the use of
dynamically loadable modules.
• Apache's ability to handle dynamic content internally means that
configuration of dynamic processing tends to be simpler.
Communication does not need to be coordinated with an
additional piece of software and modules can easily be swapped
STATIC & DYNAMIC CONTENT: NGINX:
APACHE
• Nginx does not have any ability to process dynamic content natively. To
handle PHP and other requests for dynamic content, Nginx must pass to
an external processor for execution and wait for the rendered content to
be sent back. The results can then be relayed to the client.
• For administrators, this means that communication must be configured
between Nginx and the processor over one of the protocols Nginx knows
how to speak (http, FastCGI, SCGI, uWSGI, memcache). This can
complicate things slightly, especially when trying to anticipate the
number of connections to allow, as an additional connection will be used
for each call to the processor.
• However, this method has some advantages as well. Since the dynamic
interpreter is not embedded in the worker process, its overhead will only
be present for dynamic content. Static content can be served in a
straight-forward manner and the interpreter will only be contacted when
STATIC & DYNAMIC CONTENT: NGINX
• Apache provides a variety of multi-processing modules (Apache
calls these MPMs) that dictate how client requests are handled.
Basically, this allows administrators to swap out its connection
handling architecture easily. These are:
• mpm_prefork (our model)
• mpm_worker
• mpm_event (new implementation)
CONNECTION HANDLING: APACHE
This processing module spawns processes with a single thread
each to handle request. Each child can handle a single connection
at a time. As long as the number of requests is fewer than the
number of processes, this MPM is very fast. However, performance
degrades quickly after the requests surpass the number of
processes, so this is not a good choice in many scenarios. Each
process has a significant impact on RAM consumption, so this
MPM is difficult to scale effectively. This may still be a good choice
though if used in conjunction with other components that are not
built with threads in mind. For instance, PHP is not thread-safe, so
this MPM is recommended as the only safe way of working with
‘mod_php’, the Apache module for processing these files.
CONNECTION HANDLING: APACHE:
MPM_PREFORK
This module is similar to the worker module in most situations,
but is optimized to handle keep-alive connections. When using the
worker MPM, a connection will hold a thread regardless of whether
a request is actively being made for as long as the connection is
kept alive. The event MPM handles keep alive connections by
setting aside dedicated threads for handling keep alive
connections and passing active requests off to other threads. This
keeps the module from getting bogged down by keep-alive
requests, allowing for faster execution. This was marked stable
with the release of Apache 2.4.
CONNECTION HANDLING: APACHE:
MPM_EVENT
• Nginx spawns worker processes, each of which can handle
thousands of connections. The worker processes accomplish this
by implementing a fast looping mechanism that continuously
checks for and processes events. Decoupling actual work from
connections allows each worker to concern itself with a connection
only when a new event has been triggered.
• Each of the connections handled by the worker are placed within
the event loop where they exist with other connections. Within the
loop, events are processed asynchronously, allowing work to be
handled in a non-blocking manner. When the connection closes, it
is removed from the loop.
CONNECTION HANDLING: NGINX
APACHE & NGINX IMPLEMENTATION
• Looking at the features of both technologies we see the strength
of one can complement the weakness of the other.
• For great performance both technologies could be used hand in
hand
• Placing Nginx in front of Apache helps to leverage the fast
processing ability to handle large number of concurrent requests
• While Nginx is a good load balancer and better in delivery of static
content, apache has the internal functionality of processing
dynamic content (e.g. PHP) better
• Dynamic requests can be proxied to Apache by Nginx
• Nginx returns the process page back to the user/client
APACHE & NGINX IMPLEMENTATION (STATIC &
DYNAMIC)
server {
server_name .example.com;
root /home/example.com/www;
[...]
location ~* .php.$ {
# Proxy all requests with an URI ending with .php*
# (includes PHP, PHP3, PHP4, PHP5...)
proxy_pass http://127.0.0.1:8080;
}
location / {
# Your other options here for static content
# for example cache control, alias...
expires 30d;
}
}
FILES THAT REQUIRE PROCESSING BEFORE BEING SENT TO THE CLIENT, SUCH AS PHP, PERL, AND
RUBY SCRIPTS, WILL BE SERVED BY APACHE
GOING CLOUD …..
• AWS; AWS Lambda
• A Lambda function and an event source are the core
components that you use when you work with AWS Lambda.
Event sources publish events, and a Lambda function is the
custom code that you write to process the events that
automatically gets invoked in response to events. In addition,
you can invoke your Lambda function directly over HTTPS or
using AWS SDKs.
THANK YOU

Contenu connexe

Tendances

Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsJonas Bonér
 
... No it's Apache Kafka!
... No it's Apache Kafka!... No it's Apache Kafka!
... No it's Apache Kafka!makker_nl
 
Kafka as Message Broker
Kafka as Message BrokerKafka as Message Broker
Kafka as Message BrokerHaluan Irsad
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Tool Academy: Web Archiving
Tool Academy: Web ArchivingTool Academy: Web Archiving
Tool Academy: Web Archivingnullhandle
 
AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...
AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...
AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...Lucas Jellema
 
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...Bob Pusateri
 
Scaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsScaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsAchievers Tech
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013mumrah
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaJeff Holoman
 
What's New in NGINX Plus R7?
What's New in NGINX Plus R7?What's New in NGINX Plus R7?
What's New in NGINX Plus R7?NGINX, Inc.
 
Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionJoel Koshy
 
The best of Apache Kafka Architecture
The best of Apache Kafka ArchitectureThe best of Apache Kafka Architecture
The best of Apache Kafka Architecturetechmaddy
 

Tendances (17)

Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
... No it's Apache Kafka!
... No it's Apache Kafka!... No it's Apache Kafka!
... No it's Apache Kafka!
 
Kafka as Message Broker
Kafka as Message BrokerKafka as Message Broker
Kafka as Message Broker
 
HTTP/2 Prioritization
HTTP/2 PrioritizationHTTP/2 Prioritization
HTTP/2 Prioritization
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Tool Academy: Web Archiving
Tool Academy: Web ArchivingTool Academy: Web Archiving
Tool Academy: Web Archiving
 
Http2 in practice
Http2 in practiceHttp2 in practice
Http2 in practice
 
Message queues
Message queuesMessage queues
Message queues
 
AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...
AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...
AMIS SIG - Introducing Apache Kafka - Scalable, reliable Event Bus & Message ...
 
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
Select Stars: A SQL DBA's Introduction to Azure Cosmos DB (SQL Saturday Orego...
 
Scaling High Traffic Web Applications
Scaling High Traffic Web ApplicationsScaling High Traffic Web Applications
Scaling High Traffic Web Applications
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
What's New in NGINX Plus R7?
What's New in NGINX Plus R7?What's New in NGINX Plus R7?
What's New in NGINX Plus R7?
 
Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolution
 
The best of Apache Kafka Architecture
The best of Apache Kafka ArchitectureThe best of Apache Kafka Architecture
The best of Apache Kafka Architecture
 

En vedette

InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VM
InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VMInspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VM
InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VMmhelmich
 
HipHop Virtual Machine
HipHop Virtual MachineHipHop Virtual Machine
HipHop Virtual MachineRadu Murzea
 
Php Extensions for Dummies
Php Extensions for DummiesPhp Extensions for Dummies
Php Extensions for DummiesElizabeth Smith
 
HHVM and Hack: A quick introduction
HHVM and Hack: A quick introductionHHVM and Hack: A quick introduction
HHVM and Hack: A quick introductionKuan Yen Heng
 
Hack/HHVM 入門
Hack/HHVM 入門Hack/HHVM 入門
Hack/HHVM 入門y-uti
 

En vedette (9)

Hack and HHVM
Hack and HHVMHack and HHVM
Hack and HHVM
 
InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VM
InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VMInspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VM
InspiringCon14: ElePHPants on speed: Running TYPO3 Flow on HipHop VM
 
Hiphop - PHP
Hiphop - PHPHiphop - PHP
Hiphop - PHP
 
HipHop Virtual Machine
HipHop Virtual MachineHipHop Virtual Machine
HipHop Virtual Machine
 
Php Extensions for Dummies
Php Extensions for DummiesPhp Extensions for Dummies
Php Extensions for Dummies
 
HHVM Hack
HHVM HackHHVM Hack
HHVM Hack
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
 
HHVM and Hack: A quick introduction
HHVM and Hack: A quick introductionHHVM and Hack: A quick introduction
HHVM and Hack: A quick introduction
 
Hack/HHVM 入門
Hack/HHVM 入門Hack/HHVM 入門
Hack/HHVM 入門
 

Similaire à webservers

Web servers presentacion
Web servers presentacionWeb servers presentacion
Web servers presentacionKiwi Science
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640LLC NewLink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Midwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMidwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMathew Beane
 
Apache frameworks for Big and Fast Data
Apache frameworks for Big and Fast DataApache frameworks for Big and Fast Data
Apache frameworks for Big and Fast DataNaveen Korakoppa
 
Sanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansSanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansPeter Clapham
 
Coding For Cores - C# Way
Coding For Cores - C# WayCoding For Cores - C# Way
Coding For Cores - C# WayBishnu Rawal
 
VTU 6th Sem Elective CSE - Module 3 cloud computing
VTU 6th Sem Elective CSE - Module 3 cloud computingVTU 6th Sem Elective CSE - Module 3 cloud computing
VTU 6th Sem Elective CSE - Module 3 cloud computingSachin Gowda
 
HPC and cloud distributed computing, as a journey
HPC and cloud distributed computing, as a journeyHPC and cloud distributed computing, as a journey
HPC and cloud distributed computing, as a journeyPeter Clapham
 
Architecture of web servers
Architecture of web serversArchitecture of web servers
Architecture of web serversNicolas Vanhoren
 
Realtime traffic analyser
Realtime traffic analyserRealtime traffic analyser
Realtime traffic analyserAlex Moskvin
 
Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptxssuser35fdf2
 
haproxy-150423120602-conversion-gate01.pdf
haproxy-150423120602-conversion-gate01.pdfhaproxy-150423120602-conversion-gate01.pdf
haproxy-150423120602-conversion-gate01.pdfPawanVerma628806
 

Similaire à webservers (20)

Web servers presentacion
Web servers presentacionWeb servers presentacion
Web servers presentacion
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Midwest PHP - Scaling Magento
Midwest PHP - Scaling MagentoMidwest PHP - Scaling Magento
Midwest PHP - Scaling Magento
 
Async programming in c#
Async programming in c#Async programming in c#
Async programming in c#
 
Apache frameworks for Big and Fast Data
Apache frameworks for Big and Fast DataApache frameworks for Big and Fast Data
Apache frameworks for Big and Fast Data
 
Sanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansSanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticians
 
Flexible compute
Flexible computeFlexible compute
Flexible compute
 
Coding For Cores - C# Way
Coding For Cores - C# WayCoding For Cores - C# Way
Coding For Cores - C# Way
 
What is Serverless Computing?
What is Serverless Computing?What is Serverless Computing?
What is Serverless Computing?
 
VTU 6th Sem Elective CSE - Module 3 cloud computing
VTU 6th Sem Elective CSE - Module 3 cloud computingVTU 6th Sem Elective CSE - Module 3 cloud computing
VTU 6th Sem Elective CSE - Module 3 cloud computing
 
HPC and cloud distributed computing, as a journey
HPC and cloud distributed computing, as a journeyHPC and cloud distributed computing, as a journey
HPC and cloud distributed computing, as a journey
 
Architecture of web servers
Architecture of web serversArchitecture of web servers
Architecture of web servers
 
Realtime traffic analyser
Realtime traffic analyserRealtime traffic analyser
Realtime traffic analyser
 
Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptx
 
haproxy-150423120602-conversion-gate01.pdf
haproxy-150423120602-conversion-gate01.pdfhaproxy-150423120602-conversion-gate01.pdf
haproxy-150423120602-conversion-gate01.pdf
 
HAProxy
HAProxy HAProxy
HAProxy
 

Plus de Ewere Diagboya

AWS Well Architected Framework in Summary
AWS Well Architected Framework in SummaryAWS Well Architected Framework in Summary
AWS Well Architected Framework in SummaryEwere Diagboya
 
Serverless - Increasing software delivery
Serverless -  Increasing software deliveryServerless -  Increasing software delivery
Serverless - Increasing software deliveryEwere Diagboya
 
Logs, metrics and real time data analytics
Logs, metrics and real time data analyticsLogs, metrics and real time data analytics
Logs, metrics and real time data analyticsEwere Diagboya
 
Escrow & Payment Explosion in Africa
Escrow & Payment Explosion in AfricaEscrow & Payment Explosion in Africa
Escrow & Payment Explosion in AfricaEwere Diagboya
 

Plus de Ewere Diagboya (8)

DevOps lagos meetup
DevOps lagos meetupDevOps lagos meetup
DevOps lagos meetup
 
DevOps Demystified
DevOps DemystifiedDevOps Demystified
DevOps Demystified
 
AWS Well Architected Framework in Summary
AWS Well Architected Framework in SummaryAWS Well Architected Framework in Summary
AWS Well Architected Framework in Summary
 
Serverless - Increasing software delivery
Serverless -  Increasing software deliveryServerless -  Increasing software delivery
Serverless - Increasing software delivery
 
Logs, metrics and real time data analytics
Logs, metrics and real time data analyticsLogs, metrics and real time data analytics
Logs, metrics and real time data analytics
 
Digital Marketting
Digital MarkettingDigital Marketting
Digital Marketting
 
Escrow & Payment Explosion in Africa
Escrow & Payment Explosion in AfricaEscrow & Payment Explosion in Africa
Escrow & Payment Explosion in Africa
 
E1BX0VRZRB6PZ85
E1BX0VRZRB6PZ85E1BX0VRZRB6PZ85
E1BX0VRZRB6PZ85
 

webservers

  • 2. SYNCHRONOUS EXECUTION • Synchronous processes wait for one to complete before the next begins • When you execute something synchronously, you wait for it to finish before moving on to another task. When you execute something asynchronously, you can move on to another task before it finishes.
  • 3. ASYNCHRONOUS EXECUTION • Asynchronous refers to processes that do not depend on each other's outcome, and can therefore occur on different threads simultaneously • Asynchronous communication is the exchange of messages, such as among the hosts on a network or devices in a computer, by reading and responding as schedules permit rather than according to some clock that is synchronized for both the sender and receiver or in real time. It is usually used to describe communications in which data can be transmitted intermittently rather than in a steady stream.
  • 4. SYNCHRONOUS & ASYNCHRONOUS EXECUTION SYNCHRONOUS • You are in a queue to get a movie ticket. You cannot get one until everybody in front of you gets one, and the same applies to the people queued behind you. ASYNCHRONOUS • You are in a restaurant with many other people. You order your food. Other people can also order their food, they don't have to wait for your food to be cooked and served to you before they can order. In the kitchen restaurant workers are continuously cooking, serving, and taking orders. People will get their food served as soon as it is cooked.
  • 5. SIDE NOTE • Although asynchronous workflow processes might process faster, synchronous processing is sometimes preferred. If a calling application depends on information from the workflow process, you should run the process synchronously to ensure that the calling application gets the information it needs from the process before the workflow finishes and the application closes.
  • 6. WHAT IS A WEB SERVER • A web server is an information technology that processes requests via HTTP, the basic network protocol used to distribute information on the World Wide Web. The term can refer either to the entire computer system, an appliance, or specifically to the software that accepts and supervises the HTTP requests
  • 7. WEB SERVERS • Lighttpd (asynchronous) • Apache * (synchronous) • Nginx * (asynchronous) • IIS (Internet Information Services) (synchronous) • AWS Lambda (event, asynchronous), AWS Kinesis • Apache Tomcat
  • 8. APACHE WEB SERVER The Apache HTTP Server, colloquially called Apache is the world's most used web server software. Originally based on the NCSA HTTPd server, development of Apache began in early 1995 after work on the NCSA code stalled. Apache played a key role in the initial growth of the World Wide Web, quickly overtaking NCSA HTTPd as the dominant HTTP server, and has remained most popular since April 1996. In 2009, it became the first web server software to serve more than 100 million websites.
  • 9. APACHE WEB SERVER Instead of implementing a single architecture, Apache provides a variety of MultiProcessing Modules (MPMs), which allow Apache to run in a process-based, hybrid (process and thread) or event- hybrid mode, to better match the demands of each particular infrastructure. But Apache slows down under heavy load, because of the need to spawn new processes, thus consuming more computer memory. It also creates new threads that must compete with others for access to memory and CPU. Apache will also refuse new connections when traffic reaches the limit of processes configured by the administrator.
  • 10. • Load Balancing • Loadable Dynamic Modules • User and Session tracking • Concurrent connection limiting • Embedded Perl, PHP and Lua scripting • Custom logging with rotation • Concurrent connection limiting • Request processing rate limiting • Bandwidth throttling • Server Side Includes • IP address-based geolocation FEATURES: APACHE WEB SERVER
  • 12. NGINX • Nginx was created to be both a web server and a proxy server. • Nginx was built to solve the C10k problem • Uses asynchronous, non-blocking, event-driven connection handling algorithm. • This style of connection processing allows Nginx to scale incredibly far with limited resources. Since the server is single- threaded and processes are not spawned to handle each new connection, the memory and CPU usage tends to stay relatively consistent, even at times of heavy load.
  • 13. FEATURES: NGINX • Handling of static files, index files and auto-indexing • Reverse proxy with caching • Load balancing with in-band health checks • FastCGI, SCGI, uWSGI support with caching • Name- and IP address-based virtual servers • IPv6-compatible • HTTP/2 and SPDY protocol support • FLV and MP4 streaming • Web page access authentication • URL rewriting • Concurrent connection limiting • Request processing rate limiting
  • 14. • Quora.com • Appnexus • Wix • Montana • Mulesoft • NASA • Groupon • Zendesk COMPANIES USING NGINX
  • 15. WEB SERVER USAGE MAY 2014 JUNE 2014
  • 17. MODULES: APACHE • Apache's module system allows you to dynamically load or unload modules to satisfy your needs during the course of running the server. • The Apache core is always present, while modules can be turned on or off, adding or removing additional functionality and hooking into the main server. • Apache uses this functionality for a large variety tasks. Due to the maturity of the platform, there is an extensive library of modules available. • These can be used to alter some of the core functionality of the server, such as ‘mod_php’ which embeds a PHP interpreter into each running worker. • Modules are not limited to processing dynamic content, they can
  • 18. MODULES: NGINX • Nginx also implements a module system, but it is quite different from the Apache system. • In Nginx, modules are not dynamically loadable, so they must be selected and compiled into the core software. • While distributions' packages tend to include the most commonly used modules, if you require a non-standard module, you will have to build the server from source yourself. • Nginx modules are still very useful though, and they allow you to dictate what you want out of your server by only including the functionality you intend to use. • Nginx modules allow many of the same capabilities as Apache modules. For instance, Nginx modules can provide proxying support, compression, rate limiting, logging, rewriting, geolocation,
  • 19. • Apache servers can handle static content using its conventional file-based methods. The performance of these operations is mainly a function of the MPM methods described above. • Apache can also process dynamic content by embedding a processor of the language in question into each of its worker instances. This allows it to execute dynamic content within the web server itself without having to rely on external components. These dynamic processors can be enabled through the use of dynamically loadable modules. • Apache's ability to handle dynamic content internally means that configuration of dynamic processing tends to be simpler. Communication does not need to be coordinated with an additional piece of software and modules can easily be swapped STATIC & DYNAMIC CONTENT: NGINX: APACHE
  • 20. • Nginx does not have any ability to process dynamic content natively. To handle PHP and other requests for dynamic content, Nginx must pass to an external processor for execution and wait for the rendered content to be sent back. The results can then be relayed to the client. • For administrators, this means that communication must be configured between Nginx and the processor over one of the protocols Nginx knows how to speak (http, FastCGI, SCGI, uWSGI, memcache). This can complicate things slightly, especially when trying to anticipate the number of connections to allow, as an additional connection will be used for each call to the processor. • However, this method has some advantages as well. Since the dynamic interpreter is not embedded in the worker process, its overhead will only be present for dynamic content. Static content can be served in a straight-forward manner and the interpreter will only be contacted when STATIC & DYNAMIC CONTENT: NGINX
  • 21. • Apache provides a variety of multi-processing modules (Apache calls these MPMs) that dictate how client requests are handled. Basically, this allows administrators to swap out its connection handling architecture easily. These are: • mpm_prefork (our model) • mpm_worker • mpm_event (new implementation) CONNECTION HANDLING: APACHE
  • 22. This processing module spawns processes with a single thread each to handle request. Each child can handle a single connection at a time. As long as the number of requests is fewer than the number of processes, this MPM is very fast. However, performance degrades quickly after the requests surpass the number of processes, so this is not a good choice in many scenarios. Each process has a significant impact on RAM consumption, so this MPM is difficult to scale effectively. This may still be a good choice though if used in conjunction with other components that are not built with threads in mind. For instance, PHP is not thread-safe, so this MPM is recommended as the only safe way of working with ‘mod_php’, the Apache module for processing these files. CONNECTION HANDLING: APACHE: MPM_PREFORK
  • 23. This module is similar to the worker module in most situations, but is optimized to handle keep-alive connections. When using the worker MPM, a connection will hold a thread regardless of whether a request is actively being made for as long as the connection is kept alive. The event MPM handles keep alive connections by setting aside dedicated threads for handling keep alive connections and passing active requests off to other threads. This keeps the module from getting bogged down by keep-alive requests, allowing for faster execution. This was marked stable with the release of Apache 2.4. CONNECTION HANDLING: APACHE: MPM_EVENT
  • 24. • Nginx spawns worker processes, each of which can handle thousands of connections. The worker processes accomplish this by implementing a fast looping mechanism that continuously checks for and processes events. Decoupling actual work from connections allows each worker to concern itself with a connection only when a new event has been triggered. • Each of the connections handled by the worker are placed within the event loop where they exist with other connections. Within the loop, events are processed asynchronously, allowing work to be handled in a non-blocking manner. When the connection closes, it is removed from the loop. CONNECTION HANDLING: NGINX
  • 25. APACHE & NGINX IMPLEMENTATION • Looking at the features of both technologies we see the strength of one can complement the weakness of the other. • For great performance both technologies could be used hand in hand • Placing Nginx in front of Apache helps to leverage the fast processing ability to handle large number of concurrent requests • While Nginx is a good load balancer and better in delivery of static content, apache has the internal functionality of processing dynamic content (e.g. PHP) better • Dynamic requests can be proxied to Apache by Nginx • Nginx returns the process page back to the user/client
  • 26. APACHE & NGINX IMPLEMENTATION (STATIC & DYNAMIC) server { server_name .example.com; root /home/example.com/www; [...] location ~* .php.$ { # Proxy all requests with an URI ending with .php* # (includes PHP, PHP3, PHP4, PHP5...) proxy_pass http://127.0.0.1:8080; } location / { # Your other options here for static content # for example cache control, alias... expires 30d; } } FILES THAT REQUIRE PROCESSING BEFORE BEING SENT TO THE CLIENT, SUCH AS PHP, PERL, AND RUBY SCRIPTS, WILL BE SERVED BY APACHE
  • 27. GOING CLOUD ….. • AWS; AWS Lambda • A Lambda function and an event source are the core components that you use when you work with AWS Lambda. Event sources publish events, and a Lambda function is the custom code that you write to process the events that automatically gets invoked in response to events. In addition, you can invoke your Lambda function directly over HTTPS or using AWS SDKs.