Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Mar 13, 2010 3:09 pm 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
Hello, my firt VPS, it's been a long week trying to get everything to work. I finally managed to get everything working, have 3 sites so far on linode 360, but now I need to optimize memory usage.

Runing free -m (I know about http://www.linuxatemyram.com :) and -/+ buffers/cache) shows me that I have 275mb free out of my 360. And at the moment there is only one visitor on all 3 of my sites!!!

I'm using Textpattern CMS on 2 sites.

So far I've read and done this:

- MySQL Low-memory settings

- Apache 2 Low-Memory Settings

What else should I do?

I've read here on the forum that Linode 360 if propery configured, can handle a lot of pages per day, really lot!

Can you please post a link, or tell me what else should I do, and why I have 80mb used, when my sites have almost no visitors? (I know that Ubuntu takes some, but still...)

Thank you very much for any help!


Top
   
 Post subject:
PostPosted: Sat Mar 13, 2010 4:53 pm 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
Found this advices on a previous topic:
_______________________

1. /etc/php.ini -- set memory_limit to something lower, like "16M" (note that if it's too low, Wordpress won't run)

2. Use MySQL settings for "small" systems, see the settings in /usr/share/mysql/my-small.cnf

3. Try turning off "KeepAlive" in Apache, or keep it on but set the KeepAliveTimeout to a lower value like 5 (the default is 15 seconds). This is set in /etc/httpd.conf
_________________________

I don't know if that helped me, but I set KeepAliveTimeout to 5, (on apache2 it's in /etc/apache2/apache2.conf) and memory_limit in php.ini on 16mb (is this ok?) and now I have 297mb free.

I don't understand the 2. one...


Top
   
 Post subject:
PostPosted: Sat Mar 13, 2010 7:57 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
The amount of RAM in use is not directly proportional to the number of concurrent visitors. Even if you had zero visitors, you'd still use dozens of megabytes of RAM. That's simply because the various server processes (Apache, MySQL, etc.) need to reside in memory all the time, waiting to serve the first visitor at a microsecond's notice.

IMHO, there isn't much point trying to get your memory usage below current levels. As I said above, just because you're using 80M to serve 1 user, it doesn't mean you'll need 800M to serve 10 users. With proper configuration, memory usage will increase to a certain extent and then flatten out.

Make the most out of the RAM you paid for. Using excessively minimal settings will only hurt performance.

1. Pay attention to the "key_buffer" setting in /etc/mysql/my.cnf

If this server is only used for PHP sites, you can safely assign up to 1/4 of your RAM to "key_buffer".

2. Pay attention to the "MaxClients" setting in /etc/apache2/apache2.conf

Try 15. That'll probably keep Apache's total memory usage under control even with a lot of traffic.

3. Install munin.

That'll allow you to monitor memory usage and various other statistics over time.


Top
   
 Post subject:
PostPosted: Sun Mar 14, 2010 2:56 pm 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
hybinet wrote:
Make the most out of the RAM you paid for.


Thats exactly what I want to do :)

1. what do you mean by "if this server is only used for PHP sites"? Yes, I have sites with php/mysql and some static html/css sites. I will not have sites that use Ruby, or Pearl or something else. Is that what you meant?

2. MaxClients - it was 24, I changed to 15

3. found this tutorial about instaling and using munin. Do I need to install both client and server, or do I need just the client?

Thanks for the advices.


Top
   
 Post subject:
PostPosted: Sun Mar 14, 2010 4:08 pm 
Offline
Newbie

Joined: Thu Aug 06, 2009 7:24 pm
Posts: 4
AndrijaM wrote:
3. found this tutorial about instaling and using munin. Do I need to install both client and server, or do I need just the client?


You need both. The client collects data and the server aggregates and presents it.


Top
   
 Post subject:
PostPosted: Sun Mar 14, 2010 5:16 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
AndrijaM wrote:
what do you mean by "if this server is only used for PHP sites"? Yes, I have sites with php/mysql and some static html/css sites. I will not have sites that use Ruby, or Pearl or something else. Is that what you meant?


