SlideShare a Scribd company logo
1 of 13
Architecture of Web Servers
By Nicolas Vanhoren
Not all web
servers are
made equal
There are different types of
architecture resulting in difference
in performances and resource
usage.
But first a little bit of definitions.
Do you know the difference between a program and
a process ?
● A program is a bunch of code
understandable by a computer that is
located on a storage device.
● A process is a copy of a program in the
RAM of a computer that is currently
runned by that computer.
● It’s completely possible that the same
program is runned multiple times, thus
resulting in multiple concurrent
processes. It’s even a common practice.
SSD
program1
RAM
program1_1
program1_2
program1_3
A few facts about
processes
● They all have their own RAM allocated by
the operating system.
● They can communicate with each other
with means similar to network
connections.
I also heard about a thing called “Threads” ?
● They are a feature of all modern
operating systems.
● Threads allow to have multiple
threads of execution within a
single process.
● They share the same memory.
● Due to the risk of inconsistency
with sharing that same memory
they have to rely on locks.
RAM
process1
thread1 thread2 thread3
Now for the web servers architectures
One process, one thread
● Can handle only one request at
a time.
● Is very simple to implement.
● Examples: PHP dev server, a
lot of other dev servers…
● No one really uses this in
production, the inability to
handle concurrent requests
makes this model only suitable
for quick tests.
Client
Process
Multiple processes, one thread per process
● Each process handles one
request max at any given time.
● Number of concurrent requests
is limited by the amount of
processes.
● Relatively high usage of RAM
per max number of concurrent
requests.
● Technologies using it: PHP
Client
Process Process Process
Multiple threads
● The process dispatches requests
to a pool of thread.
● Number of concurrent requests
only limited by the size of the
thread pool. Each thread usually
uses less RAM than a process.
● Can be combined with multiple
processes for best of both
worlds.
● Technologies using it: Python,
Ruby, Java, .NET,...
Client
Thread Thread Thread
Process
Models using alternatives to
threads
Multi-threads applications are nice, but some people still
complain about their performances and limitations. That’s
why multiple technologies (Go, Erlang, Haskell, Node.js,...)
offer alternatives. Here we will focus on one specific model...
Event-based web servers
● An alternative to threads where the
program manually handles context
switches using an event queue.
● Generally allows more parallelism
than multiple threads and is
considered as a more efficient
alternative for a lot of applications.
(Not all.)
● Can still be combined with multi
processed or multithreaded
architectures.
● Technologies using it: Nginx, Node.js,
Python
Client
Process
Thread
Event Event Event
A word about WebSockets
● They are a new specification implemented on all modern browsers.
● Instead of working on a “per request” basis, they allow persistent bi-
directional connexions between a browser and a web server.
● They are immensely useful for a lot of applications (instant messaging,
collaborative applications, notifications, video games,...)
● Multi-processes architectures are almost unable to use them as each
connexion monopolize a full process persistently.
● Multi-threads architectures are not very efficient either because there is still a
limit to the number of threads on a Linux server.
● Event-based architectures are usually considered very effective to use
WebSockets.
Any questions?

More Related Content

What's hot

Guest Agents: Support & Implementation
Guest Agents: Support & ImplementationGuest Agents: Support & Implementation
Guest Agents: Support & ImplementationMirantis
 
Microservices - Please, don't
Microservices - Please, don'tMicroservices - Please, don't
Microservices - Please, don'tSean Kelly
 
Services, dependencies, and you
Services, dependencies, and youServices, dependencies, and you
Services, dependencies, and youSean Kelly
 
threading and multi threading in java
threading and multi threading in javathreading and multi threading in java
threading and multi threading in javaHamza Shah
 
WebAssembly with Rust
WebAssembly with RustWebAssembly with Rust
WebAssembly with RustKnoldus Inc.
 
Export pdf with puppeteer
Export pdf with puppeteerExport pdf with puppeteer
Export pdf with puppeteerKnoldus Inc.
 
Kernel Recipes 2014 - Performance Does Matter
Kernel Recipes 2014 - Performance Does MatterKernel Recipes 2014 - Performance Does Matter
Kernel Recipes 2014 - Performance Does MatterAnne Nicolas
 
Halton Software Peer 2 Peer Meetup #10
Halton Software Peer 2 Peer Meetup #10Halton Software Peer 2 Peer Meetup #10
Halton Software Peer 2 Peer Meetup #10David Ashton
 
A Practical Event Driven Model
A Practical Event Driven ModelA Practical Event Driven Model
A Practical Event Driven ModelXi Wu
 
Dynamo Amazon’s Highly Available Key-value Store
Dynamo Amazon’s Highly Available Key-value StoreDynamo Amazon’s Highly Available Key-value Store
Dynamo Amazon’s Highly Available Key-value StoreMiro Cupak
 
