Posts

You need 64-bit version of Winows 10.

  1. Join Windows Insider Program
  2. Go to Settings -> Update & Security -> Advanced and Login to your Windows Insider Account
  3. Chose rs1_release
  4. Restart PC, wait about a day for new Windows Insider Preview version available to update
  5. You will need version 1607, compilation 14931
  6. Go to Settings -> Updates & security -> For Developers -> Activate Developer mode
  7. Go to Control Panel -> Programs -> Turn Windows Features On or Off -> Enable the “Windows Subsystem for Linux (Beta)”
  8. After installation, reboot computer
  9. After reoot go to Start -> type ‘bash’ and run it
  10. Follow instructions on the console to odwnload native Ubuntu for Windows

Related links:

If you are using an usual hosting or VPS you probably have limit of about 1 mln or eg. 0,5 mln of files (iNODEs). It’s crucial to monitor amount of files especially if you have a lot of aplications generating cache or session files. Hosting providers not always has such monitoring systems, so when you reach the limit hosting will be automaticly blocked and in most cases you cant even login to your admin panel if it’s on the same virtual account.

I wrote short script to count files on your server, check if its exceeds limit and eventualy sends e-mail with warning.

Put it as eg. count_files.sh as low directory as possible eg. “/” for VPS or in /home/username/ directory for standard hosting.

#!/bin/bash
echo "$(tput setaf 4)$(tput setab 7)STARTING FILE AMOUNT VERIFICATION$(tput sgr 0)"
MAXCOUNT=900000 #90% of files limit

COUNT="`find ./ -type f | wc -l`"
echo "$(tput setaf 4)$(tput setab 7)Amount of files on the server: $COUNT$(tput sgr 0)"

while true; do
    if [ $MAXCOUNT -gt $COUNT ]; then
        echo "$(tput setaf 2)$(tput bold)FILES AMOUNT = OK$(tput sgr 0)"
        exit
    else
        echo "$(tput setaf 1)$(tput bold)$(tput setab 7)AMOUNT OF FILES IS MORE THAN 90%!$(tput sgr 0)"
        echo "$(tput setaf 1)$(tput bold)$(tput setab 7)Sending e-mail Alert...$(tput sgr 0)"

        #Send message
        mail -s "FILES LIMIT ON SERVER XYZ" "your@email.com" <<< "There are more than 900k files of 1 mln files limit on the server XYZ"
        exit
    fi
done

 

When it comes to choose the right VPS or dedicated server for your solution, you may want to test its performance.

Some time ago, I stood before such choice. To optimize the testing process, I wrote a bash script for Ubuntu distributions based on SysBench.

  • You can also use it to test performance of any PC machine.
  • You will need root access.
  • Script will perform CPU, I/O and MySQL performance test, ten times each, so it should be 30 log files to take medium values and comapre with other machines results
#!/bin/bash

# Package sources update
apt-get update

sleep 5s

# mysql install and set root password to 123PAssword
debconf-set-selections <<< 'mysql-server mysql-server/root_password password 123PAssword'
sleep 1s
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password 123PAssword'
sleep 1s
apt-get -y install mysql-server

sleep 5s

# Installation of Sysench - benchmarking tool
apt-get install sysbench

sleep 1s

# create directory for logs
mkdir /root/sysbench_log/

# Create directory for CPU logs
mkdir /root/sysbench_log/cpu/

echo "Starting CPU test"

# 10x CPU test for up to 20 threads
for i in `seq 1 10`;
    do
        echo "test cpu $i"
        sysbench --test=cpu --cpu-max-prime=20000 --num-threads=2 run > /root/sysbench_log/cpu/$i.log
    done

    echo "CPU test finished"

# Create directory for I/O logs
mkdir /root/sysbench_log/io/

# Create 500MB sample file fot I/O test
sysbench --test=fileio --file-total-size=500M prepare

echo "Starting IO test"

# 10x I/O test
for i in `seq 1 10`;
    do
        echo "IO test $i"
        sysbench --test=fileio --file-total-size=500M --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run > /root/sysbench_log/io/$i.log
    done

    echo "IO test finished"

# Remove sample file
sysbench --test=fileio --file-total-size=500M cleanup

echo "Starting MySQL test"

# Create database
mysql -uroot -p123PAssword -e 'CREATE DATABASE test;' 

# Create directory for MySQL test logs
mkdir /root/sysbench_log/mysql/

# Creation of sample record in test database 
sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=123PAssword prepare

# 10x MySQL test
for i in `seq 1 10`;
    do
        echo "MySQL test $i"
        sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=123PAssword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run > /root/sysbench_log/mysql/$i.log
    done

    echo "MySQL test finished"

# Remove sample records form test database
sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-password=123PAssword cleanup

echo "All test finished. Check results at /root/sysbench_log/"

 

Related links:

 

I’m not a specialist in linux bash so if you spot a mistake, you have questions or suggestions feel free to write a comment below!