TOO MANY READS WHEN VIEWING A FORM VIEW: VERY SERIOUS PERF KILLER!
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo GTK Client (MOVED TO GITHUB) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Hi,
When you are are in a tree view (products or partners for instance) and when you click on some item to display its form view, first the GTK client calls fields_view_get for the form view, and then it calls read. The big trouble is that instead too call read only for the selected resource, it calls it for ALL the items displayed in the tree!!!
The web-client on the contrary does it right.
On my PC, the GTK client is paying a 0.5 sec impact there when displaying a product in form view compared to the eTiny!!!!!!
I just instrumented my code to log server request and how long they take, in the server/
def execute(self, db, uid, passwd, object, method, *args):
service = netsvc.
from mx import DateTime
d1 = DateTime.now() #TODO remove
res = service.execute(db, uid, object, method, *args)
d2 = DateTime.now()
print method + " " + str(args)
print d2 - d1
print "************"
print "************"
return res
Now here is what I get doing the explained scenario from my GTK client first:
1) Clicking on Products > Products (tree view):
get ('action', 'tree_but_open', [('ir.ui.menu', 126)], False, {'lang': u'en_US', 'tz': False})
00:00:00.03
************
************
fields_view_get (143, u'tree', {'lang': u'en_US', 'active_ids': [126], 'tz': False, 'active_id': 126}, True)
00:00:00.10
************
************
fields_view_get (False, 'form', {'lang': u'en_US', 'active_ids': [126], 'tz': False, 'active_id': 126})
00:00:00.23
************
************
fields_view_get (False, 'tree', {'lang': u'en_US', 'active_ids': [126], 'tz': False, 'active_id': 126})
00:00:00.01
************
************
search ([], 0.0, 80.0, 0, {'lang': u'en_US', 'active_ids': [126], 'tz': False, 'active_id': 126})
00:00:00.02
************
************
read ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], ['virtual_
00:00:00.11
************
************
2) Now selecting a product in the list to and clicking on it to display it in form view:
fields_view_get (False, u'form', {'lang': u'en_US', 'active_ids': [126], 'tz': False, 'active_id': 126}, True)
00:00:00.30
************
************
read ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], ['warranty', 'property_
00:00:00.69
The above is CRAZY: THIS IS COMPLETELY INSANE!!! Only one id (the selected one) should be read!
And notice that the server does answer all the stuff!!!
************
************
fields_view_get (False, 'tree', {'lang': u'en_US', 'tz': False}, False)
00:00:00.01
************
************
fields_view_get (False, 'tree', {'lang': u'en_US', 'tz': False}, False)
00:00:00.01
************
************
fields_view_get (False, 'tree', {'lang': u'en_US', 'tz': False}, False)
00:00:00.04
************
************
fields_view_get (False, 'tree', {'lang': u'en_US', 'tz': False}, False)
00:00:00.02
************
************
read ([5], ['delay', 'product_code', 'qty', 'name', 'sequence'], {'lang': u'en_US', 'tz': False})
00:00:00.03
************
************
#######
#######
Now doing the same from eTiny which does it correctly:
1) Tree view:
get ('action', 'tree_but_open', [(u'ir.ui.menu', 126)], False, {'lang': u'en_US', 'client': 'web', 'tz': False})
00:00:00.03
************
************
fields_view_get (143, u'tree', {'lang': u'en_US', '_view_name': u'Products', '_terp_target': u'current', 'client': 'web', 'tz': False, 'active_ids': [126], 'active_id': 126}, True)
00:00:00.07
************
************
search ([], 0, 80, 0, {'_view_name': u'Products', 'active_ids': [126], '_terp_target': u'current', 'active_id': 126})
00:00:00.02
************
************
search_count ([], {'_view_name': u'Products', 'active_ids': [126], '_terp_target': u'current', 'active_id': 126})
00:00:00.02
************
************
read ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], ['virtual_
00:00:00.12
************
************
fields_view_get (False, 'form', {'lang': u'en_US', 'client': 'web', 'tz': False}, True)
00:00:00.34
************
************
fields_view_get (False, 'tree', {'lang': u'en_US', 'client': 'web', 'tz': False}, True)
00:00:00.07
************
************
search ([('osv', '=', u'product.
00:00:00.05
************
************
2) Form view: only one item is requested:
fields_view_get (False, 'form', {'lang': u'en_US', '_view_name': u'Products', '_terp_target': u'current', 'client': 'web', 'tz': False, 'active_ids': [126], 'active_id': 126}, True)
00:00:00.28
************
************
read ([3], ['warranty', 'property_
00:00:00.11
************
************
fields_view_get (False, 'tree', {'lang': u'en_US', 'client': 'web', 'tz': False}, False)
00:00:00.01
************
************
read ([5], ['delay', 'product_code', 'qty', 'name', 'sequence'], {'lang': u'en_US', 'client': 'web', 'tz': False})
00:00:00.02
************
************
read ([5],)
00:00:00.02
Hope this helps! That's a crazy bug. How the hell could you have missed it ?????????
Raphaël Valyi
Changed in openobject-client: | |
status: | Invalid → Confirmed |
This is fine.
GTK loads the list of 80 items, only for the selected products. It is also smart in the way, it loads only fields that were not in the list view.
Loading one or 80 items is nearly the same time for postgresql (which is the bottelneck of the ERP) as it is the same number of queries. It allows to cache the data and work in cache when you do Next, Previous. The result is much less queries and server-client transactions. For complex fields (binaries, one2many, many2many) it loads only when you go on the record.
So, in my sense, GTK is much more faster than etiny, mainly because it is able to cache the selected records, in the client side. It allows you to do: next, next, next,... very fastly for a server-client application.
Please don't write bugs in uppercase, we set priority if we think it's important.