On Tue, Jul 19, 2011 at 12:21:32AM -0300, Егор Следов wrote:
> I have a web application with two load-balanced webservers and a separate
> postgres database server.
>
> When SQLObject instance is updated, the update is processed randomly through
> either of the servers.
> Sometimes user does the update on one server, and immediately opens object
> for reading on another.
> So, if caching is on, it looks like database is not getting updated.
>
> If I turn caching off by setting sqlmeta.cacheValues to False, then call to
> each and every property issues a separate SQL select, and this slows
> everything down a lot.
>
> What would be the right approach to minimize number of selects on a single
> webpage?
> Keeping cache on, but calling object.expire(), object.another.expire() after
> referencing any properties? Trying to lower cullFrequency parameter of cache?
In SQLObject there are three ways of caching - attribute caching
(governed by sqlmeta.cacheValues), row caching (governed by
connection.cache), and update caching (governed by sqlmeta.lazyUpdates).
What you probably want is to stop row caching - every time the programs
fetches a row it asks the database, not the cache. So leave
sqlmeta.cacheValues and sqlmeta.lazyUpdates alone (their default values
are good for you) and set connection.cache.doCache=False. You can do it
from DB URI ('postgres://host/db?cache=0'); if the program opens
connection without an URI the parameter for PostgresConnection is
cache=False.
Oleg.
--
Oleg Broytman http://phdru.name/ [email protected]
Programmers don't die, they just GOSUB without RETURN.
------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss