Resolving shared server down because "killed for uid ram"


#1

Hello,

I have a shared server on dreamhost that runs www.speedview.co (the site uses WordPress and MyBB)

Dreamhost support has said that I am having problems with scripts. I am not an expert by any means (know enough to get myself into trouble) and could use some help troubleshooting this.

Here’s what Dreamhost say:

"> Hello,

Everything’s looking OK on the server:

minsk:~# uptime
�10:35:52 up 119 days, �9:56, �9 users, �load average: 3.64, 4.76, 4.94

So I checked into it a bit more and it seems that your scripts have been
getting automatically killed by our Process Watcher script due to your
sites going over memory limits on the shared server:

Sun Jan 15 06:30:15 2012 procwatch3 INFO: PID 17554 (php5.cgi)
speedowl:pg808296 - killed for uid ram"

WordPress is the latest version, and uses the following plugins:
Disable Comments (Saamir Shah)
Easy Columns (Pat Friedl)
Exclude Pages from Navigation (Simon Wheatley)
Expanding Text (Dagon Design)
Google Analytics for WordPress (Joost de Valk)
Google XML Sitemaps (Arne Brachhold)
Hyper Cache (Satollo)
NextGEN Gallery (Alex Rabe)
Page Links To (Mark Jaquith)
SlideDeck for WordPress - Slider Widget (digital-telepathy)

MyBB is the latest version, and uses the following plugins:
Google Analytics (1.5) (Sebastian Wunderlich)
Google SEO (1.6.2) (Andreas Klauer)

This was the first link that support suggested:
http://wiki.dreamhost.com/index.php/Finding_Causes_of_Heavy_Usage

I have a shell user, and can login with WinSCP then ‘open in putty’

I change the directory:

cd /home/speedowl/logs/speedview.co/http

I can paste the first command:

cat access.log| awk ‘{print $1}’ | sort | uniq -c |sort -n

It gives 10,000 hits from what I think are my own site, then the next IP is about 200 hits. The site is only seeing 100 hits/day, mostly referrals from car discussion forums.

I don’t think there’s anything wrong what that - nothing says ‘many many hits’

So I run the next command:

awk ‘{print $7}’ access.log|cut -d? -f1|sort|uniq -c|sort -nk1|tail -n10

This is what is says:
222 /forum/cache/themes/theme3/star_ratings.css
242 /wordpress/wp-includes/js/jquery/jquery.js
276 /forum/cache/themes/theme3/css3.css
285 /forum/cache/themes/theme3/global.css
320 /forum/images/1/on.gif
325 /wordpress/wp-content/plugins/slidedeck-lite-for-wordpress/skins/default/skin.css
411 /wordpress/wp-content/plugins/easy-columns/css/wp-ez-columns.css
436 /wordpress/wp-content/themes/twentyelevenchild/style.css
521 /forum/images/star.gif
902 /forum/images/1/off.gif

Nothing untoward there?

I get stuck trying to see what processes are running though.

The guide says to type:
for k in $(pgrep -u $USER | awk ‘{print $1}’) ; do echo ======== PID: $k ; cat /proc/$k/environ | tr ‘\000’ ‘\n’ ; done

I’ve tried it with a cd\ first to change directory to root:

[minsk]$ for k in $(pgrep -u $USER | awk ‘{print $1}’) ; do echo ======== PID: $k ; cat /proc/$k/environ | tr ‘\000’ ‘\n’ ; done
======== PID: 18110
cat: /proc/18110/environ: Permission denied
======== PID: 18115
SHELL=/bin/bash
SSH_CLIENT=86.148.205.210 55635 22
USER=speedowl
MAIL=/var/mail/speedowl
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
PWD=/home/speedowl
LANG=en_US.UTF-8
SHLVL=1
HOME=/home/speedowl
LOGNAME=speedowl
SSH_CONNECTION=86.148.205.210 55635 173.236.162.159 22
_=/usr/lib/openssh/sftp-server
======== PID: 31190
PATH=/usr/local/bin:/usr/bin:/bin
RAILS_ENV=production
======== PID: 33843
cat: /proc/33843/environ: Permission denied
======== PID: 33849
USER=speedowl
LOGNAME=speedowl
HOME=/home/speedowl
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
MAIL=/var/mail/speedowl
SHELL=/bin/bash
SSH_CLIENT=86.148.205.210 56179 22
SSH_CONNECTION=86.148.205.210 56179 173.236.162.159 22
SSH_TTY=/dev/pts/2
TERM=xterm
LANG=en_US.UTF-8
======== PID: 42494
cat: /proc/42494/environ: No such file or directory
======== PID: 42496
cat: /proc/42496/environ: No such file or directory

