On 15/04/13 09:36 -0700, Ian Wilson wrote:
> Hello people of Tryton,
> 
> I'm experiencing performance problems and had some questions about them.
> 
> I have a wizard that works like a sales register for retail sales.  It 
> works as follows:
> 
> An employee enters in a list of products, their quantities and optionally 
> new prices and then clicks process.  In the process method the sale and its 
> lines are created with taxes, payment method, warehouse, party, etc.  Then 
> the invoice is paid and the shipment is sent by running their workflows.

It looks like a POS but you do a lot of stuffs that could be skiped in
automatic process. For example, no need to get a shipment if the goods
are already out, you just have to do moves. Idem for invoice, if you
don't need the invoice, you can just register the accounting moves in a
journal.

> This process method takes from 30 seconds to over a minute to complete with 
> one product in a sale.

The sale workflow was also splitted in "confirm" and "process" to allow
processing it later. For example, with a ecommerce website, you can
process sales not inside the same transaction as the use but later with
a cron job or even better using a message queue. Also by processing
sales in group, you will benefit of the bunch API.

> I have around 12000 products and 1000 stock locations (arranged in a 
> hierarchy).

That's probably slow down the assignation.

> I also have a lot of custom modules but I don't customize anything in 
> accounting that I know of and that is just as slow as the shipping phase.

That should be checked.

> I'm running Tryton 2.6 with Postgresql 9.2 on a Gentoo machine (VPS) with 
> 2GB of ram and 8 cpus(2 priority).

VPS are not always the best solution for performance.
And 8 cups doesn't help.

> I have inserted start/top print statements in my process method and overall 
> most of the parts seem to be contributing to the slowness.
> 
> 1st run (fresh start of client):
> sale workflow took 0:00:30.055756
> shipping took 0:00:24.810039
> invoicing took 0:00:22.723529
> do_process took 0:01:17.599376
> 
> 2nd run (in case of aching):
> sale workflow took 0:00:27.521843
> shipping took 0:00:23:108033
> invoicing took 0:00:20.545800
> do_process took 0:01:11.184253
> 
> Here is the wizard code with the log/datetime.now statements:
> https://gist.github.com/ianjosephwilson/5389138
> 
> 
> Is this performance expected for my magnitude of products and locations?

Hard to say, we need more information:

    - number of SQL queries
    - inside each workflow where is spend the time

> Is there a better way to profile other than printing start/stop times?  I 
> tried to splice in the python profiler but the output for a system as 
> complex as tryton is pretty unhelpful.
> 
> Are there changes in 2.7+ that I could backport to improve performance?

Yes there are many improvements in coming 2.8, here are a few:

    http://hg.tryton.org/trytond/rev/c48089fa3ade (and all modules)
    http://hg.tryton.org/trytond/rev/c7804c288ca3 (and all modules)
    http://hg.tryton.org/modules/account/rev/5b61530991e1

> It seems that running through this process manually is a bit faster than 
> using the wizard.  Is it possible that running in the context of a wizard 
> is disabling some sort of server side caching or adding some new overhead?

Normally not.

> Could I be missing a C extension for something like relatorio?

Genshi has some C extension.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpjjx18t6t_M.pgp
Description: PGP signature

Reply via email to