Scaling on Forge

Forge Recipes


We cover the various recipes I use on Forge to optimize our servers.

Here are the recipes we use from within Forge:

App Server

##
# Disable Unused Services
###

# 1. Beanstalkd

sudo systemctl stop beanstalkd
sudo systemctl disable beanstalkd

# 2. Memcached

sudo systemctl stop memcached
sudo systemctl disable memcached

# 3. Redis

sudo systemctl stop redis
sudo systemctl disable redis

##
# Adjust php process management
###

sudo sed -i "s/pm.max_children = .*/pm.max_children = 10/" /etc/php/7.1/fpm/pool.d/www.conf
sudo sed -i "s/pm.start_servers = .*/pm.start_servers = 4/" /etc/php/7.1/fpm/pool.d/www.conf
sudo sed -i "s/pm.min_spare_servers = .*/pm.min_spare_servers = 2/" /etc/php/7.1/fpm/pool.d/www.conf
sudo sed -i "s/pm.max_spare_servers = .*/pm.max_spare_servers = 4/" /etc/php/7.1/fpm/pool.d/www.conf
sudo sed -i "s/;pm.max_requests = .*/pm.max_requests = 1000/" /etc/php/7.1/fpm/pool.d/www.conf

sudo service php7.1-fpm restart

Worker and CRON Server

##
# Disable Unused Services
###

# 1. Beanstalkd

sudo systemctl stop beanstalkd
sudo systemctl disable beanstalkd

# 2. Memcached

sudo systemctl stop memcached
sudo systemctl disable memcached

# 3. Redis

sudo systemctl stop redis
sudo systemctl disable redis

# 4. Nginx

sudo systemctl stop nginx
sudo systemctl disable nginx

# 5. PHP-FPM

sudo systemctl stop php7.1-fpm
sudo systemctl disable php7.1-fpm

MySQL Server

##
# Disable Unused Services
###

# 1. Nginx

sudo systemctl stop nginx
sudo systemctl disable nginx

# 2. PHP-FPM

sudo systemctl stop php7.1-fpm
sudo systemctl disable php7.1-fpm

# 3. Beanstalkd

sudo systemctl stop beanstalkd
sudo systemctl disable beanstalkd

# 4. Memcached

sudo systemctl stop memcached
sudo systemctl disable memcached

# 5. Redis

sudo systemctl stop redis
sudo systemctl disable redis

Cache (Redis) Server

##
# Disable Unused Services
###

# 1. Nginx

sudo systemctl stop nginx
sudo systemctl disable nginx

# 2. PHP-FPM

sudo systemctl stop php7.1-fpm
sudo systemctl disable php7.1-fpm

# 3. Beanstalkd

sudo systemctl stop beanstalkd
sudo systemctl disable beanstalkd

# 4. Memcached

sudo systemctl stop memcached
sudo systemctl disable memcached

Want to go deeper on Scaling Laravel?


where you'll learn about efficient Eloquent, MySQL indexing,
server network optimization, HAProxy, advanced queue usage,
VueJS + Pusher, get more free videos, and get deals on launch day!


Course scheduled to launch in late January
or early February of 2018.

About

the true grumpy programmer, don't be fooled by imitation

I'm Chris Fidao. You might know me from Servers for Hackers, where I write and record videos about server management, for programmers.

I also have a bunch of other projects you might be interested in:

  • Shipping Docker - A video series about using Docker in development, testing/CI, and in production.
  • Servers for Hackers eBook - A book that goes in-depth on what you need to know about your web servers.
  • Deploy PHP! - A video series on setting up an automated, professional deployment system for you and your team.