Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject:
PostPosted: Wed Mar 17, 2010 12:42 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Caching uses *more* RAM. The idea is that unused RAM is wasted. It's better to use it to cache data so that you don't need to hit the disk (or if you're caching precomputed data, don't need to hit the CPU).


Top
   
 Post subject:
PostPosted: Wed Mar 17, 2010 3:35 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
AndrijaM wrote:
I need to find a way to "deal with letting users upload web content to their web directory".


Why not just create an account for each user and make each of them own their own files? It's pretty easy these days to chroot user accounts and give them only SFTP access (no shell), since recent versions of the openSSH server include that functionality by default.

AndrijaM wrote:
I've heard someting about caching


apt-get install php-apc && /etc/init.d/apache2 restart

That will make Apache use 10-20MB more RAM, but your PHP scripts will run nearly twice as fast.

Also don't forget the various caching plugins that are available for popular PHP programs (e.g. wp-super-cache for Wordpress). These plugins usually don't cause increased memory usage, as they use static files instead of RAM.


Top
   
 Post subject:
PostPosted: Thu Mar 18, 2010 7:09 am 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
hybinet wrote:
It's pretty easy these days to chroot user accounts and give them only SFTP access


That seems like the best option for me, I'll have to try that (not only VPS but also a linux newbie :) ).

After installed php-apc, now when I run free -m +- buffers/cache is now 288 free, and before that it was 265, so it looks like I got 20 mb ram back :) Anyway, everything works fine, my sites are loading fast, all the trouble setting everyting up is now paying off, linode is really great!

Couple more questions:

- I see that many people are using lighttpd and not apache. Whats the difference or in what situations is better to have it then apache?

- linux installation, I've chose Ubuntu 9.10, is there a difference in memory usage with some other version?


Top
   
 Post subject:
PostPosted: Thu Mar 18, 2010 1:14 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
You got 20MB back is because you restarted Apache. Make a few visits to your site and the memory usage will return to where it was, plus a few more MB for the APC cache.

1) Apache with mod_php handles both static (html, css, images) and dynamic (PHP) requests using the same pool of processes. lighttpd (and nginx, which has recently become more popular) separate them. Static files are served by a preconfigured number of worker processes, and memory usage stays nearly constant whether you have 100 visitors or 10000 visitors. PHP requests are passed to a separate pool of FastCGI processes, which runs with its own set of privileges and keeps memory usage nearly constant. You can see why people say lighttpd and nginx are good for memory-constrained VPS's. The drawback? If you want to use mod_rewrite (pretty URLs) with your favorite CMS, you'll have to put the rules into the server configuration itself, rather than in a convenient .htaccess file. Works fine if it's just your site, but not so good when you have clients constantly complaining about their .htaccess files not working.

2) As long as you stick to 32-bit, memory usage difference between different distributions is generally negligible (a few MB).


Top
   
 Post subject:
PostPosted: Sat Mar 20, 2010 11:37 am 
Offline
Senior Member

Joined: Thu Mar 11, 2010 1:09 pm
Posts: 62
Thank you!


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