On Wed, Aug 14, 2013 at 9:42 AM, Emerson Martins
<[email protected]>wrote:

> Bom dia pessoal
>
> Recentemente uma lentidão absurda em um outro servidor GIS em relação as
> demais solicitações anteriores.
>
>
> Ambiente:
> Slackware 13.1 64 bits
> PostgreSQL 8.4.4
>

PostgreSQL 8.4? E ainda só na release 4? Não acha que passou da hora de
atualizar? Veja que a 8.4 perde o suporte ano que vem [1].


> Memória : 8G
>
> Parâmetros Atuais:
>
> listen_addresses = '*'
> max_connections = 100
> shared_buffers = 24MB
>
> work_mem = 1MB                         # min 64kB
> maintenance_work_mem = 16MB            # min 1MB
>
> checkpoint_segments = 15                # in logfile segments, min 1, 16MB
> each
> checkpoint_timeout = 5min               # range 30s-1h
> checkpoint_completion_target = 0.9      # checkpoint target duration, 0.0
> - 1.0
> checkpoint_warning = 30s
>
> Tentei fazer algumas alterações nos parâmetro de memória, mas recebi essas
> mensagens abaixo:
>
>
> 2013-08-08 16:00:00 BRT [2503]: [1-1] user=,db= FATAL:  could not create
> shared memory segment: Invalid argument
> 2013-08-08 16:00:00 BRT [2503]: [2-1] user=,db= DETAIL:  Failed system
> call was shmget(key=5432001, size=140902400, 03600).
> 2013-08-08 16:00:00 BRT [2503]: [3-1] user=,db= HINT:  This error usually
> means that PostgreSQL's request for a shared memory segment exceeded
>  your kernel's SHMMAX parameter.  You can either reduce the request size
> or reconfigure the kernel with larger SHMMAX.
> To reduce the request size (currently 140902400 bytes), reduce
> PostgreSQL's shared_buffers parameter (currently 16384) and/or
>  its max_connections parameter (currently 103).
>         If the request size is already small, it's possible that it is
> less than your kernel's SHMMIN parameter, in which case raising the request
> size or
>  reconfiguring SHMMIN is called for.
>         The PostgreSQL documentation contains more information about
> shared memory configuration.
>
>
Você deve aumentar a configuração de SHMMAX do sistema operacional. Veja em
[2] uma explicação detalhada sobre configuração de recursos do kernel para
o PostgreSQL.

Resumindo, o que você deve fazer é adicionar os parâmetros kernel.shmmax e
kernel.shmall no arquivo /etc/sysctl.conf. São parâmetros de segurança,
apenas um limite, não serão de fato alocados. Se for um servidor dedicado
eu diria para colocar metade da sua memória RAM em ambox, ou seja:

kernel.shmmax = 4294967296
kernel.shmall = 1048576

O SHMMAX é definido em bytes e o SHMALL em páginas, por padrão de 4kB. Após
alterar o /etc/sysctl.conf você pode reiniciar a máquina ou, simplesmente,
aplicar com o comando:

# sysctl -p

OBS: Tudo deve ser feito com usuário root.

[1] http://www.postgresql.org/support/versioning/
[2] http://www.postgresql.org/docs/8.4/static/kernel-resources.html

Atenciosamente,
-- 
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a