• Home
  • WordPress
  • web Hosting
    • Free hosting
    • Cheap Hosting
    • comparison cloud , vps, shared, wordpress
    • managed wordpress hosting
    • managed cloud hosting
  • page Speed
  • Deals
  • Services
  • About

RAaz Kumar .com

wordpress tutorials seo hosting etc


Apache vs nginx (connection handling, modules, memory usage)

 

 

Cons of nginx:

  1. Limited modules
  2. everything has to code when compare to apache. (nightmare for new server admins)
  3. static modules (deploy only once while installing the server)
  4. not handles dynamic content it self (its a  pros)

Pros of Nginx

  1. less cpu & memory required to handle 1000+ concurrent connection (existed to address apache problems)

 

 

Why nginx created in 2004 2 version open source and premium nginx plus

C10K problem handling ten thousand concurrent connections
in Apache every connection handle by 1 worker that holds some memory, ex: 126MB if 500 Connection simultaneously Apache server has to
500*126MB= 63000 MB or 63GB. (it also holds Php as a module to control memory limit.
however, if 500 connections per seconds in reached in Apache you get message like max clients reached. or you may also install a beautiful module that only servers plain html page
in peak time
(Solution caching dynamic content as static (no request database) fastcgi or nginx as revere proxy)
page

Apache core architecture

apache-worker

mpm-prefork: process with 1 thread to handle 1 connection 1 process = (126+MB memory just on limit in php )
mpm-worker: process with 2 threads thread for 1 connection handling 2 connections by 1 process. but keep alive connections (idle which pages active in browser but no request from user also count as active connection holds some memory)
mpm-event: only uses threads for active connections. keep alive connection handles separately.

you have to select best for your server or websites need.

Note: we can’t limit apache process memory limit not like php or php-fpm but we can do it by limiting processes or threads)

//traffic = visitors >> connection. 100 real time visitors = not 100 active connections to db,php server proxy.

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

<IfModule mpm_event_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
(based on above php -fpm pool manger set as on demand,dynamic,static in nginx)

 

Nginx core architecture

nginx-architecture

Nginx workers equal to cpu cores

user       www www;  ## Default: nobody
worker_processes  auto;  ## Default: 
error_log  logs/error.log;
pid        logs/nginx.pid;
worker_rlimit_nofile 8192;

events {
  worker_connections  4096;  ## Default: 1024
}

 

nginx workers auto =2
worker process = 1024 default
2*1024=2048 concurrent connections per seconds or 2 vcore server*big deal

single-threaded and processes use an asynchronous, non-blocking, event-driven connection handling algorithm.
not spawn process based on connection (every process = memory cpu holding)
2 process in nginx based on cores.
connection handling:
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.

why people use nginx as proxy for apache?

nginx passes the connection to php-fpm then database
and waits until the connection process.

modules: apache modules easy install and configure dynamically and lot of features.
nginx modules can de deployer only once as static. however nginx introduced dynamic module
feature but it has to deploy with again fresh nginx installation(install fresh nginx with new module as dynamic in same /live or another server with same os and version of nginx then copy the module file into production server)

.htaccess vs nginx server block

.htaccess look for all servers files when a request process. (you can place own .htaccess to rewrite main server rules like wp .htaccess) but nginx only look specified directory
By not allowing directory overrides, Nginx can serve requests faster by
doing a single directory lookup and file read for each request (assuming that the file is found in the conventional directory structure).

nginx does not allow to overwrite rules every directory. so problems in shared hosting, (memory limit, compression,ssl etc)
cpanel only works with apache.

file system vs uri (request interpretation)

apache processes to file system while nginx to url

The try_files directive commonly uses the $uri variable, which represents the part of the URL after the domain name

and its new 2004 vs 1995 apache

how litespeed faster than nginx and nginx plus

Litespeed released on 2003 in enterprise version its got popular when its released 2014 openlitespeed free version

& 2017 litespeed cache plugin for wordpress.

same architecture as nginx. built in litespeed cache. while windows IIS server not free at all.

nginx vs apche vs iis

 

also know how to tune nginx performance

and improve mysql performance

Related topics:

  1. apache performance tuning mpm-worker vs prefork vs event modules
  2. how to enable KeepAlive connections in apache nginx wordpress
  3. Speed up my PC windows too much memory 100% disk CPU usage fix
  4. MySQL innodb memory allocation & usage calculation
  5. apache modules list (explained, enable disable)

