Be a Supporter!

Help with configuring a low end box

  • 974 Views
  • 10 Replies
New Topic Respond to this Topic
ZiggyZack99
ZiggyZack99
  • Member since: Apr. 15, 2007
  • Offline.
Forum Stats
Member
Level 15
Melancholy
Help with configuring a low end box 2011-12-10 23:30:46 Reply

Hey guys, I recently purchased a cheap KVM VPS to run my sites and IRC scripts on. The uptime of the physical machine is perfect, but I keep running in to the memory limit, especially with MySQL and Apache. I'm a novice to Linux administration, so I was hoping you folks could help.
Here's the output of `free` while the VPS is idle:

> free
             total       used       free     shared    buffers     cached
Mem:        126500     113024      13476          0       6028      41208
-/+ buffers/cache:      65788      60712
Swap:       242680      24080     218600

With the help of LowEndBox, I've already taken a few steps, like uninstalling portmap, replacing rsyslog with inetutils-syslogd, tweaking my.cnf to the lowest runnable settings, and lowering the number of Apache slaves. I've also uninstalled oidentd and I've decided to use SFTP in OpenSSH instead of running a standalone ftpd. However, I'm still hovering uncomfortably close to the 128MB limit.
Any pointers?
Output of `ps aux`: http://pastebin.com/1eghcJ46
I'm running Debian 6, PHP 5, Apache 2, MySQL 5, Webmin 1.5, supybot, a PHP IRC bot I wrote, OpenSSH 5.5, ZNC, and I think that's it.


n/a

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Help with configuring a low end box 2011-12-11 04:19:13 Reply

unless you need a mail server you could also uninstall postfix

ZiggyZack99
ZiggyZack99
  • Member since: Apr. 15, 2007
  • Offline.
Forum Stats
Member
Level 15
Melancholy
Response to Help with configuring a low end box 2011-12-11 11:43:03 Reply

At 12/11/11 04:19 AM, kiwi-kiwi wrote: unless you need a mail server you could also uninstall postfix

Well, I have to be able to send mail from PHP scripts. That's the only reason I have it installed in the first place.


n/a

citricsquid
citricsquid
  • Member since: Jun. 25, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to Help with configuring a low end box 2011-12-11 12:42:21 Reply

At 12/11/11 11:43 AM, ZiggyZack99 wrote:
At 12/11/11 04:19 AM, kiwi-kiwi wrote: unless you need a mail server you could also uninstall postfix
Well, I have to be able to send mail from PHP scripts. That's the only reason I have it installed in the first place.

Fuck sending mail from a web server. If you don't invest time and energy into doing it right you deliverability will be shite, it's a waste of time. Try out something like Postmark or Mailgun or Sendgrid or Amazon SES. They're so cheap you've no reason to be running a mail server on your machine.

citricsquid
citricsquid
  • Member since: Jun. 25, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to Help with configuring a low end box 2011-12-11 12:52:04 Reply

Furthermore if you're aiming to use the least resources move away from Apache. Nginx is fantastic and in my own experience uses less resources.

http://www.wikivs.com/wiki/Apache_vs_ngi nx
http://nginx.org/en/download.html

ZiggyZack99
ZiggyZack99
  • Member since: Apr. 15, 2007
  • Offline.
Forum Stats
Member
Level 15
Melancholy
Response to Help with configuring a low end box 2011-12-13 22:31:41 Reply

At 12/11/11 12:52 PM, citricsquid wrote: Furthermore if you're aiming to use the least resources move away from Apache. Nginx is fantastic and in my own experience uses less resources.

http://www.wikivs.com/wiki/Apache_vs_ngi nx
http://nginx.org/en/download.html

Well, I took a few days to figure out how to do SSL and PHP and stuff with nginx. This morning, I scraped all the traces of Apache out of my system (well over 100 packages removed using apt) and put my shining new nginx server on port 80. It seems like it's running perfectly, and my memory usage is lower than it's been in weeks. Thank you so much. Configuring nginx is a breeze compared to Apache, and it runs so much better too.
I'll look in to outsourcing my e-mail, however, I'd rather not pay for something I can do for free. Postfix seems pretty efficient, and at least some of the mail is delivered intact lol


