Welcome to WebmasterWorld Guest from 23.20.241.155

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to use less server memory?

     
2:22 pm on Oct 18, 2011 (gmt 0)

5+ Year Member



I've been advised by my hosting company that my site is almost hitting the max amount ram (1gb).

My site is self-built so there is probably potential for optimization here, but where should I start looking - any common mistakes? Any way I can find out what is using so much?

Any advice greatly appreciated!
4:01 pm on Oct 18, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



If this is a Linux box, using the
top
command from the shell will tell you which processes are hogging your memory (press the < or > on your keyboard until the list is sorted by %MEM). First and foremost, look carefully for processes you don't need, and disable those. Then monitor the process list for a while to see if there are any processes that take up a disproportionate amount of memory. Also check your cron tab for any jobs that are non-essential.

If you tell us a bit more about the server and website environment, we might be able to look into this in more detail.
4:28 pm on Oct 18, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Are you doing this, or something like it?

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?variable=$1

What is happening here is it searches the entire file system twice and is extremely resource intensive. See post #4274745 in this thread [webmasterworld.com] for one efficient way to fix this. It's a pretty good place to start. :-)

The "cliff notes" of the solution is stupidly simple. Nearly all of your files - images, css, javascript - will have a dot. Your page requests probably won't (or shouldn't, or may be restricted to .html or whatever.) So if it doesn't have a dot, do the rewrite.

RewriteRule ^([^.]+)$ /index.php?variable=$1 [L,QSA]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month