- Documentation
- NGINX http_gzip module
- NGINX http_gunzip module
- Enable gzip. by default, we’re not going to compress the responses that we’re getting from proxied servers or any piece of content that isn’t HTML.
- But if one of our proxied servers happens to send us a pre-compressed response then we probably want to decompress it for clients that can’t handle gzip. In this situation, we’ll use the gunzip module
$ vim /etc/nginx/nginx.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## From a post on the ML, apropos this: | |
## http://lowlatencyweb.wordpress.com/2012/03/20/500000-requestssec-modern-http-servers-are-fast. | |
## For sysctl.conf | |
net.ipv4.tcp_slow_start_after_idle = 0 | |
echo "1768 64512" > /proc/sys/net/ipv4/ip_local_port_range | |
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle | |
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>jQuery => Vanilla JS</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php -v | |
pecl version | |
sudo apt-get install php7.4-dev -y | |
sudo apt-get install php-pear | |
sudo apt-get -y install gcc make autoconf libc-dev pkg-config -y | |
sudo pecl channel-update pecl.php.net | |
sudo apt-get -y install libmcrypt-dev | |
sudo pecl install mcrypt-1.0.3 # 7.4 | |
# php 7.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$page = (int) $this->request->getGet('page'); // | |
$limit = config('Pager')->perPage; // see Config/Pager.php | |
if (!isset($page) || $page === 0 || $page === 1) { | |
$page = 1; | |
$offset = 0; | |
} else { | |
$offset = ($page - 1) * $limit; | |
$page = $page; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button | |
@click="showModal = !showModal | fetch('{{ entry.url() }}', { | |
headers: { | |
'Content-Type': 'application/json', | |
'X-Requested-With': 'XmlHttpRequest' | |
}, | |
}).then(res => res.text()).then(text => { html = text })" | |
class="flex justify-center animate-grow-on-hover--small" | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sebagai kelanjutan dari script saya sebelumnya (save_screenshot.py) | |
# Script ini membuka laman kpu, memilih berurutan Propinsi, Kabupaten, Kecamatan, Kelurahan dan TPS | |
# Di penghujung proses, dilakukan penyimpanan screenshot. | |
# Sebagai POC, saya batasi saja 5 TPS | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from datetime import datetime | |
import time |
Moved to git repository: https://github.com/aliesbelik/load-testing-toolkit
Tools to benchmark & load-test your code or services
- apachebench (ab) - Standalone apachebench (ab), Apache HTTP server benchmarking tool.
C
- httperf - A tool for measuring web server performance.
C
Moved to git repository: https://github.com/denji/nginx-tuning
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
NewerOlder