Ankündigung

Einklappen
Keine Ankündigung bisher.

starke Perfomanceprobleme in Auktionsportal

Einklappen

Neue Werbung 2019

Einklappen
Dieses Thema ist geschlossen.
X
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • starke Perfomanceprobleme in Auktionsportal

    Will ein Auktionsportal realisieren, jedoch hab ich aktuell starke Probleme bei der Performance des Portals. Die Auktionszeit (Cent-Reverse-Auktion ala Swoopo) laggt immermal wieder. Anschauen könnt ihr euch das hier
    Hat vielleicht jemand Erfahrungen mit einer solchen Problematik, könnte das auch an der Datenbank liegen o.ä. Ich danke echt für jeden Tipp...


  • #2
    Warum feuert der die ganze Zeit an update_info.php?flp=1 und dann flp=2 und dann wieder eins und so weiter ?

    Ok wies aussieht fragt der da die Preise ab...
    Das würde ich irgendwie reduzieren, soll heißen die Zeit mir JS runterlaufen lassen und die Preise alle 30s oder 60s abfragen sont stirbt dein Server wenn zu viele auf der Startseite sind.
    Signatur:
    PHP-Code:
    $s '0048656c6c6f20576f726c64';
    while(
    $i=substr($s=substr($s,2),0,2))echo"&#x00$i;"

    Kommentar


    • #3
      vielen Dank an ByStones.

      ich habe nun versucht die Zeit nach oben zu setzen, indem ich auctionUpdateTime und die counterUpdateTime stark erhöht habe, jedoch hat sich an der Performance nichts getan. Ich poste mal daher hier mal die update_info.php

      PHP-Code:
      <?
      include("config/connect.php");
      include("functions.php");
                
      $flipflop = (isset($_GET["flp"]) && $_GET["flp"] == 1);

      $aucidsnew = '';
      foreach ($_POST as $name => $value) {
          $value = chkInput($value, 'i');
          if ( $value == 0 ) continue;

          $aucidsnew .= ($aucidsnew == '' ? $value : ",".$value);
      }

      if ( $aucidsnew == '' ) {
          echo "[]";
          return;
      }

      $qrysel = "select auc_due_price, auction_id, ".($flipflop ? "auc_due_time, pause_status, " : "").
                   "(case when use_free = '1' ".
                   " then (select username from free_account ba left join registration r on ba.user_id=r.id ".
                   "       where auction_id=adt.auction_id and bid_flag='d' order by ba.id desc limit 0, 1) ".
                   " else (select username from bid_account ba left join registration r on ba.user_id=r.id ".
                   "            where auction_id=adt.auction_id and bid_flag='d' order by ba.id desc limit 0, 1) end) as username ".
                   "from auc_due_table adt left join auction a on a.auctionID=adt.auction_id where a.auctionID in ($aucidsnew)";
      $ressel = mysql_query($qrysel);

      $is_first = TRUE;
      $temp = "";

      while ( ( $obj = mysql_fetch_object($ressel) ) ) {
          if ( $is_first ) {
              $is_first = FALSE;
          } else {
              $temp .= ",";
          }

          $temp .= '{"auction":{"id":"'.$obj->auction_id.'","price":"'.number_format($obj->auc_due_price, 2).'","username":"'.$obj->username.'"'.
                      ($flipflop ? ',"pause":"'.$obj->pause_status.'","time":"'.$obj->auc_due_time.'"' : '').'}}';
      }
      mysql_free_result($ressel);

      echo "[".$temp."]";
      ?>
      und die JS Datei

      PHP-Code:
      var flipflop=1;
      var 
      storedata;

      function 
      OnloadPage() {
          if ($.
      browser.msie) {
              $.
      ajaxSetup({cachefalse});    //Configuring ajax
          
      }

          var 
      auctionUpdateTime 500;
          var 
      counterUpdateTime 1000;

          var 
      auctions '';

          $(
      '.auction-item').each(function() {
              var 
      auctionId    = $(this).attr('id');
              var 
      auctionTitle = $(this).attr('title');
              
      auctions auctions auctionId '=' auctionTitle '&';
          });

          var 
      GlobalVar 0;

          
      setInterval(function() {
              if (
      auctions) {
                  
      getStatusUrl 'update_info.php?flp=' flipflop;

                  $.
      ajax({
                      
      urlgetStatusUrl,
                      
      dataType'json',
                      
      type'POST',
                      
      timeout2000,
                      
      dataauctions,
                      global: 
      false,
                      
      success: function(data) {
                          
      storedata data;

                          $.
      each(data, function(iitem) {
                              
      auction_id item.auction.id;
                              
      auction_price item.auction.price;
                              
      auction_bidder_name item.auction.username;

                              if (
      auction_bidder_name=="") {
                                  
      auction_bidder_name="---" 
                              
      }

                              if (
      document.getElementById('price_index_page_' auction_id).innerHTML != auction_price) {
                                  if (
      GlobalVar == 1) {
                                      if ($(
      '.history_auctionid').length) {
                                          if (
      auction_id==document.getElementById('history_auctionid').innerHTML) {
                                              var 
      forhoverid = new Spry.Effect.Highlight('price_index_page_' auction_id , {duration500from:'#f79909'to:'#f8f6f3'restoreColor'#FFFFFF'});
                                              var 
      forhoverid2 = new Spry.Effect.Highlight('currencysymbol_' auction_id , {duration500from:'#f79909'to:'#f8f6f3'restoreColor'#ffffff'});
                                          } else {
                                              var 
      forhoverid = new Spry.Effect.Highlight('price_index_page_' auction_id , {duration500from:'#f79909'to:'#fdfdfd'restoreColor'#FFFFFF'});
                                              var 
      forhoverid2 = new Spry.Effect.Highlight('currencysymbol_' auction_id , {duration500from:'#f79909'to:'#fdfdfd'restoreColor'#fdfdfd'});
                                          }
                                      } else {
                                          var 
      forhoverid = new Spry.Effect.Highlight('price_index_page_' auction_id , {duration500from:'#f79909'to:'#fdfdfd'restoreColor'#FFFFFF'});
                                          var 
      forhoverid2 = new Spry.Effect.Highlight('currencysymbol_' auction_id , {duration500from:'#f79909'to:'#fdfdfd'restoreColor'#fdfdfd'});
                                      }
                                      
      forhoverid.start();
                                      
      forhoverid2.start();
                                  }
                                  
      document.getElementById('price_index_page_' auction_id).innerHTML auction_price;
                                  
      document.getElementById('currencysymbol_' auction_id).innerHTML "€";
                                  
      document.getElementById('product_bidder_' auction_id).innerHTML auction_bidder_name;
                              } else {
                                  if ($(
      '.history_auctionid').length) {
                                      if (
      auction_id==document.getElementById('history_auctionid').innerHTML) {
                                          
      document.getElementById('price_index_page_' auction_id).style.backgroundColor "#ffffff";    
                                      } else {
                                          
      document.getElementById('price_index_page_' auction_id).style.backgroundColor "#FFFFFF";    
                                      }
                                  } else {
                                      
      document.getElementById('price_index_page_' auction_id).style.backgroundColor "#FFFFFF";    
                                  }
                              }
                          });
                          
      GlobalVar 1;
                      },
                      
      error: function(XMLHttpRequest,textStatuserrorThrown) {}
                  });
              }
              if (
      flipflop==1) {
                  
      flipflop 2;
              } else if (
      flipflop==2) {
                  
      flipflop 1;
                  
      ChangeCountdownData(storedata);
              }
          }, 
      auctionUpdateTime);

          $(
      '.bid-button-link').click(function() {
              $.
      ajax({
                  
      url: $(this).attr('name'),
                  
      dataType'json',
                  
      success: function(data) {
                      $.
      each(data, function(iitem) {
                          
      result item.result.split("|");

                          if (
      result[0]=="unsuccess") {
                              if (
      result[1]==1) {
                                  
      alert("keine ausreichenden Punkte");    
                                  return 
      false;
                              } else {
                                  if (
      confirm("Bitte Konto aufladen")) {
                                      
      window.location.href='buybids.php';
                                  }
                              }
                          }

                          if (
      result[0]=="success") {
                              if (
      result[1]==1) {
                                  
      obj document.getElementById('free_bids_count');
                                  
      objvalue document.getElementById('free_bids_count').innerHTML;
                                  if (
      obj.innerHTML!='0') {
                                      
      obj.innerHTML Number(objvalue) - 1;
                                  }
                              } else {
                                  
      obj document.getElementById('bids_count');
                                  
      objvalue document.getElementById('bids_count').innerHTML;
                                  if (
      obj.innerHTML!='0') {
                                      
      obj.innerHTML Number(objvalue) - 1;
                                  }
                              }
                          }
                      });
                   },
                  
      error: function(XMLHttpRequest,textStatuserrorThrown) { }
              });

          return 
      false;
          });

          if ($(
      '.productImageThumb').length) {
              
      setInterval(function() {
                  
      auctionhisid document.getElementById('history_auctionid').innerHTML;

                  
      oldprice document.getElementById('curproductprice').innerHTML;
                  
      newprice document.getElementById('price_index_page_' auctionhisid).innerHTML;

                  if (
      oldprice!=newprice) {
                      
      getStatusUrl3 'updatehistory.php?aucid_new='+auctionhisid;

                      $.
      ajax({
                          
      urlgetStatusUrl3,
                          
      dataType'json',
                          
      success: function(data) {
                              
      data1 = eval('(' data.responseText ')');
                              for (
      i=0i<data.histories.lengthi++) {
                                  
      biddingprice data.histories[i].history.bprice;
                                  
      biddingusername data.histories[i].history.username;
                                  
      biddingtype data.histories[i].history.bidtype;

                                  
      document.getElementById('bid_price_' i).innerHTML =  "€" biddingprice
                                  document
      .getElementById('bid_user_name_' i).innerHTML biddingusername;

                                  if (
      biddingtype=='s') {
                                      
      document.getElementById('bid_type_' i).innerHTML "Einzelgebot";
                                  } else if (
      biddingtype=='b') {
                                      
      document.getElementById('bid_type_' i).innerHTML "AutoBieter";
                                  } else if (
      bidding_type=='m') {
                                      
      document.getElementById('bid_type_' i).innerHTML "SMS Gebot";
                                  }
                              }

                              if (
      data.myhistories.length) {
                                  for (
      j=0j<data.myhistories.lengthj++) {
                                      
      biddingprice1 data.myhistories[j].myhistory.bprice;
                                      
      biddingusername1 data.myhistories[j].myhistory.time;
                                      
      biddingtype1 data.myhistories[j].myhistory.bidtype;

                                      
      document.getElementById('my_bid_price_' j).innerHTML "€" +  biddingprice1;
                                      
      document.getElementById('my_bid_time_' j).innerHTML biddingusername1;

                                      if (
      biddingtype1=='s') {
                                          
      document.getElementById('my_bid_type_' j).innerHTML "Einzelgebot";
                                      } else if (
      biddingtype1=='b') {
                                          
      document.getElementById('my_bid_type_' j).innerHTML "AutoBieter";
                                      } else if (
      biddingtype1=='m') {
                                          
      document.getElementById('my_bid_type_' j).innerHTML "SMS Gebot";
                                      }
                                  }
                              }
                              
      document.getElementById('curproductprice').innerHTML data.histories[0].history.bprice;
                          },
                          
      error: function(XMLHttpRequest,textStatuserrorThrown) { }
                      });
                  }
              }, 
      counterUpdateTime);
          }

          $(
      '.bookbidbutlerbutton').click(function() {
              if (
      document.getElementById('bookbidbutlerbutton').name!="") {
                  var 
      bidbutstartprice Number(document.bidbutler.bidbutstartprice.value);
                  var 
      bidbutendprice Number(document.bidbutler.bidbutendprice.value);
                  var 
      totalbids document.bidbutler.totalbids.value;
              
                  if (
      bidbutstartprice=="") {
                      
      alert("Bitte Startpreis für Autobieter angeben");
                      return 
      false;
                  }
                  if (
      bidbutendprice=="") {
                      
      alert("Bitte Endpreis für AutoBieter angeben");
                      return 
      false;
                  }
                  if (
      totalbids=="") {
                      
      alert("Bitte Gebote für Autobieter angeben");
                      return 
      false;
                  }
                  if (
      totalbids<=1) {
                      
      alert("AutoBieter sollte für mehr als ein Gebot genutzt werden");
                      return 
      false;
                  }
                  if (
      bidbutstartprice>bidbutendprice) {
                      
      alert("Der Startpreis darf nicht größer als der Endpreis sein");
                      return 
      false;
                  }
                  if (
      bidbutstartprice==bidbutendprice) {
                      
      alert("Der Endpreis muss größer als der Startpreis sein");
                      return 
      false;
                  }

                  $.
      ajax({
                      
      url"addbidbutler.php?aid="+$(this).attr('name')+"&bidsp="+bidbutstartprice+"&bidep="+bidbutendprice+"&totb="+totalbids,
                      
      dataType'json',
                      
      success: function(data) {
                          $.
      each(data, function(iitem) {
                              if (
      item.result) {
                                  
      result item.result.split("|");
                                  if (
      result=="unsuccessprice") {
                                      
      alert("Der Startpreis muss größer als der aktuelle Preis sein");
                                  } else if (
      result[0]=="unsuccess") {
                                      if (
      result[1]==1) {
                                          
      alert("Cents nicht ausreichend");
                                      } else {
                                          
      alert("Bitte Konto aufladen");
                                      }
                                  }
                              } else {
                                  
      document.bidbutler.bidbutstartprice.value="";
                                  
      document.bidbutler.bidbutendprice.value="";
                                  
      document.bidbutler.totalbids.value="";
                                  
      document.getElementById('butlermessage').style.display='block';
                                  
      changeMessageTimer setInterval("ChangeButlerImageSecond()",3000);
                                  
      changedatabutler(data,"abut",totalbids);
                              }
                          });
                      },
                      
      error: function(XMLHttpRequest,textStatuserrorThrown) { }
                  });

                  return 
      false;
              }
          });
      }

      function 
      DeleteBidButler(iddiv_id) {
          $.
      ajax({
              
      urlurl "deletebutler.php?delid=" id,
              
      dataType'json',
              
      success: function(data) {
                  $.
      each(data, function(iitem) {
                      
      result item.result;
                      if (
      result=="unsuccess") {
                          
      alert("Der AutoBieter kann während des Laufens nicht gelöscht werden");
                      } else {
                          
      placebids document.getElementById('butlerbids_' div_id).innerHTML;
                          if ($(
      '.usefreebids').length && document.getElementById('useonlyfree').innerHTML == '1') {
                              
      objbids document.getElementById('free_bids_count');
                              
      objbidsvalue document.getElementById('free_bids_count').innerHTML;

                              if (
      objbids.innerHTML!='0') {
                                  
      objbids.innerHTML Number(objbidsvalue) + Number(placebids);
                              }
                          } else {
                              
      objbids document.getElementById('bids_count');
                              
      objbidsvalue document.getElementById('bids_count').innerHTML;

                              if (
      objbids.innerHTML!='0') {
                                  
      objbids.innerHTML Number(objbidsvalue) + Number(placebids);
                              }
                          }
                          
      changedatabutler(data,"dbut","");
                      }
                  });
              },
              
      error: function(XMLHttpRequest,textStatuserrorThrown) { }
          });
          return 
      false;
      }

      function 
      ChangeCountdownData(resdata) {
          if (
      resdata && resdata!="") {
              
      data resdata;

              $.
      each(data, function(iitem) {
                  
      auction_id item.auction.id;
                  
      auction_time item.auction.time;
                  
      pausestatus item.auction.pause;

                  if (
      auction_time) {
                      if (
      auction_time=='0') {
                          
      document.getElementById('counter_index_page_' auction_id).style.color '#000000';
                          
      document.getElementById('counter_index_page_' auction_id).innerHTML "Beendet";                    
                          
      document.getElementById('image_main_' auction_id).onclick="";
                          
      document.getElementById('image_main_' auction_id).name="";
                          
      document.getElementById('image_main_' auction_id).onmouseover="";
                          
      document.getElementById('image_main_' auction_id).onmouseout="";
                          
      document.getElementById('image_main_' auction_id).src "images/soldbut.png";
                      } else if (
      pausestatus==1) {
                          
      document.getElementById('counter_index_page_' auction_id).innerHTML 'Pause';
                          
      document.getElementById('image_main_' auction_id).src "images/bidbut.png";
                          
      document.getElementById('image_main_' auction_id).onclick="";
                          
      document.getElementById('image_main_' auction_id).onmouseover="";
                          
      document.getElementById('image_main_' auction_id).name="";                            
                          
      document.getElementById('image_main_' auction_id).onmouseout="";
                      } else {
                          if (
      auction_time<10) {
                              
      document.getElementById('counter_index_page_' auction_id).style.color '#E80000';    
                              
      document.getElementById('counter_index_page_' auction_id).innerHTML calc_counter_from_time(auction_time);
                          } else {
                              
      document.getElementById('counter_index_page_' auction_id).style.color '#002356';    
                              
      document.getElementById('counter_index_page_' auction_id).innerHTML calc_counter_from_time(auction_time);
                          }
                      }
                  }
              });
          }

      Bin immernoch für jeden Tipp dankbar.

      Kommentar


      • #4
        Ajax wollte ich sagen, aber das benutzt du ja schon.
        Naja ich habe ehrlich gesagt keine Lust knapp 330Zeilen JS-Code zu lesen...
        "My software never has bugs, it just develops random features."
        "Real programmers don't comment. If it was hard to write, it should be hard to understand!"

        Kommentar


        • #5
          Hallo Dlab,

          mit den Informationen über dein Setup kann so ziemlich keiner eine brauchbare Analyse abgeben. Bitte reviewe deine Vorgehensweise mit dem Hinweis von oben. Falls noch Fragen offen bleiben, hast du nun die Gelegenheit, einen neuen, sauberen und mit reichtlich Informationen bestückten Thread zu eröffnen.

          [MOD] closed
          Viele Grüße,
          Dr.E.

          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          1. Think about software design before you start to write code!
          2. Discuss and review it together with experts!
          3. Choose good tools (-> Adventure PHP Framework (APF))!
          4. Write clean and reusable software only!
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          Kommentar

          Lädt...
          X