Skip to content

Instantly share code, notes, and snippets.

@Ashrafdev
Ashrafdev / nginx-tuning.md
Created February 13, 2019 08:33 — 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.

@Ashrafdev
Ashrafdev / nginx-tuning.md
Created February 13, 2019 08:33 — 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.

@Ashrafdev
Ashrafdev / eloquent-cheatsheet.php
Created July 15, 2018 14:39 — forked from hassansin/eloquent-cheatsheet.php
Laravel 5 Eloquent CheatSheet #laravel #eloquent
Model::
/*Select*/
select('col1','col2')
->select(array('col1','col2'))
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating'))
->addSelect('col3','col4')
->distinct() // distinct select
/*From*/
@Ashrafdev
Ashrafdev / deploy_php_app_openresty.sh
Created February 25, 2018 05:01
Setup Openresty, php7.1,
#!/bin/bash
# apt common
sudo apt-get install -y python-software-properties
sudo apt-get install -y software-properties-common
# setup webserver
sudo apt-get install -y curl
# import our GPG key:
#!/bin/bash
# apt common
sudo apt-get install -y python-software-properties
sudo apt-get install -y software-properties-common
# webserver
sudo apt-get install -y nginx-full
# generate cipher for SSL
@Ashrafdev
Ashrafdev / sysupdate.sh
Last active May 8, 2018 07:21
Server update & upgrade Ubuntu
#!/bin/sh
sudo apt -y update
sudo apt -y upgrade
sudo apt dist-upgrade
sudo apt -y autoremove
sudo apt -y autoclean
sudo ufw reload
exit 0
@Ashrafdev
Ashrafdev / fab.py
Created February 14, 2018 04:23 — forked from tajulasri/fab.py
Fabric python for laravel php deplopment setup
from fabric.api import *
'''
fabric python laravel vps setup
pip install fabric
1. Save as fabfile.py
2. fab deploy
@Ashrafdev
Ashrafdev / setup-percona-server.sh
Created March 25, 2017 03:53 — forked from till/setup-percona-server.sh
A small shell script to install percona-server (and -client).
#!/bin/sh
############################
# Author: Till Klampaeckel #
# License: New BSD License #
############################
version=$1
if [ "x$version" = "x" ]; then
echo "Usage: ./$0 5.0|5.1"