Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW] 16.0 stock sn perf arm #163799

Open
wants to merge 2 commits into
base: saas-17.1
Choose a base branch
from

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Apr 29, 2024

The purpose of this PR is to be able to process a lot of serial numbers at once. In receipt and deliveries
In the current situation, the number of serial already in stock has an impact on the perf (due to update_available_quantity that do a _gather on current stock). All the metrics below are made with 50 000 SN already in stock

Before (in seconds):

Receipt Delivery
100 1.63 34.21
5000 87.04 242.56
30 000 563.75 T.O.

After:

Receipt Delivery
100 0.91 5.62
5000 47.21 56.28
30 000 195.27 307.80

By operations/ receipts (for 5000):

action_assign button_validate total
Before patch 5.38 82.02 87.04
After patch 3.82 43.39 47.21

By operations/ deliveries (for 5000):

action_assign button_validate total
Before patch 180.06 62.50 242.56
After patch 20.51 35.77 56.28

The main issues:

  • The constraint check on quant/stock.move.line are done one by one since there is nothing done in batch, same for computed field (Not fixed here)
    delivery-pre-patch
  • The put away takes an important amount of times without any putaways rules
    putaways
  • The optimisation made in [IMP] stock: optimize move reservation #116803 was a good idea but it was only use in action_assign. _action_assign use strict=False in _gather (mts case). It means a child_of operator is in the domain, and it will perform an extra query anyway
  • The lot_name matching to lot_id is made stock.move.line by stock.move.line on 30 000, half of the time is spent to find them.
    search_lot_name

After some testing. The quant_cache could contain too many items than needed by the current operation. Example receive 1 serial number (that will not have an existing quant) will use a quant_cache with all the serial number of the products. As a result, the group by will be super slow. Allow to add an extra domain, to limit the cache size. /!\ could be dangerous if it filter out too much
extra_domain

Forward-Port-Of: #158229
Forward-Port-Of: #146494

use a set instead of recordset. Removing an item from the recordset is
O(n) and it's done at each loop operation resulting in a O(n²)

On top of it. The variable is call in a depends_context of a compute.
Extract the part of the computation that depends of it in another
private function and call it when needed.

X-original-commit: 95730a6
Currently it does a search for each lot name. It could be process only
once to find the existing ones.

X-original-commit: 2c1d8b8
@robodoo
Copy link
Contributor

robodoo commented Apr 29, 2024

@fw-bot
Copy link
Contributor Author

fw-bot commented Apr 29, 2024

This PR targets saas-17.1 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@fw-bot
Copy link
Contributor Author

fw-bot commented Apr 29, 2024

@amoyaux @Whenrow ci/style failed on this forward-port PR

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Apr 29, 2024
@C3POdoo C3POdoo added the RD research & development, internal work label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwardport This PR was created by @fw-bot RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants