View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002024 | OXID eShop (all versions) | 4.05. Performance | public | 2010-08-04 15:33 | 2012-12-10 13:29 |
Reporter | manuel | Assigned To | |||
Priority | high | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 4.4.0 revision 28699 | ||||
Fixed in Version | 4.4.2 revision 29492 | ||||
Summary | 0002024: System runs in time out when creating huge amount of vouchers | ||||
Description | We have a bug/performance problem, when we want to create voucher codes for flyers (320.000 pieces). Since the amount of 40.000 pieces the system runs in time out. Our thoughts are the unused an commented codes in admin/voucherseries_main.php: $oNewVoucher = oxNew( "oxvoucher" ); //$aVoucherParams = $oNewVoucher->ConvertNameArray2Idx($aVoucherParams); // first we update already existing and not used vouchers $oExistingVoucherList = $oVoucherSerie->getVoucherList(); // prepare voucher params foreach ($oExistingVoucherList as $oVoucher) { $oVoucher->assign($aVoucherParams); $oVoucher->save(); } You can see, that the script makes an assign on each Voucher with an empty Argument, cause it is commented some lines before. Also the Code for inserting a new Voucher code hasn’t good performance: for ($i = 0; $i < $dVoucherAmount; $i++) { $oNewVoucher->assign($aVoucherParams); $oNewVoucher->oxvouchers__oxvoucherserieid = new oxField($oVoucherSerie->oxvoucherseries__oxid->value); $oNewVoucher->oxvouchers__oxvouchernr = new oxField(oxConfig::getParameter("voucherNr")); if (oxConfig::getParameter("randomVoucherNr")) $oNewVoucher->oxvouchers__oxvouchernr = new oxField(uniqid($oNewVoucher->oxvouchers__oxvouchernr->value)); $oNewVoucher->save(); $oNewVoucher = oxNew( "oxvoucher" ); } We think, that it would be a faster, if you create a oxvoucher object before the for-loop and make clones of the object for inserting. But the fastes way to insert so many vouchers is to make SQL inserts instead of creating an oxvoucher object for each voucher, eg.: $sSql = 'INSERT INTO oxvouchers (`oxdateused`, `oxvouchernr`, `oxvoucherserieid`, `oxdiscount`, `oxid`) VALUES ("0000-00-00", "'.$sVoucherCode.'", "'.$aVoucherConfig['OXID'].'", "'.$aVoucherConfig['OXDISCOUNT'].'", "'.md5(uniqid($sVoucherCode)).'")'; We have tested it with SQL Statements directly and the time for 50.000 pieces on our Webserver takes round about 30 secs. If we use the implementation of OXID and adding vouchers to a new Voucherseries, we got a execution time from 12+ minutes. Best regards | ||||
Tags | Performance | ||||
Theme | |||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
|
Fixed by implementing generator/exporter ticker, similar to product export. Ticker should remove any limits, you will only have to wait until it finishes generation/export of data you requested. Some details: - VoucherSerie_Main saves voucher serie configuration; - VoucherSerie_Export exports vouchers (exports 1000 vouchers per tick - VoucherSerie_Export::$iExportPerTick = 1000); - VoucherSerie_Generate generates user defined vouchers (generates 100 vouchers per tick - VoucherSerie_Generate::$iExportPerTick = 100). |
|
now, after new coupon is created, it is not selected by default and user must search for it in whole vouchers list. |