These forums are read-only!
one RoR app on 256MB slice
  • Hello there, I want to know if this is the normal behaviour for my brand new 256MB slice.
    I have followed all articles here for installing softs below, great stuff btw.

    Ubuntu 10.04 LTS, Apache2, passenger, Rails 2.3.5, Mysql 5.1

    Site is a demo app running : http://spreecommerce.com/

    Basically, all memory is used !

    ----------------
    free -m
    ----------------

    total used free shared buffers cached
    Mem: 268 263 4 0 1 15
    -/+ buffers/cache: 246 21
    Swap: 511 153 358


    -------------------
    passenger stats
    -------------------

    ----- Passenger processes ------
    PID VMSize Private Name
    --------------------------------
    28842 86.8 MB 0.1 MB /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/ApplicationPoolServerExecutable 0 /usr/lib/ruby/gems/1.8/gems/passenger-2.2.11/bin/passenger-spawn-server /usr/bin/ruby1.8 /tmp/passenger.28830
    28843 45.8 MB 0.6 MB Passenger spawn server
    28925 197.4 MB 0.2 MB Passenger ApplicationSpawner: /home/sox/apps/storeone
    29436 197.7 MB 100.3 MB Rails: /home/sox/apps/storeone
    ### Processes: 4
    ### Total private dirty RSS: 101.25 MB

    ---------- Apache processes ----------
    PID PPID VMSize Private Name
    --------------------------------------
    28830 1 148.9 MB 0.1 MB /usr/sbin/apache2 -k start
    28854 28830 149.1 MB 0.1 MB /usr/sbin/apache2 -k start
    28858 28830 149.0 MB 0.1 MB /usr/sbin/apache2 -k start
    28892 28830 149.2 MB 0.2 MB /usr/sbin/apache2 -k start
    28940 28830 149.1 MB 0.1 MB /usr/sbin/apache2 -k start
    29087 28830 148.9 MB 0.2 MB /usr/sbin/apache2 -k start
    29442 28830 148.9 MB 0.2 MB /usr/sbin/apache2 -k start
    29445 28830 148.9 MB 0.1 MB /usr/sbin/apache2 -k start
    ### Processes: 8
    ### Total private dirty RSS: 1.08 MB

    --------------------------------
    top
    --------------------------------
    top - 18:55:00 up 5 days, 21:29, 2 users, load average: 0.07, 0.06, 0.07
    Tasks: 77 total, 1 running, 76 sleeping, 0 stopped, 0 zombie
    Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 99.9%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st
    Mem: 274540k total, 267552k used, 6988k free, 1648k buffers
    Swap: 524280k total, 156220k used, 368060k free, 16428k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    29436 sox 20 0 208m 125m 2012 S 0 46.9 0:01.91 ruby1.8
    9892 mysql 20 0 240m 7384 2632 S 0 2.7 0:00.72 mysqld
    28925 sox 20 0 197m 3748 544 S 0 1.4 0:08.59 ruby1.8
    29087 www-data 20 0 149m 2428 1408 S 0 0.9 0:00.00 apache2
    29442 www-data 20 0 149m 2360 1492 S 0 0.9 0:00.00 apache2
    28843 root 20 0 46852 2308 700 S 0 0.8 0:03.33 ruby1.8
    28940 www-data 20 0 149m 2044 1232 S 0 0.7 0:00.00 apache2
    28854 www-data 20 0 149m 1828 1092 S 0 0.7 0:00.00 apache2
    28892 www-data 20 0 149m 1768 1096 S 0 0.6 0:00.00 apache2
    29445 www-data 20 0 149m 1700 1176 S 0 0.6 0:00.00 apache2
    28858 www-data 20 0 149m 1652 1036 S 0 0.6 0:00.00 apache2
    29648 sox 20 0 19140 1328 1024 R 0 0.5 0:00.00 top
    28973 sox 20 0 19368 980 696 S 0 0.4 0:00.03 bash
    28842 root 20 0 88972 860 584 S 0 0.3 0:00.00 ApplicationPool
    29638 www-data 20 0 148m 808 556 S 0 0.3 0:00.00 apache2

    TIA
  • 32bit or 64bit Ubuntu? By the Apache memory usage, it looks like 64bit. Try 32bit...

    There is no reason to use 64bit unless you have more than 3gb memory for the slice.
  • Thanx for your answer. I try that :

    file /sbin/init
    /sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

    so Its 64 bit ? I dont remember choosing , this option.
    you advice me to restart from scratch my configuration ?
  • FYI RoR is a memory hog, you will save some ram by going 32 bit (yes you are using 64 bit) but you still might have issues on a 256. Try ditching apache and using nginx.
  • Obs, this is really the only setup I have problem with Rails.
    I am trying REE right now, also I am used to nginx but wanted to give apache+passenger a try.

    but looking at my stats, apache does not seem to be a problem here. or I am wrong ?
  • ok REE does not change much.
    FYI, I have found that the app I am running : http://spreecommerce.com/
    is quite demanding, and 512 is a recommended amount of ram for start.
  • It looks like there are a lot of Apache processes running, this blog post has some good tweaks for setting up Apache and MySQL to use less RAM. The default configuration seems to assume you have much more that 256 MB.

    Other things that might help could be using Ruby Enterprise Edition, and this section of the passenger guide which talks about resource usage an optimization.