[pgpool-general: 1431] memcached shared among multiple pgpool-II instances
Tatsuo Ishii
ishii at postgresql.org
Tue Feb 26 19:11:24 JST 2013
>From pgpool-II manual:
If you want to use multiple instances of pgpool-II with online
memory cache which uses shared memory, it could happen that
one pgpool deletes cache, and the other one doesn't do it thus
finds old cached result when a table gets updated. Memcached
is the better cache storage in this case.
I found a case which is not safe even if we use memcached. Scenario:
1) pgpool-II:A and pgpool-II:B shares memcached for query cache.
2) A reveives SELECT * FROM a,b". Cache #1 created and pgpool records table a and b cached.
3) B reveives SELECT * FROM b,c". Cache #2 created and pgpool records table b and c cached.
4) A receives "UPDATE b SET...". A removes #1 because A knows the
table a and b cached (good). However cache #2 is not removed since
B does not recognize b gets updated. Thus if A or B receives
"SELECT * FROM b,c", cache #2 will be returned(no good).
The workaround is either:
1) do not use on memory query cache if multiple pgpool-II instances
are used.
or
2) set _memqcache_expire to appropreate value so that the old cache
entry is not used.
To fix this, we need to add info "which table is used by which cache"
to memcached. This is not a trivial work and I would like to leave
this for pgpool-II 3.3.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp
More information about the pgpool-general
mailing list