• Home
  • WP tuts
  • Hosting talk
    • Free hosting
    • Cheap Hosting
    • comparison cloud , vps, shared, wordpress
    • managed wordpress hosting
    • managed cloud hosting
  • Speed up wordpress
  • Pc world
  • Services
  • About Me

RAaz Kumar .com

wordpress tutorials seo hosting etc

nginx performance tuning

Nginx worker Process & worker connections explained Events module‌

worker_processes auto;

events {
use epoll;
worker_connections 1024;
multi_accept on;
}

worker process = auto means

Equal to number of CPU cores available in the machine.

you can manually adjust it if you need lower usage of cpu. in multi application environment like docker.

 

Worker connections Default 512

or 1024

in 2 core machine 2 worker process.

each worker process handles  1024*2 = 2048 connections / per seconds (1000+ live visitors).

 

enough cpu power then increase worker connection per seconds.

Bottleneck file descriptors limit in linux kernel

nginx multi_accept on |off;

 

default value off, accepts one connection at a time, with on accepts all connection at once, useful in traffic with scarifying cpu power.

mutex on | off;

mutual exclusion) to open the listening sockets

 

thread_pool

apache: process use memory, process switch uses cpu,

nginx: asynchronous, event‑driven approach has a problem

blocking:  then thread pool introduced nginx 1.17.

instead of processing task by thread it will put in pool so another free thread can do this,  threads requires resources.

to enable include aio threads directive

 

worker_cpu_affinity 

default off (not recommended for multi core cpus and cpus with hyperthreading)

worker_priority default 0

-20 to hgh

kernel process at -5

worker_rlimit_core 

default none

Defines the size of core files per worker process.

worker_rlimit_nofile

number of files that a worker process may use simultaneously.

worker_aio_requests

maximum number of outstanding asynchronous I/O operations for a single worker process, if we use epoll connection.

worker_aio_requests 10000;

epoll: An efficient method for Linux 2.6+ based operating systems.

Disable access_logs if don’t use

access_log off;

 

also read nginx error log & frequent errors

 

Buffers

timeouts

Sizes

proxy (php -fpm , apache as a proxy to nginx)

compression

ssl tuning

you must read nginx conf explained here.

 

$request_time – from client to client
$upstream_connect_time – upstream connection
$upstream_header_time – connection + firstbyte
$upstream_response_time – connection +last byte

 

access_log /var/log/nginx/access.log

114.119.163.217 – – [31/Jul/2020:06:25:21 +0000] “GET /health/daily-nutritional-requirement/amp HTTP/1.1” 301 5 “-” “Mozilla/5.0 (Linux; Android 7.0;) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; PetalBot;+https://aspiegel.com/petalbot)”

access_log /var/log/nginx/access.log timed_combined;

114.119.163.217 – – [31/Jul/2020:06:25:21 +0000] “GET /health/daily-nutritional-requirement/amp HTTP/1.1” 301 5 “-” “Mozilla/5.0 (Linux; Android 7.0;) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; PetalBot;+https://aspiegel.com/petalbot)” 0.640 0.640 .

0.640 secs google bot

 

FIle descriptors in  /etc/security/limits.conf

sys.fs.file-max – The system‑wide limit
nofile – user limit

ulimit -Hn  (hard limit we cannot increase more than this unless kernel config)

ulimit -Sn (sof limit we can increase upto hard limit)

root@instance-1:~# cat /proc/sys/fs/file-max

398155

root@instance-1:~# ulimit -Sn

1024

root@instance-1:~# ulimit -Hn

1048576

 

Connection Queue by Linux at etc/sysctl.conf

net.core.somaxconn

maximum number of connection queued for nginx. (default 512 nginx accepts very fast but required in traffic spike)

nginx stub status module.

net.core.netdev_max_backlog

rate at which packets are buffered by the network card before being handed off to the CPU

 

connection ques at operating system before nginx can process

512 to 65536

fs.file-max

nano /etc/sysctl.conf

TCP optimization

buffers

timeouts

net.core.somaxconn = 65535  //Max connections

net.core.netdev_max_backlog = 65535 //incoming connections backlog

 

 

 

Related topics:

  1. linux performance tuning inode limit file descriptors tco, kernel etc
  2. apache performance tuning mpm-worker vs prefork vs event modules
  3. nginx conf explained best config file performance tuning nginx.conf
  4. PHP performance tuning nginx php-fpm conf pool manger dynamic vs static vs on demand
  5. Apache vs nginx (connection handling, modules, memory usage)




tutorials

  • Android Studio tutorials syllabus Topics Course details #AndroidApplicationDevelopment
  • xampp tutorials 2021 installation errors fix wordpress phpmyadmin mysql apache
  • Devops Syllabus topics PDF
  • 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 modules list (enable, disable, upgrade, install dynamic module)
    • monitor nginx request with nginx status amplify datadog new relic
    • nginx installation on ubuntu 20.04 LTS
    • Redis performance metrics & tuning for nginx apache ubuntu & debian
    • enable brotli compression nginx brotli vs gzip
    • nginx performance tuning
    • 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
    • enable php fpm status page, monitor & understand the report to tweak performance
    • 2021 php fpm pool manager configuration settings based on server spike
    • Letsencrypt SSL Installation on apache/Nginx ubuntu / debian
    • 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 nginx.conf
    • 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 Linux, Nginx 1.15.12, MySQL 8, PHP fpm 7.3 on Ubuntu 18.04
    • nginx fastcgi cache wordpress how to configure
    • Redis / memcached installation on ubuntu 20.04 with wordpress mysql configuration
    • cloudflare timeout error 522 524 fix by increasing limit
  • Vivek Bindra Videos Transcription (business strategy)
  • AUdio Editing Background Noise removal (Audacity, Adobe Premiere Addition, Camtasia Filmora Windows Obs)
  • MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS
  • [INTRO] Ethical hacking / cyber Security / Penetration testing Tutorial -{updates frequently}
  • 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)

About

 

raaz kumar comI am Raaz Kumar, Most Of the time in a day , I Spend on WordPress, Hosting, Server related issues, So i decided write clean posts from my personal notes, so it will be useful for every one like me. Read More,,

Please Support my work by sharing, it can helps to create free content like this.

Twitter

Facebook

Youtube

 

PUBG Mobile Tips & Tricks

free fire how to play (a-z guide) guns, tips & tricks etc

Windows 10 tips & tricks

Pagespeed optimization

Pc building tips & tricks

nginx server tutorials

apache server tutorials

linux sysadmin tutorials

mysql Commands list pdf

Android studio tutorials

Gaming/ streaming tips

Airtel dth channel list

 

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

© 2021 - All Rights Reserved Disclaimer & Privacy Policy