Re: Memory requirements for web-project

From: Richard Huxton <dev(at)archonet(dot)com>
To: Boris <koester(at)x-itec(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Memory requirements for web-project
Date: 2001-02-05 07:50:25
Message-ID: 3A7E5B41.9537A32@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Einar Karttunen 2001-02-05 08:53:30 Problems installing version 7.1beta4
Previous Message Oliver Elphick 2001-02-05 07:24:26 Re: can't run on TCP/IP ports