Scaling Issues, 30MB Sample transactions, and persistent.list.PersistentList

We have a well populated site currently containing about 20,000 samples and 480,000 analyses. While I would expect our database to be large given the quantity of objects, we are having a major performance issue that I cannot seem to track down.

Every time we perform a write transaction on the site involving a Sample or Analysis (child of a Sample), not only does the action take anywhere from 10 seconds to 10 minutes, we get this warning:

UserWarning: The <class 'persistent.list.PersistentList'>
object you're saving is large. (30290947 bytes.)

Perhaps you're storing media which should be stored in blobs.

Perhaps you're using a non-scalable data structure, such as a
PersistentMapping or PersistentList.

Perhaps you're storing data in objects that aren't persistent at
all. In cases like that, the data is stored in the record of the
containing persistent object.

In any case, storing records this big is probably a bad idea.

If you insist and want to get rid of this warning, use the
large_record_size option of the ZODB.DB constructor (or the
large-record-size option in a configuration file) to specify a larger

Now, most of the sluggishness itself is coming from ConflictErrors which are causing transactions to run multiple times. However, what I am gathering out of this error message is that every single Sample object is currently around 30MB in size, which seems absurdly large given the attributes being stored. :face_with_monocle:

According to the Zope Documentation, the best way to reduce the chance of ConflictErrors is to reduce the size of the transactions, so that there is a smaller window for a conflict to occur. However, I am a bit unsure why these Sample objects are so large in the first place. It was not this sluggish when we first started entering production data about a year ago, so my thought is that each Sample (AnalysisRequest) is somehow getting larger every time a sample is created?

Anyone have any experience with this issue, or have any understanding of how persistent.list.PersistentList would be causing Sample objects to grow so large over time?

Hi @faytrow,

when was the last time you packed your database?

Maybe you are also storing large images e.g. directly pasted into the results interpretation of some samples?

As far as I know FireFox converts such images directly into base64 and this get all stored in the text field (also see Handle inline images in Results Interpretation by ramonski · Pull Request #1344 · senaite/senaite.core · GitHub)


1 Like