Re: Memory requirements for web-project - Mailing list pgsql-general

From Richard Huxton
Subject Re: Memory requirements for web-project
Date
Msg-id 3A7E5B41.9537A32@archonet.com
Whole thread Raw
In response to Memory requirements for web-project  (Boris <koester@x-itec.de>)
List pgsql-general
Other people have said a lot on this, but IMHO missed some key points

Boris wrote:
>
> Hello pgsql-general,
>
> i need to calculate the memory requirement if i am using apache+pgsql.
>
> Lets assume that i want 160.000 hits a day and pgsql takes 3 seconds
> to work for each client, how much ram is required specially for pgsql?

As said in another case - depends upon the size of the query's result set.

> lets round it up to 2 hits per secound. So I calculate now
> 2 hits per second * 3 seconds for a client
> = 6 processes at the same time,
> is that correct?

No - as stated elsewhere, you need to allow for traffic peaks, so if you
have traffic logs examine them, otherwise pick your favourite number and
double it.
The other thing is that the time it takes to complete a query will
change the more clients you have running at the same time. Running six
simultaneous queries, you might get *one* result back in 3 secs, an
average of 6 secs and a maximum of 20 seconds for the slowest client.

Test the system with the "ab" apache benchmark tool (comes with apache)
or similar - this will give you a clearer idea of what too expect.

Then, of course, the result set will be stored in your perl/php/whatever
script before being sent to the client. You need to allow for that.

Also allow for the time to send the data to the client. Sending 100KB to
a client on a 28.8 modem can take a few seconds.

>
> If so, how much is the memory requiremend? I have seen with "TOP" that
> pgsql requires 5000kb for a request, but it is used per client (new processes for
> each new client-request?)

Don't forget to subtract the shared memory from each of these clients -
there will only be one copy of the code in memory for all the clients.

Bottom line - if money is tight, do as much testing as you can,
otherwise buy as much RAM as your system can take - too much tends not
to do a lot of damage.

- Richard Huxton

pgsql-general by date:

Previous
From: "Oliver Elphick"
Date:
Subject: Re: can't run on TCP/IP ports
Next
From: Einar Karttunen
Date:
Subject: Problems installing version 7.1beta4