[pgpool-general: 946] Query Memory Cache goes OOM

Sebastian Kornehl webmaster at sourcebase.org
Tue Sep 4 20:57:56 JST 2012


Hi all,

I'm testing the new query cache (pgpool-II version 3.2.0) on CentOS 5.

System Specs:
4 cores
4 GB Ram

shmmax= 2147483648 (=2 GB)

When I start pgpool, my memory usage looks like this:

Mem:   4194304k total,   660016k used,  3534288k free,    62116k buffers

My test scenario is the following:

# Config:

memory_cache_enabled = on
memqcache_method = 'shmem'
memqcache_total_size =  262144000 #250MB
memqcache_max_num_cache = 10
memqcache_expire = 15
memqcache_auto_cache_invalidation = off
memqcache_maxcache = 409600 #400kb
memqcache_cache_block_size = 1048576 #1MB
memqcache_oiddir = '/var/log/pgpool/oiddir'

Table: data
id integer pkey
value character varying(255)
[some more columns]

SELECT value FROM data WHERE id =${randomNumber};

so when I start the first
while true; do psql -c "foobar ..." ; sleep 1; done

everything looks good. When I start 9 more loops (= 10 selects per 
second), the used memory increases fast. After ~2 minutes it looks like 
this:

Mem:   4194304k total,  2439012k used,  1755292k free,    62588k buffers

after 2 more minutes:

Mem:   4194304k total,  4053796k used,   140508k free,    62752k buffers

When I add more clients, the machine begins to swap and dies.

show pool_cache gives:

  num_cache_hits | num_selects | cache_hit_ratio | num_hash_entries | 
used_hash_entries | num_cache_entries | used_cache_enrties_size | 
free_cache_entries_size | fragment_cache_entries_size
----------------+-------------+-----------------+------------------+-------------------+-------------------+-------------------------+----------------------
---+-----------------------------
  0              | 1527        | 0.00            | 16               | 
15                | 15                | 1746                    | 
262142254       | 0
(1 row)

So my question:

What I'm doing wrong? The plan is to connect more Frontends with 300+ 
statements per second.
When I turn memory_cache_enabled off the problem does not occur.

Thanks in advance!

Sebastian



More information about the pgpool-general mailing list