[Zope] Re: database conflict errors

Tres Seaver tseaver at palladion.com
Thu Jun 29 11:20:53 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jonathan wrote:
> During recent load testing of a new application 3.1% to 7.6% of all http requests resulted in conflict errors
> (3.1% with 10 simultaneous users; 7.6% with 50 simultaneous users).
> 
> The conflict error occurs when the application attempts to write a small image object into a temporary folder, and each conflict error generates the same traceback:
> 
> 
> Traceback (innermost last):
>   Module Zope2.App.startup, line 173, in zpublisher_exception_hook
>   Module ZPublisher.Publish, line 121, in publish
>   Module Zope2.App.startup, line 240, in commit
>   Module transaction._manager, line 96, in commit
>   Module transaction._transaction, line 380, in commit
>   Module transaction._transaction, line 378, in commit
>   Module transaction._transaction, line 433, in _commitResources
>   Module ZODB.Connection, line 484, in commit
>   Module ZODB.Connection, line 518, in _commit
> ConflictError: database conflict error (oid 0x07, class Products.TemporaryFolder.TemporaryFolder.SimpleTemporaryContainer)
> 
> 
> 
> I am running Zope 2.9.2 on CentOS 4.3 (linux).
> 
> Does anyone have any ideas as to what I could do to reduce/eliminate these conflict errors?

First, make sure that your application is not trying to overwrite the
*same* image in each request.  If it needs to do that, then the
conflicts are unavoidable.

Next, making simultaneous writes into any naive container is going to
cause conflicts.  You need to think carefully about how you want those
writes to work, and plan to minimize conflicts:

  - Use a BTreeFolder, rather than a normal OFS.Folder (or derivative).

  - Arrange for the IDs of your images to be substantially different,
    typically by mangling in a random number (or, for instance, the
    microseconds value of the current timestamp).


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEo+/U+gerLs4ltQ4RAhsUAKCaZIJKLKOcO/X6wkAUo8x83vx3eQCfY5hW
/2SHvahGxJ3DSpg4qMlL4D4=
=17k2
-----END PGP SIGNATURE-----



More information about the Zope mailing list