Wednesday, August 29, 2018

BTS V performance

BTS V his home life with his family

he looks so happy! 😊

How to set up MySQL max connections

This shows current max connections for mysql.
mysql> show variables like 'max_connections';

This shows current used connections for now.
mysql> show status like 'Max_used_connections';

To check how many connections were aborted. If you see aborted connection, you might need to increase max connection settings.
mysql> show status like 'Aborted%';

To change max connections:
mysql> set global max_connections=300;

If you want permanent settings:
# vi /etc/my.cnf
max_connections = 300

You need to restart to make the change of /etc/my.cnf to be effective.
service mysqld restart

and check it again:
mysql> show variables like 'max_connections';

How to check HTTPS active connections on linux

netstat -an | grep :443 | grep ESTABLISHED | wc -l

[MySQL] reducing memory usage on cloud server

in /etc/mysql/my.cnf



how to use crontab [linux]

* listing current crontab:
crontab -l

* editing crontab:
crontab -e

* example (once every 1st day of month):
0 0 1 * * shell_command_here

* special strings:
string         meaning
------         -------
@reboot        Run once, at startup.
@yearly        Run once a year, "0 0 1 1 *".
@annually      (same as @yearly)
@monthly       Run once a month, "0 0 1 * *".
@weekly        Run once a week, "0 0 * * 0".
@daily         Run once a day, "0 0 * * *".
@midnight      (same as @daily)
@hourly        Run once an hour, "0 * * * *".

Vultr Tokyo sysbench performance benchmark result

vultr performance test result (Tokyo region)

1 vCPU@2.4GHz
1TB traffic

sysbench CPU test : 298 events/s

sysbench memory : 2850MB/s

sysbench file I/O :
    read: 21.77MB/s
    write: 14.51MB/s

sysbench mysql
    read-only : 455 transactions/s, 7289 queries/s
    read-write : 149 transactions/s, 2988 queries/s
    write-only : 280.89 transactions/s, 1685 queries/s

how to redirect HTTP to HTTPS on nginx

sudo vi /etc/nginx/sites-available/SITEDOMAIN

server {
  listen 80 default_server;
  listen [::]:80 default_server;
  server_name _;
  return 301 https://$host$request_uri;

The first listen statement is for HTTP port of IPv4.
The second listen statement if for HTTP port of IPv6.
You can redirect from specific domain name as following:

how to check the file count in a folder (Ubuntu,CentOS,Linux)

find . -type f | wc -l

how to check disk space usage or free disk space on Ubuntu

$ df -h
the result:
Filesystem      Size  Used Avail Use% Mounted on
udev            464M     0  464M   0% /dev
tmpfs            99M  664K   98M   1% /run
/dev/vda1        25G  4.9G   19G  21% /