Skip to content

Instantly share code, notes, and snippets.

@jwchang0206
jwchang0206 / nginx-tuning.md
Created July 17, 2019 22:59 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

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.

@jwchang0206
jwchang0206 / pingpong.py
Last active December 24, 2015 11:19 — forked from wfwef/gist:6789848
# Q3.
"1 2 3 4 5 6 [7] 6 5 4 3 2 1 [0] 1 2 [3] 2 1 0 [-1] 0 1 2 3 4 [5] [4] 5 6"
def pingpong(n):
"""Return the nth element of the ping-pong sequence.
>>> pingpong(7)
7
#!/bin/bash
cd ~/
mkdir /opt/redis
RedisVersion=2.6.11
wget http://redis.googlecode.com/files/redis-$RedisVersion.tar.gz
tar -zxvf redis-$RedisVersion.tar.gz
@jwchang0206
jwchang0206 / es.sh
Last active December 12, 2015 02:48 — forked from aaronshaf/es.sh
cd ~
sudo apt-get update
sudo apt-get install unzip curl python-software-properties -y
#sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin -y
curl -O http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.4.tar.gz -o elasticsearch.tar.gz
tar -zxvf elasticsearch.tar.gz
@jwchang0206
jwchang0206 / gist:2556239
Created April 30, 2012 07:31 — forked from kinopyo/gist:1062397
How to install coffee-script, and how to enable textmate bundler to compile coffeescript
# don't forget to update your port tree first
sudo port selfupdate
# install coffee script using macport
sudo port install nodejs
node -v
# install npm - the Node Package Manager
git clone http://github.com/isaacs/npm.git
cd npm
@jwchang0206
jwchang0206 / server.js
Created February 8, 2012 12:33 — forked from ageldama/server.js
node v0.6 cluster + express.js
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}