n/a

AndyPerfect
AndyPerfect
  • Member since: Jan. 13, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Help with configuring a low end box 2011-12-14 11:48:47 Reply

Configuring nginx is a breeze compared to Apache, and it runs so much better too.

I assume you've heard of xampp? I recently set up a webserver on a linux box I have sitting next to me right now and it really couldn't have been any easier to get apache set up using xampp.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Help with configuring a low end box 2011-12-14 13:02:24 Reply

At 12/14/11 11:48 AM, AndyPerfect wrote:
Configuring nginx is a breeze compared to Apache, and it runs so much better too.
I assume you've heard of xampp? I recently set up a webserver on a linux box I have sitting next to me right now and it really couldn't have been any easier to get apache set up using xampp.

You should never be using Xampp (or any similar products, such as EasyPHP) for servers.
The only justifiable reason to is for testing or hobby servers. If you're at all concerned with performance then you need to manage Apache on your own; not have a program eat up your resources doing it for you.

ZiggyZack99
ZiggyZack99
  • Member since: Apr. 15, 2007
  • Offline.
Forum Stats
Member
Level 15
Melancholy
Response to Help with configuring a low end box 2011-12-14 16:15:25 Reply

At 12/14/11 11:48 AM, AndyPerfect wrote:
Configuring nginx is a breeze compared to Apache, and it runs so much better too.
I assume you've heard of xampp? I recently set up a webserver on a linux box I have sitting next to me right now and it really couldn't have been any easier to get apache set up using xampp.

Configuring Apache isn't difficult, it's just that configuring nginx is so much easier. The problem with Apache was that it was forcing some apps into swap because it's a horribly inefficient software, especially if your server isn't running on top-notch hardware and you don't really have resources to spare.
Also, yeah. XAMPP seems like kind of a waste to me, especially if you're on Linux where superior configuration and maintenance tools are a dime a dozen.


n/a

AndyPerfect
AndyPerfect
  • Member since: Jan. 13, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Help with configuring a low end box 2011-12-15 02:02:33 Reply

At 12/14/11 01:02 PM, Diki wrote:
At 12/14/11 11:48 AM, AndyPerfect wrote:
Configuring nginx is a breeze compared to Apache, and it runs so much better too.
I assume you've heard of xampp? I recently set up a webserver on a linux box I have sitting next to me right now and it really couldn't have been any easier to get apache set up using xampp.
You should never be using Xampp (or any similar products, such as EasyPHP) for servers.
The only justifiable reason to is for testing or hobby servers. If you're at all concerned with performance then you need to manage Apache on your own; not have a program eat up your resources doing it for you.

I guess I never have personally managed a webserver that gets any kind of heavy load so I haven't seen any problems with running the Apache bundled with the other resources. Is the difference really that noticeable though? I can't imagine that choosing one over the other would yield vast differences in performance.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Help with configuring a low end box 2011-12-15 09:35:09 Reply

At 12/15/11 02:02 AM, AndyPerfect wrote: Is the difference really that noticeable though? I can't imagine that choosing one over the other would yield vast differences in performance.

In theory: yes. In practice: sort of.
It will really boil down to how many users are viewing your webpage, how complex the scripts being executed on your server are, and the specs of the server itself.

You could very well use Xampp and never have an issue, even on a server that sees a lot of traffic.
However: it does use more resources, as it has to manage a lot of processes for you.

Think of it kind of like this: you could write all of your website's code using foreach() loops, opposed to for() or while() loops, without noticing any detrimental effects, even though a foreach() loop is drastically slower than a for() loop.
In theory that could really end up biting you in the ass, but in practice using a foreach() loop probably won't cause you any issues. They should still only ever be used when they are specifically required, though.

P.S. I'm not slighting foreach() loops. When used properly they're fantastic.