Thread: tuning on ec2

tuning on ec2

From
Joel Reymont
Date:
I'm running pgsql on an m1.large EC2 instance with 7.5gb available memory.

The free command shows 7gb of free+cached. My understand from the docs is that I should dedicate 1.75gb to
shared_buffers(25%) and set effective_cache_size to 7gb.  

Is this correct? I'm running 64-bit Ubuntu 10.10, e.g.

Linux ... 2.6.35-28-virtual #50-Ubuntu SMP Fri Mar 18 19:16:26 UTC 2011 x86_64 GNU/Linux

    Thanks, Joel

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------




Re: tuning on ec2

From
Scott Marlowe
Date:
On Tue, Apr 26, 2011 at 8:59 AM, Joel Reymont <joelr1@gmail.com> wrote:
> I'm running pgsql on an m1.large EC2 instance with 7.5gb available memory.
>
> The free command shows 7gb of free+cached. My understand from the docs is that I should dedicate 1.75gb to
shared_buffers(25%) and set effective_cache_size to 7gb. 
>
> Is this correct? I'm running 64-bit Ubuntu 10.10, e.g.

It's a reasonable start.  However, if you consistently using less than
that in aggregate then lowering it is fine.  What's your work_mem and
max_connections set to?

Re: tuning on ec2

From
Joel Reymont
Date:
On Apr 26, 2011, at 4:31 PM, Scott Marlowe wrote:

> It's a reasonable start.  However, if you consistently using less than
> that in aggregate then lowering it is fine.

Is there a way to tell if I consistently use less than that in aggregate?

> What's your work_mem and max_connections set to?

I have the default settings, e.g. work_mem = 1MB and max_connections = 100.

I'm looking to process 400 requests per second, though. What should I use for the above?

    Thanks, Joel

--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------




Re: tuning on ec2

From
Scott Marlowe
Date:
On Tue, Apr 26, 2011 at 9:34 AM, Joel Reymont <joelr1@gmail.com> wrote:
>
> On Apr 26, 2011, at 4:31 PM, Scott Marlowe wrote:
>
>> It's a reasonable start.  However, if you consistently using less than
>> that in aggregate then lowering it is fine.
>
> Is there a way to tell if I consistently use less than that in aggregate?

Keep an eye on shr for postgres processes in top.   It should
eventually reach about the same size as your shared_buffers if you're
using it.  If it stays at 500M or something then you don't need as
much shared_buffers.

>> What's your work_mem and max_connections set to?
>
> I have the default settings, e.g. work_mem = 1MB and max_connections = 100.
>
> I'm looking to process 400 requests per second, though. What should I use for the above?

Those settings are fine to start.  Look at connection pooling, as
having too many backends can cause the db to run slower.  Generally 2x
or so as many cores as you have is a good place to start with how many
connections to keep alive by the pooler.

Re: tuning on ec2

From
Toby Corkindale
Date:
On 27/04/11 01:34, Joel Reymont wrote:
> On Apr 26, 2011, at 4:31 PM, Scott Marlowe wrote:
>> What's your work_mem and max_connections set to?
>
> I have the default settings, e.g. work_mem = 1MB and max_connections = 100.
>
> I'm looking to process 400 requests per second, though. What should I use for the above?

Those two options don't really affect the number of requests per second,
as I understand things.. They're more about how many simultaneous
requests you can have going.

Make sure you have sensible SQL for the queries you're making, and have
some fast disks. If you're doing a lot of read-only queries, consider
whether you can cache the results in your application rather than
requesting them from the DB every time.

-Toby