That's what I meant. You have Apache with PHP, you have MySQL, and you have nothing else, right? No email server with aggressive virus and spam filtering, no Rails, no Django, no resource-hungry control panel, nothing else to eat up your precious RAM. (Postfix listening only on localhost and used only for sending emails from PHP is okay.)


Top
   
 Post subject:
PostPosted: Mon Mar 15, 2010 7:06 am 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
Thanks ayman.

hybinet wrote:
You have Apache with PHP, you have MySQL, and you have nothing else, right?


Right, lamp is all I need, no email servers at all, BUT I have phpMyAdmin installed, is that ok? Is there any other alternative for it?


Top
   
 Post subject:
PostPosted: Mon Mar 15, 2010 9:08 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
PHPMyAdmin is just a PHP script. It uses no more RAM than any other commonly used PHP script, such as Wordpress.


Top
   
 Post subject:
PostPosted: Mon Mar 15, 2010 4:48 pm 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
What about sftp server? I will need to open at least 20 sftp accounts for my clients (btw. is there a way to do it without sftp server?).


Top
   
 Post subject:
PostPosted: Mon Mar 15, 2010 5:37 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
What's an SFTP server? You mean transferring files using SSH, right?

If all 20 users are logged on at the same time and doing something crazy, you might have a problem. If it's just one or two users uploading files from time to time, the SSH server (sshd) that's already running in the background will take care of them just ok. There's no such thing as a separate SFTP server, it's built into the sshd.

But do you really want to give system accounts to all of your clients? At the very least, search the web on how to create chrooted user accounts that can only access SFTP.


Top
   
 Post subject:
PostPosted: Tue Mar 16, 2010 12:17 pm 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
Well, I have another hosting with another provider, it's shared hosting and to upload files on the server I need to use FTP.

When I signed up with Linode, I found out that ftp is an old and unsecure way of transfering data, so they told me in support to use sftp, which I'm using with Filezilla.

I will host my clients sites on my linode, so I need to provide them a way to transfer files to their web site. Putty or ssh is out of the question for them, as thay are not so tech savy. I need to provide them with Filezilla or something similar.

A friend told me that I need sftp server for that. Thats why I asked :)


Top
   
 Post subject:
PostPosted: Tue Mar 16, 2010 2:10 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
As I said, there's no such thing as an SFTP server. It's included in SSH. If you're connecting to your server with PuTTY to administer it, you can also connect to it with FileZilla to transfer files. Try it. Select "SFTP" in FileZilla'a connection manager, and enter the username and password just like you would with plain old FTP.


Top
   
 Post subject:
PostPosted: Tue Mar 16, 2010 9:33 pm 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
hybinet wrote:
Select "SFTP" in FileZilla'a connection manager, and enter the username and password just like you would with plain old FTP.


Just out of interest, if you are running virtual hosts where users have no system accounts, how do you deal with letting users upload web content to their web directory.

I've seen virtual ftp setups, but can you do this sort of thing with SFTP, and how?


Top
   
 Post subject:
PostPosted: Tue Mar 16, 2010 9:57 pm 
Offline
Senior Newbie

Joined: Thu Feb 18, 2010 1:53 am
Posts: 10
There is 2 methods you can use SFTP which is using SSH.. or you can setup FTPS which is FTP over SSL. SFTP comes with SSH and you just need to create a user on the system and manage the keys if you wish. FTPS you setup your desired FTP server and enable the SSL portion if it supports it. My personal ftp server recommendation is vsftpd http://vsftpd.beasts.org/


Top
   
 Post subject:
PostPosted: Wed Mar 17, 2010 7:16 am 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
hybinet wrote:
... Select "SFTP" in FileZilla'a connection manager, and enter the username and password just like you would with plain old FTP.


Yes, thats exactly what I'm doing, but as kangaby asked I need to find a way to "deal with letting users upload web content to their web directory".

I guess I'll have to try vsftpd, as Schultz recommends.

But, back to the topic and memory optimization, I've heard someting about caching, seems to me it's related to memory optimization. Wikipedia says:

"Web caching is the caching of web documents (e.g., HTML pages, images) to reduce bandwidth usage, server load, and perceived lag"

I would guess if it reduces server load, then it also reduces memory that server uses, am I right?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group