You are not logged in.

#1 2008-08-02 02:31:11

arachn1d
Member
Registered: 2008-08-02
Posts: 10

Optimization for 256 MB of ram server running apache/postgresql

Hi,

I'm on a VPS for 256 MB of ram planning to run Apache and PostgreSQL.

Does anyone have recommendations on some settings to use so I can avoid blowing up the server with memory problems due to unnecessary spawning of workers or something like that?

Thanks.

Offline

#2 2008-08-02 03:16:21

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: Optimization for 256 MB of ram server running apache/postgresql

Have a look at /etc/security/limits.conf to be able to limit the number of processes, memory etc per user... You'll have to experiment with what settings work best.

You can also play with the settings in /etc/httpd/conf/extra/httpd-mpm.conf to tweak Apache.

Offline

#3 2008-08-02 19:44:59

arachn1d
Member
Registered: 2008-08-02
Posts: 10

Re: Optimization for 256 MB of ram server running apache/postgresql

Anyone have experience or examples with tweaking apache/postgres that could show something?

Offline

#4 2008-08-02 19:49:11

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,964
Website

Re: Optimization for 256 MB of ram server running apache/postgresql

Try lighttpd. This should perform better and uses less memory.

Offline

#5 2008-08-02 19:54:45

arachn1d
Member
Registered: 2008-08-02
Posts: 10

Re: Optimization for 256 MB of ram server running apache/postgresql

Well, I'm using Apache, it's the setup I'm going with and I need it for a specific module.

I really am just looking for optimization tips on Apache w/ the worker configuration and such as that. Likewise for similar settings on Postgres.

Offline

#6 2008-08-03 17:00:59

jealma
Member
From: The Netherlands
Registered: 2008-01-03
Posts: 71

Re: Optimization for 256 MB of ram server running apache/postgresql

arachn1d wrote:

Well, I'm using Apache, it's the setup I'm going with and I need it for a specific module.

I really am just looking for optimization tips on Apache w/ the worker configuration and such as that. Likewise for similar settings on Postgres.

What module do you need for Apache that isnt in lighttpd? Just curious as I'm switching to lighttpd and I thought most stuff would run on it.

Offline

#7 2008-08-03 18:21:13

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Optimization for 256 MB of ram server running apache/postgresql

apache:
* remove unused modules
* if you are using php, then look at how much each apache instance uses normally, and tune maxclients, minspares, etc. accordingly
* if you are not using php, do the above, and also give worker-mpm a try (as it is *more* threaded an does less forking, it should use less ram and have less ram churn)

postgres:
* no idea, but a google search turned up some info for me

However, in all honesty, apache with any reasonably sized php app is going to need more memory, when combined with a database. So I would personally either use a lighter weight webserver, or upgrade to a 512 slice...which would be alot more roomy, and provide better overall results.

Another source of info: http://forum.slicehost.com/comments.php … sionID=129

Good luck.


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#8 2008-08-03 18:42:57

arachn1d
Member
Registered: 2008-08-02
Posts: 10

Re: Optimization for 256 MB of ram server running apache/postgresql

Thank you very much smile

Offline

#9 2008-08-08 00:19:22

bushmannt
Member
From: Charlston, SC
Registered: 2008-08-07
Posts: 7
Website

Re: Optimization for 256 MB of ram server running apache/postgresql

general principles always apply:  use the absolute minimum number of modules.  it's great for security, performance, and simplicity of configuration/maintenance.   Apache comes with a boatload of modules these days, and you really usually need only a few.  The default config should be OK performance wise unless you're really planning on some heavy traffic.

Postgres is another story tho.  There are no modules, but the default config is absolutely minimalistic, it's intended for one local developer and that's it--even the network connectivity is disabled by default!   Postgresql LOVES memory.  the more you give it, the better it's gonna run.  of course if your db is 10mb and you give it 100mb then you wont benefit much from the extra memory, but if it's 10mb and you give it 1mb then you're gonna be running very slowly.  try to fit the whole db in memory if possible.  postgres' memory allocation parameters are _extensive_.  if you like to tweak for performance, you'll go gaga over them.

Generally tho, you won't know what settings you need until you load your data, your site, and you let it run under a normal load for a while.  watch your logs like a hawk and 'learn' your site, how it runs, what gets accessed when, how the db is being used, is the system cpu or io bound, etc...  THEN you can start really adjusting stuff.  Donald Knuth said once that "premature optimization is the root of all evil" and running your own site will definitely demonstrate that.  Log everything, otherwise you'll have nothing to learn from.

Offline

Board footer

Powered by FluxBB