tutorials

  • Vivek Bindra Videos Transcription (business strategy)
  • git commands
  • new relic php agent install in 3 steps
  • new relic mysql install integration - 2 ways fix problems
  • new relic installation linux (infrastructure agent , php, mysql , nginx)
  • xampp tutorials 2021 installation errors fix wordpress phpmyadmin mysql apache
  • Redis performance metrics & tuning for nginx apache ubuntu & debian
  • Devops course Syllabus topics PDF AWS, Azure, cisco, redhat
  • CCNA Syllabus pdf (CCNA / CCNP vs devops vs mcsa /MCSE)
  • how to create a website free of cost on google
  • what is vpn vs proxy vs tor, http vs https, http2, tcp vs udp, kali linux sql source code injection
  • nginx server tutorials (installation, configuration, performance tuning, security)
    • nginx performance tuning
    • nginx add last modified header (remove, php wordpress)
    • upgrade php fpm ubuntu nginx 7.4 to 8.2
    • install phpmyadmin ubuntu nginx 22.04
    • php fpm install ubuntu 20.04 nginx
    • nginx upstream response is buffered to a temporary file
    • php fpm ondemand vs dynamic vs Static (the dynamic pool problem)
    • Php fpm configuration for 1000 concurrent connections server busy max children reached
    • php fpm seems busy fixed warning and max children reached to handle max connections / requests
    • newrelic nginx integration process and errors fix and metrics
    • datadog nginx integration installation process
    • nginx rate limiting explained by location time specific url
    • SSL faster reduce TLS hand shake improve https performance
    • monitor nginx request with nginx status amplify datadog new relic
    • nginx installation on ubuntu 20.04 LTS
    • enable brotli compression nginx brotli vs gzip
    • Letsencrypt SSL Installation on apache/Nginx ubuntu / debian wordpress
    • Top 10 tips to improve nginx server security
    • letsencrypt install configure on ubuntu / debian nginx
    • what is TTFB & how to Reduce it (server response time) Google pagespeed
    • php fpm restart nginx ubuntu enable status page, monitor etc
    • php fpm pool manager configuration settings based on server spike high cpu wordpress
    • nginx modules list (enable, disable, upgrade, install dynamic module)
    • nginx rewrite rules with examples 301 redirection
    • use nginx as reverse proxy and load balancer for apache wordpress
    • nginx conf explained best config file performance tuning tips nginx.conf location errors tutorial
    • nginx errors (504,502, 413, unable to start, syntax errors)
    • Pagespeed module install, configure, monitor, errors ft nginx &apache
    • Apache vs nginx (connection handling, modules, memory usage)
    • install LEMP Stack on 22.04 LTS Nginx MySQL PHP fpm #wordpress #digital ocean
    • nginx fastcgi cache wordpress how to configure
    • fix error 520 522 524 on cloudflare wordpress godaddy nginx etc
  • MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS
  • AUdio Editing Background Noise removal (Audacity, Adobe Premiere Addition, Camtasia Filmora Windows Obs)
  • Android Studio tutorials syllabus Topics Course details #AndroidApplicationDevelopment
  • [INTRO] Ethical hacking / cyber Security / Penetration testing Tutorial -{updates frequently}
  • redis install ubuntu 20.04 with wordpress php redis mysql configuration
  • ubuntu tutorials installation download issues etc
  • Php tutorials
  • HTML & CSS Tutorials
  • Core Java Tutorial Free online
  • Linux sysadmin tutorials linux system administrator
  • apache server tutorial (install,config, performance tuning, security, error handling)

 

 

wordpress Pagespeed optimization

Digitalocean free $100 Credit

Cloudways Review pricing promo codes

Siteground cpu limits Pricing

Shared Hosting

Managed wordpress Hosting

Managed Hosting Cloud server

VPS Hosting

Cloud Hosting – Unmanaged

Google cloud Pricing

Aws Pricing

Azure pricing

nginx server tutorials

apache server tutorials

linux sysadmin tutorials

mysql Commands list pdf

LEMP Install Ubuntu

Mysql Performance Tuning

Nginx Performance tuning

Linux Performance tuning

Php -fpm performance tuning

Redis Performance tuning

linux server security

nginx security best practices

wordpress security plugins

 

 

wordpress

 

Top 5  WP Google Analytics Plugins

WP Backup Plugins

Wp Comment Plugins

Top wordpress Security Plugins

WP Seo Plugins

WP Caching Plugins

Best Adsense Plugins for WordPress

Wp social Sharing Plugins

autoshare social media plugins

WP speed Optimization Plugins

Speedup WordPress google Score

More Wp tuts

Server Admin Cloud

 

Installing Nginx LEMP On ubuntu

Installing apache Lamp ubuntu

nginx fastcgi cache enable

php – fpm install  & Configuration

Opcache install & Configure

php -fpm pool manager explained

Mysql Install & Configuration

Redis Object cache install & configure

 

Nginx as Reverse Proxy and Load balancer

Load Balance / auto scaling in google cloud

Linux Commands PDF

Mysql Commands Pdf

Letsencrypt tutorial

mysqldump export & import 

Pagespeed Module install & configure

nginx.conf best file

mysql.conf best file

upgrade ubuntu

© 2023 - All Rights Reserved Disclaimer & Privacy Policy