Skip to content

Instantly share code, notes, and snippets.

@eyelove
eyelove / nginx-tuning.md
Created December 24, 2020 02:57 — 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.

@eyelove
eyelove / lambda_resizingImage.js
Last active June 23, 2020 08:10 — forked from devhaks/lambda_resizingImage.js
이미지 리사이징 람다 함수
'use strict';
const querystring = require('querystring'); // Don't install.
const axios = require('axios');
// http://sharp.pixelplumbing.com/en/stable/api-resize/
const Sharp = require('sharp');
// Image types that can be handled by Sharp
const supportImageTypes = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'tiff'];
@eyelove
eyelove / install-gradle-centos.sh
Created November 7, 2016 04:28 — forked from parzonka/install-gradle-centos.sh
Install gradle on redhat/centos linux
# installs to /opt/gradle
# existing versions are not overwritten/deleted
# seamless upgrades/downgrades
# $GRADLE_HOME points to latest *installed* (not released)
gradle_version=3.1
wget -N https://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
sudo unzip -o gradle-${gradle_version}-all.zip -d /opt/gradle
sudo ln -sfn gradle-${gradle_version} /opt/gradle/latest
printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" | sudo tee /etc/profile.d/gradle.sh
. /etc/profile.d/gradle.sh
@eyelove
eyelove / install-apache-zeppelin-on-amazon-emr.sh
Last active March 9, 2016 10:12 — forked from andershammar/install-apache-zeppelin-on-amazon-emr.sh
Bootstrap script for installing Apache Zeppelin on an Amazon EMR Cluster. Verfied on Amazon EMR release 4.x.
#!/bin/bash -ex
if [ "$(cat /mnt/var/lib/info/instance.json | jq -r .isMaster)" == "true" ]; then
# Install Git
sudo yum -y install git
# Install Maven
wget -P /tmp http://apache.mirrors.spacedump.net/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
sudo mkdir /opt/apache-maven
sudo tar -xvzf /tmp/apache-maven-3.3.3-bin.tar.gz -C /opt/apache-maven
@eyelove
eyelove / centos_service_template
Last active March 3, 2016 08:59
centos service tempalte
#!/bin/bash
# myapp daemon
# chkconfig: 2345 90 60
# description: myapp daemon
# processname: myapp
DAEMON_PATH="/app/path"
DAEMON="java -jar -Xms512m -Xmx512m -Dfile.encoding=UTF-8 daemon_app.jar"
DAEMONOPTS="-d opts"
@eyelove
eyelove / gist:bae81687788dc69687a2
Created December 22, 2015 09:03 — forked from linickx/gist:3692156
hubot init script for RHEL / CENTOS
#!/bin/bash
# hubot
# chkconfig: 345 20 80
# description: hubot
# processname: hubot
# REFERENCE: http://werxltd.com/wp/2012/01/05/simple-init-d-script-template/
# This script assumes you have a user called "hubot" on your system and that hubot is installed in /opt/hubot
{
"IAB1": "Arts & Entertainment",
"IAB1-1": "Books & Literature",
"IAB1-2": "Celebrity Fan/Gossip",
"IAB1-3": "Fine Art",
"IAB1-4": "Humor",
"IAB1-5": "Movies",
"IAB1-6": "Music",
"IAB1-7": "Television",
"IAB2": "Automotive",
packages:
yum:
gcc: []
libstdc++-devel: []
gcc-c++: []
fuse: []
fuse-devel: []
libcurl-devel: []
libxml2-devel: []
openssl-devel: []
packages:
yum:
php55-fpm: []
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/26_phpfpm_config.sh":
mode: "000755"
owner: root
group: root
content: |
user nginx;
worker_processes 1;
error_log /var/log/nginx/error_log_pipe warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}