I’ve tried replacing $USER with speedowl to no effect

[minsk]$ for k in $(pgrep -u speedowl | awk ‘{print $1}’) ; do echo ======== PID: $k ; cat /proc/$k/environ | tr ‘\000’ ‘\n’ ; done
======== PID: 18110
cat: /proc/18110/environ: Permission denied
======== PID: 18115
SHELL=/bin/bash
SSH_CLIENT=86.148.205.210 55635 22
USER=speedowl
MAIL=/var/mail/speedowl
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
PWD=/home/speedowl
LANG=en_US.UTF-8
SHLVL=1
HOME=/home/speedowl
LOGNAME=speedowl
SSH_CONNECTION=86.148.205.210 55635 173.236.162.159 22
_=/usr/lib/openssh/sftp-server
======== PID: 31190
PATH=/usr/local/bin:/usr/bin:/bin
RAILS_ENV=production
======== PID: 33843
cat: /proc/33843/environ: Permission denied
======== PID: 33849
USER=speedowl
LOGNAME=speedowl
HOME=/home/speedowl
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
MAIL=/var/mail/speedowl
SHELL=/bin/bash
SSH_CLIENT=86.148.205.210 56179 22
SSH_CONNECTION=86.148.205.210 56179 173.236.162.159 22
SSH_TTY=/dev/pts/2
TERM=xterm
LANG=en_US.UTF-8
======== PID: 41786
cat: /proc/41786/environ: No such file or directory
======== PID: 41788
cat: /proc/41788/environ: No such file or directory

If I try cd /home/speedowl/logs/speedview.co/http to change directory, then run again:

[minsk]$ for k in $(pgrep -u $USER | awk ‘{print $1}’) ; do echo ======== PID: $k ; cat /proc/$k/environ | tr ‘\000’ ‘\n’ ; done
======== PID: 18110
cat: /proc/18110/environ: Permission denied
======== PID: 18115
SHELL=/bin/bash
SSH_CLIENT=86.148.205.210 55635 22
USER=speedowl
MAIL=/var/mail/speedowl
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
PWD=/home/speedowl
LANG=en_US.UTF-8
SHLVL=1
HOME=/home/speedowl
LOGNAME=speedowl
SSH_CONNECTION=86.148.205.210 55635 173.236.162.159 22
_=/usr/lib/openssh/sftp-server
======== PID: 31190
PATH=/usr/local/bin:/usr/bin:/bin
RAILS_ENV=production
======== PID: 33843
cat: /proc/33843/environ: Permission denied
======== PID: 33849
USER=speedowl
LOGNAME=speedowl
HOME=/home/speedowl
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
MAIL=/var/mail/speedowl
SHELL=/bin/bash
SSH_CLIENT=86.148.205.210 56179 22
SSH_CONNECTION=86.148.205.210 56179 173.236.162.159 22
SSH_TTY=/dev/pts/2
TERM=xterm
LANG=en_US.UTF-8
======== PID: 43847
cat: /proc/43847/environ: No such file or directory
======== PID: 43849
cat: /proc/43849/environ: No such file or directory