Through Meteor to the stars - Developing full-stack SPA's with meteor.js
Through Meteor to the stars - Developing full-stack SPA's with meteor.jsThrough Meteor to the stars - Developing full-stack SPA's with meteor.js
Through Meteor to the stars - Developing full-stack SPA's with meteor.jsWekoslav Stefanovski
 
Consistency Models in New Generation Databases
Consistency Models in New Generation DatabasesConsistency Models in New Generation Databases
Consistency Models in New Generation Databasesiammutex
 
JAZOON'13 - Andrej Vckovski - Go synchronized
JAZOON'13 - Andrej Vckovski - Go synchronizedJAZOON'13 - Andrej Vckovski - Go synchronized
JAZOON'13 - Andrej Vckovski - Go synchronizedjazoon13
 

What's hot (18)

Guest Agents: Support & Implementation
Guest Agents: Support & ImplementationGuest Agents: Support & Implementation
Guest Agents: Support & Implementation
 
Microservices - Please, don't
Microservices - Please, don'tMicroservices - Please, don't
Microservices - Please, don't
 
Services, dependencies, and you
Services, dependencies, and youServices, dependencies, and you
Services, dependencies, and you
 
threading and multi threading in java
threading and multi threading in javathreading and multi threading in java
threading and multi threading in java
 
WebAssembly with Rust
WebAssembly with RustWebAssembly with Rust
WebAssembly with Rust
 
Export pdf with puppeteer
Export pdf with puppeteerExport pdf with puppeteer
Export pdf with puppeteer
 
Kernel Recipes 2014 - Performance Does Matter
Kernel Recipes 2014 - Performance Does MatterKernel Recipes 2014 - Performance Does Matter
Kernel Recipes 2014 - Performance Does Matter
 
Halton Software Peer 2 Peer Meetup #10
Halton Software Peer 2 Peer Meetup #10Halton Software Peer 2 Peer Meetup #10
Halton Software Peer 2 Peer Meetup #10
 
A Practical Event Driven Model
A Practical Event Driven ModelA Practical Event Driven Model
A Practical Event Driven Model
 
Node js first look - 2016
Node js first look - 2016Node js first look - 2016
Node js first look - 2016
 
What does JavaScript
What does JavaScriptWhat does JavaScript
What does JavaScript
 
Dynamo Amazon’s Highly Available Key-value Store
Dynamo Amazon’s Highly Available Key-value StoreDynamo Amazon’s Highly Available Key-value Store
Dynamo Amazon’s Highly Available Key-value Store
 
Through Meteor to the stars - Developing full-stack SPA's with meteor.js
Through Meteor to the stars - Developing full-stack SPA's with meteor.jsThrough Meteor to the stars - Developing full-stack SPA's with meteor.js
Through Meteor to the stars - Developing full-stack SPA's with meteor.js
 
Hyperledger in AWS
Hyperledger in AWSHyperledger in AWS
Hyperledger in AWS
 
Working with Asynchronous Events
Working with Asynchronous EventsWorking with Asynchronous Events
Working with Asynchronous Events
 
Consistency Models in New Generation Databases
Consistency Models in New Generation DatabasesConsistency Models in New Generation Databases
Consistency Models in New Generation Databases
 
JAZOON'13 - Andrej Vckovski - Go synchronized
JAZOON'13 - Andrej Vckovski - Go synchronizedJAZOON'13 - Andrej Vckovski - Go synchronized
JAZOON'13 - Andrej Vckovski - Go synchronized
 
Demo: Reflectivity
Demo: ReflectivityDemo: Reflectivity
Demo: Reflectivity
 

Similar to Web Server Architecture Types and Performance

Operating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxOperating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxPrudhvi668506
 
Web servers presentacion
Web servers presentacionWeb servers presentacion
Web servers presentacionKiwi Science
 
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
 
Multithreading 101
Multithreading 101Multithreading 101
Multithreading 101Tim Penhey
 
Choosing the right parallel compute architecture
Choosing the right parallel compute architecture Choosing the right parallel compute architecture
Choosing the right parallel compute architecture corehard_by
 
Multi threaded programming
Multi threaded programmingMulti threaded programming
Multi threaded programmingAnyapuPranav
 
Dori Exterman, Considerations for choosing the parallel computing strategy th...
Dori Exterman, Considerations for choosing the parallel computing strategy th...Dori Exterman, Considerations for choosing the parallel computing strategy th...
Dori Exterman, Considerations for choosing the parallel computing strategy th...Sergey Platonov
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js PresentationExist
 
Multicore_Architecture Book.pdf
Multicore_Architecture Book.pdfMulticore_Architecture Book.pdf
Multicore_Architecture Book.pdfSwatantraPrakash5
 
Parallelization using open mp
Parallelization using open mpParallelization using open mp
Parallelization using open mpranjit banshpal
 

Similar to Web Server Architecture Types and Performance (20)

