Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID
Advertise on LowEndTalk.com

In this Discussion

Wordpress & 32MB Of Ram.. -- Assistance?

Wordpress & 32MB Of Ram.. -- Assistance?

eastoncheastonch Member
edited July 2012 in General

Hi guys, I currently own a prometeus VPS with 128MB of ram, but. I'm using this as a test bench for my IPXCore, until that's back up and running.

I'm finding it rather hard to acheive a WP blog with less than 32MB of ram -- I got one running, with MySQL taking 15%, Apache taking 15% memory and using just under 100MB of ram.

Here's my PS AUX for anybody who might be able to help. I have heard that NGINX might be a better option -- Opinion?

 
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1   2028   168 ?        Ss   01:17   0:00 init [2]
root         2  0.0  0.0      0     0 ?        S    01:17   0:00 [kthreadd/578]
root         3  0.0  0.0      0     0 ?        S    01:17   0:00 [khelper/578]
root       461  0.0  0.6   9208   812 ?        Ss   01:17   0:00 /usr/sbin/nmbd
root       488  0.0  0.8  16556  1164 ?        Ss   01:17   0:00 /usr/sbin/smbd
root       489  0.0  0.0   8668   100 ?        Ss   01:17   0:00 /usr/sbin/sasla
root       492  0.0  0.0   8668    16 ?        S    01:17   0:00 /usr/sbin/sasla
root       496  0.0  0.0   5368    96 ?        S    01:17   0:00 supervising sys
root       497  0.0  1.3   6008  1776 ?        Ss   01:17   0:01 /usr/sbin/syslo
root       505  0.0  0.3  16556   416 ?        S    01:17   0:00 /usr/sbin/smbd
root       526  0.0  0.2   2084   300 ?        Ss   01:17   0:00 /usr/sbin/dropb
bind       553  0.0  1.0  48876  1388 ?        Ssl  01:17   0:00 /usr/sbin/named
root       580  0.0  0.1   2392   144 ?        Ss   01:17   0:00 /usr/sbin/xinet
root       592  0.0  0.4   2676   548 ?        S    01:17   0:00 /bin/sh /usr/bi
root       626  0.0  0.4  10600   544 ?        Ss   01:17   0:01 sendmail: MTA:
mysql      715  0.0  3.0 156040  4004 ?        Sl   01:17   0:08 /usr/sbin/mysql
root       716  0.0  0.0   1668    16 ?        S    01:17   0:00 logger -t mysql
root       851  0.0  0.7  36964  1036 ?        Ss   01:17   0:01 /usr/sbin/apach
www-data   861  0.1 15.2  54396 20048 ?        S    01:17   0:55 /usr/sbin/apach
root       880  0.0  0.2   2288   320 ?        Ss   01:17   0:00 /usr/sbin/cron
www-data   900  0.1 14.2  54372 18676 ?        S    01:17   0:55 /usr/sbin/apach
www-data   942  0.1 15.3  54396 20096 ?        S    01:35   0:53 /usr/sbin/apach
root      5503  2.1  0.8   2400  1116 ?        Ss   14:29   0:00 /usr/sbin/dropb
root      5504  0.0  1.2   2960  1604 pts/0    Ss   14:29   0:00 -bash
root      5508  0.0  0.7   2348   932 pts/0    R+   14:29   0:00 ps aux

And Free -m...


             total       used       free     shared    buffers     cached
Mem:           128         79         48          0          0         23
-/+ buffers/cache:         55         72
Swap:          128         26        101

And HTOP image

Systems Administrator | IWFHosting

Comments expressed are solely my own opinion and not of that of the companies, unless stated.

Tagged:
«1

Comments

  • Give the output of free -m

    The Original Daniel.

  • rds100rds100 Member

    Why do you need mysqld? Sqlite might be an option. Also - you have samba running there??? Why? And why apache?

    Thanked by 1rm_
  • Daniel, pop on skype? -- Also, post updated to include info.

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • BluBoyBluBoy Member

    We'd need to see your my.cnf, nginx.conf and php.ini/php-fpm.conf files.

    I have it running comfortably on a 128MB VPS (ignore the recent surge in 'other'... Just doing some testing)

    image

    Checkout my blog. I review VPS providers and mess around with Debian and FreeBSD!

  • jcalebjcaleb Moderator

    use minstall first

    Twitter Bootstrap Themes for your software projects. I recommend Prometeus and Catalyst Host

  • Going to migrate to Nginx... Will post results :']

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • jcalebjcaleb Moderator

    minstall will optimize memory usage. even also mysql

    Twitter Bootstrap Themes for your software projects. I recommend Prometeus and Catalyst Host

  • edited July 2012

    purge apache samba bind9 portmap install nginx

    and then tweak the mysql /etc/mysql/conf.d/lowend.cnf :

    [mysqld] key_buffer = 16K max_allowed_packet = 1M table_cache = 4 sort_buffer_size = 64K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 2K thread_stack = 64K default-storage-engine = MYISAM skip-innodb thread_concurrency = 2

    You could get less memory if you use Openvz. But ofcourse using Minstall will lower your memory usage :)

    My blog | Server Uptime | I'm not working for any providers in here, all my comments just my own opinion.image
  • Using OVZ ;'] and thanks, i'll take it into consideration. I tried the LeS -- Seemed to break for me; I had VirtualHosts working fine with Apache, how do I do such a thing with NGINX? I've never actually played with it, and I Was using A2ENSITE to setup the websites. Is it similar? :S

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • @dmmcintyre3 is the man to speak to about this. He got WP running on a 16MB OpenVZ vps with vSwap.

  • What os do you use?

    My blog | Server Uptime | I'm not working for any providers in here, all my comments just my own opinion.image
  • jcalebjcaleb Moderator

    @dmmcintyre3 please post tutorial for wp

    Twitter Bootstrap Themes for your software projects. I recommend Prometeus and Catalyst Host

  • @BluBoy what script is that? Looks hot.

    I use http://tuxlite.com to configure all my VPSes and I love it!

  • MaouniqueMaounique Member
    edited July 2012

    It can be done in 32 MB ram, but it is not the idle stuff that matters, but actually the visitors take RAM. IMO 64 MB will be enough for 3-4 visitors without using much swap. Anything above 1 will make 32 go wild on abusing resources, with very careful tweaking maybe you can hold 2, perhaps 3 if they read slowly. Any more tweaking than that is art and cant be really put into a tutorial :P M

    top - 22:32:38 up 906 days, 2:58, 1 user, load average: 3.94, 5.13, 8.38

  • @Maounique said: It can be done in 32 MB ram, but it is not the idle stuff that matters, but actually the visitors take RAM. IMO 64 MB will be enough for 3-4 visitors without using much swap. Anything above 1 will make 32 go wild on abusing resources, with very careful tweaking maybe you can hold 2, perhaps 3 if they read slowly. Any more tweaking than that is art and cant be really put into a tutorial :P M

    You could do more than that, sorta.

    Presuming that the WordPress site is largely static, and you aren't posting much daily, you could set NGINX to cache everything (excluding the wp-admin folder) therefore reducing the PHP/MySQL requests dramatically.

    If LowEndBox didn't have comments, for example, then that would work perfectly.

  • If we speak of concurrent 2-3 ppl at a time, then it cant be that static. Unless you disable comments or something. M

    top - 22:32:38 up 906 days, 2:58, 1 user, load average: 3.94, 5.13, 8.38

  • @ElliotJ said: If LowEndBox didn't have comments, for example, then that would work perfectly.

    Or if we used Disqus or something like FB Comments ;)

    I use http://tuxlite.com to configure all my VPSes and I love it!

  • Valid points -- However I was hoping for a comments section, but this could be acheived through DisQus or something similar. Posts would be made infrequently, mainly any "tech" shit i get involved in, VPS Reviews, etc.. -- I'd have Crayon Syntax hilightling for PHP; bash; etc.

    So -- that's additional memory usage there.

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • @djvdorp said: Or if we used Disqus or something like FB Comments ;)

    In that case, ditch WordPress and go for something like Jekyll or Octopress. :) Oh and use thttpd.

    Thanked by 1djvdorp
  • @ElliotJ said: In that case, ditch WordPress and go for something like Jekyll or Octopress. :) Oh and use thttpd.

    I see your point ;)

    I use http://tuxlite.com to configure all my VPSes and I love it!

  • FlatPress looked appealing, or should i saw appaling? ;']

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • @ElliotJ said: go for something like Jekyll

    that seems insanely cool... it's even possible to export posts directly from emacs' org-mode... thanks for heads up

  • eastoncheastonch Member
    edited July 2012

    Ok, so I slapped a few changes on, used minstall for optimal, installed Wordpress, got it to using 38.5MB idle with me browsing from my home net..

    This is literally a fresh install, minstall'd and wordpress slapped on with some Nginx config.

    here's my new HTOP... Anybody feel like giving me some further optimization? I feel like I could lose fail2ban and go for something more lightweight, not sure though.. thoughts?

    MySQL seems optimized as far as I can go, using it without INNODB and other bloat, used minstall to configure the optimization of it.

    php-fpm: pool chris seems to be using the most out of anything, that's clearly the php service, right?

    image

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • Yes, with Minstall, we serve the php file using php5-fpm

    My blog | Server Uptime | I'm not working for any providers in here, all my comments just my own opinion.image
  • jcalebjcaleb Moderator

    Could you share your mysql config?

    Twitter Bootstrap Themes for your software projects. I recommend Prometeus and Catalyst Host

  • I can't see how my MySQL config would help, since it's using minimal memory, is there any optimisation techniques for PHP5-FPM? @ErawanArifNugroho

    Also.. My MySQL Config, @jcaleb

    [client]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    
    [mysqld]
    bind-address = 127.0.0.1
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    user = mysql
    basedir = /usr
    datadir = /var/lib/mysql
    language = /usr/share/mysql/english
    pid-file = /var/run/mysqld/mysqld.pid
    skip-external-locking
    tmpdir = /tmp
    
    [mysqldump]
    quick
    max_allowed_packet = 16M
    
    [myisamchk]
    key_buffer_size = 8M
    sort_buffer_size = 8M
    
    !includedir /etc/mysql/conf.d/
    

    inside the conf.d .... innodb.cnf

    [mysqld]
    default-storage-engine = myisam
    innodb = off
    

    inside lowmem.cnf

    [mysqld]
    key_buffer_size = 8M
    max_allowed_packet = 1M
    max_connections = 20
    max_heap_table_size = 4M
    net_buffer_length = 2K
    query_cache_limit = 256K
    query_cache_size = 4M
    read_buffer_size = 256K
    read_rnd_buffer_size = 256K
    sort_buffer_size = 64K
    table_open_cache = 256
    thread_stack = 128K
    

    inside mysqld_safe_syslog.cnf

    [mysqld_safe]
    syslog
    

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • @Maounique said: It can be done in 32 MB ram, but it is not the idle stuff that matters, but actually the visitors take RAM.

    So true :)

  • @Sleddog & @Maounique I got it idle at around 12MB, but as soon as somebody accesses the website, it jumps to 38MB and creeps to 50-66mb upon extra visitors..

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • @eastnoch : The PHP5-FPM is already optimized if we are using Minstall :) I'm using it also for running my blog which running in a KVM vps from Prometeus.

    My blog | Server Uptime | I'm not working for any providers in here, all my comments just my own opinion.image
  • @ErawanArifNugroho True, but there must be further methods to reduce it's usage.

    @MrLadoodle had his running quite slim, can't remember how he did it tho.

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • jcalebjcaleb Moderator
    edited July 2012

    mysql seems ok. can you run ps_mem.py (www.pixelbeat.org/scripts/ps_mem.py). this will show how much they really eat for each software.

    edit: i believe its php5-fpm eating ram. try decrease memory_limit in php config file.

    Twitter Bootstrap Themes for your software projects. I recommend Prometeus and Catalyst Host

  • eastoncheastonch Member
    edited July 2012

    @jcaleb

    
    root@my128pro:~# python ps_mem.py
     Private  +   Shared  =  RAM used       Program
    
      4.0 KiB +   7.5 KiB =  11.5 KiB       logger
      4.0 KiB +  17.0 KiB =  21.0 KiB       mysqld_safe
     52.0 KiB +  15.5 KiB =  67.5 KiB       init
     84.0 KiB +  34.0 KiB = 118.0 KiB       cron
     88.0 KiB +  35.5 KiB = 123.5 KiB       exim4
     92.0 KiB +  41.5 KiB = 133.5 KiB       syslogd
    356.0 KiB +  99.5 KiB = 455.5 KiB       ntpd
      1.0 MiB +  98.0 KiB =   1.1 MiB       nginx (2)
      1.0 MiB + 182.0 KiB =   1.2 MiB       bash
      1.7 MiB + 547.0 KiB =   2.3 MiB       sshd (2)
      3.1 MiB +  67.5 KiB =   3.2 MiB       mysqld
     10.5 MiB +  11.8 MiB =  22.3 MiB       php5-fpm (4)
    ---------------------------------
                             31.0 MiB
    =================================
    
    

    After setting memory limit to 16 mb and restarting... (was 128)

    image

    root@my128pro:~# python ps_mem.py
     Private  +   Shared  =  RAM used       Program
    
     84.0 KiB +  46.5 KiB = 130.5 KiB       logger
    164.0 KiB +  63.5 KiB = 227.5 KiB       init
    156.0 KiB +  73.5 KiB = 229.5 KiB       syslogd
    276.0 KiB +  78.0 KiB = 354.0 KiB       cron
    424.0 KiB +  72.5 KiB = 496.5 KiB       exim4
    280.0 KiB + 303.5 KiB = 583.5 KiB       mysqld_safe
    528.0 KiB + 327.0 KiB = 855.0 KiB       bash
    712.0 KiB + 244.5 KiB = 956.5 KiB       ntpd
    876.0 KiB + 695.0 KiB =   1.5 MiB       nginx (2)
      1.7 MiB + 595.0 KiB =   2.3 MiB       sshd (2)
      6.9 MiB + 131.5 KiB =   7.0 MiB       mysqld
     19.0 MiB +  13.1 MiB =  32.1 MiB       php5-fpm (4)
    ---------------------------------
                             46.8 MiB
    =================================
    

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • @eastonch said: here's my new HTOP... Anybody feel like giving me some further optimization? I feel like I could lose fail2ban and go for something more lightweight, not sure though.. thoughts?

    MySQL seems optimized as far as I can go, using it without INNODB and other bloat, used minstall to configure the optimization of it.

    php-fpm: pool chris seems to be using the most out of anything, that's clearly the php service, right?

    If you want to run in 32MB first thing you do is get rid of all non-esential services. So get rid of fail2ban and ntpd (ntpd is no use on an OpenVz box anyway), and anything else that's hiding out of sight in that htop pic :)

    Replace sshd with dropbear.

    Squeeze mysql even more in that lowmem.cnf, e.g.,

    [mysqld]
    key_buffer_size = 512K
    max_connections = 5
    query_cache_size = 1M
    table_open_cache = 64

    Performance will suffer but that's the price you have to pay.

    You have two php-fpm pools: 'chris' and 'www-data'. If 'chris' is serving your website, disable the 'www-data' pool.

    The memory size of the 'chris' php-fpm pool is determined by the size of the PHP scripts running there -- Wordpress. So disable any non-essential features/addons in Wordpress to (try to) slim it down. Restart php-fpm to see if there's difference.

    At the end of the day you'll have to face the fact the 32MB is too little to run a production Wordpress site. Overall, the system mods you make to get it running will negatively affect site performance and vistor experience. The answer is a bigger VPS... or a smaller blog :)

  • jcalebjcaleb Moderator
    edited July 2012

    try make pm static and pm.start_servers = 1 in php config and also make way to remove www-data pool

    Twitter Bootstrap Themes for your software projects. I recommend Prometeus and Catalyst Host

  • DamianDamian Member

    @BluBoy: What graphing system is that?

    @eastonch: is this OpenVZ? If so, running ntpd won't do much, since containers aren't allowed to set their own times; instead, they inherit the host node's time.

    I am no longer affiliated with IPXcore.
  • PHP-cgi will use less RAM them PHP-fpm

    The Original Daniel.

  • BluBoyBluBoy Member

    @Damian said: What graphing system is that?

    It's just RRDTool. I have been playing around with it recently and don't mind the result (If you look under the "THRIFTYDEVIL MONITORING" sidebar section on my blog, there are a few other ones I have been trying out).

    https://www.thriftydevil.com.au/

    Checkout my blog. I review VPS providers and mess around with Debian and FreeBSD!

  • Ok, removed some MySQL stuffs, disabled the second pool from the /etc/php5/fpm/pool.d/www-data

    But now I have this...

    Why do i have two pools? http://screensnapr.com/e/Yhddf0.png

    Here's my config file for "chriseaston.info" in the pool.d http://screensnapr.com/e/MWvwxF.png

    Thanks.

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • Ok, so I gave up on Wordpress, being that MySQL is always going to be a memory chomper...

    FlatPress does everything I need, and it runs it at 17MB, after removal of MySQL. Since there's not as much to load, except static pages, the entire PHP-FPM takes much less too.

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • Not two pools, two PHP processes (in the chris pool). With pm = dynamic PHP will spawn additional processes to handle traffic, up to the maximum set by pm.max-children.

  • Static was generating much more processes... Is this normal?

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • yomeroyomero Member
    edited July 2012

    PHP with 128MB or 96MB in the config is ok for wordpress. Just use the ondemand scheduler to free some memory if gets idle. And limit the max children.

    If your server never gets idle, then better to stick with the dynamic, as @sleddog says

  • @Yomero -- I had it running fine, it was just using more than 32MB -- I wanted to limit it as much as possible to install a WP Blog on my 32Mb IPX box :']

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • @eastonch said: FlatPress does everything I need

    I haven't looked at Flatpress for ages. Just googled it now and for flatpress.org I see "This site may be compromised"...?

    https://www.google.com/search?q=FlatPress

  • yomeroyomero Member

    @eastonch said: I wanted to limit it as much as possible to install a WP Blog on my 32Mb IPX box :']

    But is a KVM right? Already uses some RAM for the kernel and so. Also, you can periodically purge some hidden caches, google for "drop_caches" and use the value 3.

  • it's not a KVM :'] @Sleddog -- I noticed that too, doesnt pop up when visiting.

    Drop_Cache's wasnt allowed on OVZ, well atleast, this box :S

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • @yomero said: But is a KVM right? Already uses some RAM for the kernel and so. Also, you can periodically purge some hidden caches, google for "drop_caches" and use the value 3.

    IPX is OpenVz. For KVM, don't do "drop_caches", it kills the benefit of caching. Better to increase /proc/sys/vm/vfs_cache_pressure, which will cause the kernel to be more agressive in reclaiming memory from cache-usage when more memory is requested.

  • netomxnetomx Member

    @eastonch said: Ok, so I gave up on Wordpress

    I will try it when I got my 32mb server back XD

    Referral links: DigitalOcean referral link | Get 500MB free with Dropbox | I sell domains with Google Apps, $1 p/ user
  • People have mentioned that using PHP_CGI would be better than FPM. Not sure :/

    Systems Administrator | IWFHosting

    Comments expressed are solely my own opinion and not of that of the companies, unless stated.

  • yomeroyomero Member

    @sleddog said: IPX is OpenVz

    Yes, I know. I mean, the current server in question.

    @sleddog said: Better to increase /proc/sys/vm/vfs_cache_pressure

    Interesting. Because the freaking kernel really uses that memory =/

Sign In or Register to comment.