[minsk]$ for k in $(pgrep -u speedowl | awk ‘{print $1}’) ; do echo ======== PID: $k ; cat /proc/$k/environ | tr ‘\000’ ‘\n’ ; done
======== PID: 18110
cat: /proc/18110/environ: Permission denied
======== PID: 18115
SHELL=/bin/bash
SSH_CLIENT=86.148.205.210 55635 22
USER=speedowl
MAIL=/var/mail/speedowl
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
PWD=/home/speedowl
LANG=en_US.UTF-8
SHLVL=1
HOME=/home/speedowl
LOGNAME=speedowl
SSH_CONNECTION=86.148.205.210 55635 173.236.162.159 22
_=/usr/lib/openssh/sftp-server
======== PID: 31190
PATH=/usr/local/bin:/usr/bin:/bin
RAILS_ENV=production
======== PID: 33843
cat: /proc/33843/environ: Permission denied
======== PID: 33849
USER=speedowl
LOGNAME=speedowl
HOME=/home/speedowl
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
MAIL=/var/mail/speedowl
SHELL=/bin/bash
SSH_CLIENT=86.148.205.210 56179 22
SSH_CONNECTION=86.148.205.210 56179 173.236.162.159 22
SSH_TTY=/dev/pts/2
TERM=xterm
LANG=en_US.UTF-8
======== PID: 44058
cat: /proc/44058/environ: No such file or directory
======== PID: 44060
cat: /proc/44060/environ: No such file or directory

Where am I going wrong here please? Thanks![hr]
I’ve tried this plugin:

http://webjawns.com/tpc-memory-usage-for-wordpress/

All plugins on:
It says memory usage 28.5 Mb/256Mb in the footer
PHP memory limit: 90M
Wordpress memory limit: 32M

All plugins off:
It says memory usage 24.5 Mb/256Mb in the footer
NextGEN gallery is a fatty at almost 3 Mb
Everything else is using < 1 Mb

Sound reasonable?[hr]
The MyBB site uses about 7 Mb of memory. (it’s admin panel also says memory limit 90M)

MyBB and WordPress are both on the same user right now.

If I switch myBB to another user (same shared account) will this help? (how are memory limits handled at Dreamhost shared accounts?)

Thanks,


Marko


#2

Here’s the response from Dreamhost:

I’m happy to clarify!

"Moving domains to their own users will help, in that this memory is
measured per user, not per account/domain.

As to how much memory an install of Wordpress needs, that’s very
relative, which is to say not all Wordpress installs are equal. Ideally,
you should be fine, but it will be up to you to narrow down what is
causing this usage, or you’ll simply need to move to a VPS.

http://dreamhost.com/servers/compare-our-products/

Let me know if you have any questions!

Thanks!
Chris L"

Reading between the lines:

“Tips to reduce WordPress memory usage” is just a wild goose chase. There is enough memory allocated on a Dreamhost shared account to run an ultra-basic WordPress site with no plugins - just/in theory. In practice, if you want to do it with Dreamhost you need to buy their VPS.

It would be great if Dreamhost were more upfront about this in the first place. “Sorry, you can’t run anything that needs CPU/memory on a shared server - stick to static HTML and files”

A VPS would be a pain in the bum - I’m not interested in the geekery involved. What I’d like is a shared server with more memory allocated - but Dreamhost don’t offer that.

I am moving the site to a new host that guarantees 1 Gb disk / 30 Gb bandwidth / 128 Mb PHP RAM. (I’ll leave my personal site with dreamhost though)

Tip for future newbies:

Don’t do www.domain.com/imagestohotlink, www.domain.com/wordpress/ and www.domain.com/forum/ all under ‘user’

Instead, set the site up as www.images.domain.com/images/ on user ‘images’ then www.wordpress.domain.com/wordpress/ on user ‘wordpress’ and www.forum.domain.com/forum/ on user ‘forum’ - it’ll be a bit of a pain administratively, but what it does do is give you 3 lots of memory to play with. I think it’s still a little marginal with a wordpress site though.


#3

That wasn’t too bad at all.

Download site from dreamhost over ftp.
Export the the ‘forum’ and ‘wordpress’ databases from phpmyadmin

Switch nameservers

Upload the site to nethosted over ftp.
Import the ‘forum’ and ‘wordpress’ databases from phpmyadmin

Ask for help; nethosted tweaked the settings for me in < 10 mins.

Painless. :smiley: