• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Transaction Rollback Performance

#1
[eluser]comex[/eluser]
Hello,

I'm getting very poor performance when a transaction "fails".

Code:
$this->db->trans_start(TRUE);

[Loop through received data and send it to a model that deals with the inserts/updates.]

$this->db->trans_complete();
if ($this->db->trans_status() === FALSE)
{
     [Return error]
}

When the transaction finishes without any error it finishes very quickly, but when an error occurs it seems to stall for 3-4 seconds before rolling back.
Is this due to the fact that I call an external model for the database interaction? (The model uses active record)
I've disabled db_debug in the database.php config file as was suggested somewhere else...

Thank you

#2
[eluser]verynewtothis[/eluser]
My suggestions:
Move your transaction commands to the model function.
Try having least number of programming logic in between the start and end transaction commands.. have your data prepared inside your controller (prior to sending it to the model) rather then doing it inside the transaction start/end commands... enabling "profiling" can also provide some useful information about time it takes to execute query etc..

#3
[eluser]comex[/eluser]
The reason as to why its not implemented in the model is that the model only handles single queries(which works well for everything else except this specific application).
This is part of an XML-RPC server that gets quite a bit of data and then submits it to the DB.
But I think I've gotten rid of the performance glitches now.

Thank you for your suggestions!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.