Tryton - Issues

 

Issue6984

Title ModelSingleton vs MultiValue
Priority feature Status unread
Superseder Nosy List ced, resteve
Type performance Components trytond
Assigned To Keywords
Reviews

Created on 2017-12-01.15:23:39 by ced, last changed by resteve.

Messages
msg37131 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-12-01.15:23:39
There is a bad performance combination between ModelSingleton and MultiValue.
The singleton is frequently instantiated using '1' as id with the idea that it does not cost anything because values are already in global cache.
The MultiValue used the One2Many field (when available) to benefit from the cache instead of doing a search on each access.
Unfortunately, the combination of both is not optimal because the ModelSingleton uses a new instance each time and the One2Many fields are stored only on the local cache of the instance (not the global). So this generates extra queries after each instantiation to fetch the One2Many.

I think we could fix this by storing a instance for each ModelSingleton in the Transaction cache per context. This cached instance will be reused by ModelSingleton when requesting a new instance. Of course the cache should be cleaned when the singleton is created or deleted.
History
Date User Action Args
2017-12-01 16:55:40restevesetnosy: + resteve
2017-12-01 15:23:39cedcreate

Showing 10 items. Show all history (warning: this could be VERY long)