Opened 12 years ago

Closed 12 years ago

#18190 closed Uncategorized (invalid)

slower performance with non-default database + @transaction.commit_manually

Reported by: assie181@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django exhibits slower performance with non-default database + @transaction.commit_manually compared to default database (with @transaction.commit_manually)

How to reproduce:

1) Install Django 1.3.1 and CherrPy

2) Download http://dl.dropbox.com/u/1522424/strange-secondary-DB.tar.gz

3) Run as "python cherryserver.py" and observe time values printed.

4) Edit app/statsmanager.py to use "volume_stats.save(using='secondary')".

5) Notice the slow down in saving results to secondary database.

When using real code, saving to default db is taking ~200ms while saving to secondary db is taking > 2 seconds.
(both cases use @transaction.commit_manually).

Either this is a bug in attached test application or it is a bug in Django.

Change History (1)

comment:1 by Anssi Kääriäinen, 12 years ago

Resolution: invalid
Status: newclosed

I think I have a pretty good guess what is happening here: the transactions do not define "using", so when saving to the 'secondary' database the inserts are done without any transaction, which probably is causing the slowdown (I spotted around 5x difference in runtime due to this in my testing).

I am closing this invalid. If changing the transaction commands so that they have a "using" parameter does not fix the performance issue please reopen this ticket.

Note: See TracTickets for help on using tickets.
Back to Top