Ec2 memory usage

amazon ec2memory usage

I set up a site on amazon ec2 free tier, which comes with 613MB memory with no swap.
I see server uses almost 100% of memory all the time. My site is running wordpress with wp super disk cache turned on. and the site is not busy, about 300ip per day. Can anyone tell this is normal, or something goes wrong? Thanks!

free -m
             total       used       free     shared    buffers     cached
Mem:           596        589          7          0          0         14
-/+ buffers/cache:        574         22
Swap:            0          0          0

ps aux | grep "apache"
apache   10120  0.2  5.1 287908 31732 ?        S    10:41   0:19 /usr/sbin/httpd
apache   10122  0.2  4.9 288448 30504 ?        S    10:41   0:22 /usr/sbin/httpd
apache   10123  0.2  4.8 288380 29676 ?        S    10:41   0:20 /usr/sbin/httpd
apache   10124  0.2  5.1 287616 31708 ?        S    10:41   0:21 /usr/sbin/httpd
apache   10125  0.2  4.6 287428 28704 ?        S    10:41   0:20 /usr/sbin/httpd
apache   10126  0.2  5.2 288376 32372 ?        S    10:41   0:22 /usr/sbin/httpd
apache   10127  0.2  4.6 284028 28164 ?        S    10:41   0:21 /usr/sbin/httpd
apache   10207  0.2  5.3 288452 32396 ?        S    10:49   0:19 /usr/sbin/httpd
apache   10224  0.2  4.3 284520 26496 ?        S    10:50   0:19 /usr/sbin/httpd
apache   10226  0.2  5.1 287872 31640 ?        S    10:50   0:20 /usr/sbin/httpd
apache   10376  0.2  5.0 288340 30856 ?        S    11:03   0:16 /usr/sbin/httpd
apache   10453  0.2  5.2 288416 32384 ?        S    11:10   0:16 /usr/sbin/httpd
apache   10455  0.1  5.2 288124 32252 ?        S    11:10   0:15 /usr/sbin/httpd
apache   10457  0.2  4.8 288380 29676 ?        S    11:10   0:15 /usr/sbin/httpd
apache   10459  0.1  5.2 288636 32224 ?        S    11:10   0:14 /usr/sbin/httpd
apache   12106  0.2  4.8 288384 29536 ?        S    13:07   0:01 /usr/sbin/httpd
apache   12107  0.2  4.8 288380 29480 ?        S    13:07   0:02 /usr/sbin/httpd
apache   12110  0.2  4.8 288380 29496 ?        S    13:07   0:01 /usr/sbin/httpd

Best Answer

It probably wouldn't hurt to create a file system swap.

#!/bin/bash -e

# Set default variable values
: ${SWAP_SIZE_MEGABYTES:=1024}
: ${SWAP_FILE_LOCATION:=/var/swap.space}

if (( $SWAP_SIZE_MEGABYTES <= 0 )); then
    echo 'No swap size provided, exiting.'
    exit 1
elif [ -e "$SWAP_FILE_LOCATION" ]; then
    echo "$SWAP_FILE_LOCATION" already exists,  skipping.  
fi

if ! swapon -s | grep -qF "$SWAP_FILE_LOCATION"; then
    echo Creating "$SWAP_FILE_LOCATION", "$SWAP_SIZE_MEGABYTES"MB.
    dd if=/dev/zero of="$SWAP_FILE_LOCATION" bs=1024 count=$(($SWAP_SIZE_MEGABYTES*1024))
    mkswap "$SWAP_FILE_LOCATION"    
    swapon "$SWAP_FILE_LOCATION"
    echo 'Swap status:'
    swapon -s
else
    echo Swap "$SWAP_FILE_LOCATION" file already on.
fi

echo 'Done.' 

Source

Related Topic