Concept of thread
Concept of threadConcept of thread
Concept of thread
 
Operating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxOperating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptx
 
Multi threading models
Multi threading modelsMulti threading models
Multi threading models
 
Epc 3.ppt
Epc 3.pptEpc 3.ppt
Epc 3.ppt
 
webservers
webserverswebservers
webservers
 
Topic 4- processes.pptx
Topic 4- processes.pptxTopic 4- processes.pptx
Topic 4- processes.pptx
 
Web servers presentacion
Web servers presentacionWeb servers presentacion
Web servers presentacion
 
Thread
ThreadThread
Thread
 
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
 
J threads-pdf
J threads-pdfJ threads-pdf
J threads-pdf
 
W-9.pptx
W-9.pptxW-9.pptx
W-9.pptx
 
Multithreading 101
Multithreading 101Multithreading 101
Multithreading 101
 
Choosing the right parallel compute architecture
Choosing the right parallel compute architecture Choosing the right parallel compute architecture
Choosing the right parallel compute architecture
 
Multi threaded programming
Multi threaded programmingMulti threaded programming
Multi threaded programming
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
 
Dori Exterman, Considerations for choosing the parallel computing strategy th...
Dori Exterman, Considerations for choosing the parallel computing strategy th...Dori Exterman, Considerations for choosing the parallel computing strategy th...
Dori Exterman, Considerations for choosing the parallel computing strategy th...
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
Threads
ThreadsThreads
Threads
 
Multicore_Architecture Book.pdf
Multicore_Architecture Book.pdfMulticore_Architecture Book.pdf
Multicore_Architecture Book.pdf
 
Parallelization using open mp
Parallelization using open mpParallelization using open mp
Parallelization using open mp
 

Recently uploaded

A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewingbigorange77
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...akbard9823
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 

Recently uploaded (20)

A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewing
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 

Web Server Architecture Types and Performance

  • 1. Architecture of Web Servers By Nicolas Vanhoren
  • 2. Not all web servers are made equal There are different types of architecture resulting in difference in performances and resource usage. But first a little bit of definitions.
  • 3. Do you know the difference between a program and a process ? ● A program is a bunch of code understandable by a computer that is located on a storage device. ● A process is a copy of a program in the RAM of a computer that is currently runned by that computer. ● It’s completely possible that the same program is runned multiple times, thus resulting in multiple concurrent processes. It’s even a common practice. SSD program1 RAM program1_1 program1_2 program1_3
  • 4. A few facts about processes ● They all have their own RAM allocated by the operating system. ● They can communicate with each other with means similar to network connections.
  • 5. I also heard about a thing called “Threads” ? ● They are a feature of all modern operating systems. ● Threads allow to have multiple threads of execution within a single process. ● They share the same memory. ● Due to the risk of inconsistency with sharing that same memory they have to rely on locks. RAM process1 thread1 thread2 thread3
  • 6. Now for the web servers architectures
  • 7. One process, one thread ● Can handle only one request at a time. ● Is very simple to implement. ● Examples: PHP dev server, a lot of other dev servers… ● No one really uses this in production, the inability to handle concurrent requests makes this model only suitable for quick tests. Client Process
  • 8. Multiple processes, one thread per process ● Each process handles one request max at any given time. ● Number of concurrent requests is limited by the amount of processes. ● Relatively high usage of RAM per max number of concurrent requests. ● Technologies using it: PHP Client Process Process Process
  • 9. Multiple threads ● The process dispatches requests to a pool of thread. ● Number of concurrent requests only limited by the size of the thread pool. Each thread usually uses less RAM than a process. ● Can be combined with multiple processes for best of both worlds. ● Technologies using it: Python, Ruby, Java, .NET,... Client Thread Thread Thread Process
  • 10. Models using alternatives to threads Multi-threads applications are nice, but some people still complain about their performances and limitations. That’s why multiple technologies (Go, Erlang, Haskell, Node.js,...) offer alternatives. Here we will focus on one specific model...
  • 11. Event-based web servers ● An alternative to threads where the program manually handles context switches using an event queue. ● Generally allows more parallelism than multiple threads and is considered as a more efficient alternative for a lot of applications. (Not all.) ● Can still be combined with multi processed or multithreaded architectures. ● Technologies using it: Nginx, Node.js, Python Client Process Thread Event Event Event
  • 12. A word about WebSockets ● They are a new specification implemented on all modern browsers. ● Instead of working on a “per request” basis, they allow persistent bi- directional connexions between a browser and a web server. ● They are immensely useful for a lot of applications (instant messaging, collaborative applications, notifications, video games,...) ● Multi-processes architectures are almost unable to use them as each connexion monopolize a full process persistently. ● Multi-threads architectures are not very efficient either because there is still a limit to the number of threads on a Linux server. ● Event-based architectures are usually considered very effective to use WebSockets.