Skip to Content
avatar image
-1
Former Member

Performance Problem

Hallo,

einer unserer Reports zeigt ein sehr schlechtes Performance-Verhalten. Ich selektiere aus einem eigenen Infotyp einige Datensätze. Danach erfolgt ein Loop über diese interne Tabelle und der jeweilige Datensatz wird verarbeitet. Für jeden Datensatz erzeuge ich ein lokales Objekt und rufe eine dort zugehörige Methode auf, die diverse Berechnungen durchführt und die Ergebnisse an das rufende Programm zurückgibt.

Folgendes Problem: Die ersten x Berechnungen laufen alle wunderbar schnell, nach einer unbestimmten Zeit verlangsamt sich das Antwortzeitverhalten aber eklatant. Eine Berechnung dauert dann z.B. 400 Sekunden, wird diese solo über den selben Report ausgeführt dauert die Berechnung 12 Sekunden. Es scheint so, als ob irgendwelche Puffer volllaufen? Ich habe auch schon versucht nach jedem Datensatz ein COMMIT WORK abzusetzen, das bringt aber keine Performanceverbesserung.

Hat jemand vielleicht eine Idee woran das liegen könnte.

Viele Grüße

Stefan

Add comment
10|10000 characters needed characters exceeded

  • Former Member

    1. Select main data from custom IT

      SELECT * FROM pa9031 INTO TABLE gt_pa9031 WHERE subty           =  '0002'
                                                  AND letzter_arb_tag GE sy-datum
                                                  AND pernr           IN s_pernr.
    
      SORT gt_pa9031 BY pernr ASCENDING
                        aedtm DESCENDING
                        seqnr DESCENDING.
    
      DELETE ADJACENT DUPLICATES FROM gt_pa9031 COMPARING pernr.

    2. Create instance and get data for each table entry

      LOOP AT gt_pa9031 ASSIGNING <fs_pa9031>.
        CALL FUNCTION 'RH_CLEAR_BUFFER'.
    
        CREATE OBJECT lr_pernr
          EXPORTING
            iv_bem = p_bem
            iv_upd = p_upd.
    
        CLEAR ls_data.
        lr_pernr->recalc_data( EXPORTING is_pa9031 = <fs_pa9031>
                               IMPORTING es_data   = ls_data ) .
    
        APPEND ls_data TO gt_data.
        FREE lr_pernr.
      ENDLOOP.

    3. Display data via ALV OM.

    In first version I create only one instance, the data select was managed by this object. But this was more slowly than the one above.

    How I said, the starting recalculations are very quick but after unsettled time the data select gets very very slow.

  • Does recalc_data use access any static attributes of the class (or any class), or does it call a function module that's not getting its global data reset?

    An algorithm can be O(x^n) and do fine for up to e.g. 10'000 records, then rapidly degrade above that. Everything is determined by your calculation and your data structures.

  • Former Member

    Thx for answer. Recalc_data is an instance method. Within this method only other private methods are called. Code review from far is difficult, I am aware. I dont know that the code completely is bad cause single recalcs are verry speedy. I am fear that the speed brokes due to the amount of data selection. So I try to free memory, but without godd result. Maybe a buffer problem? Or a calendar problem, we open it till 2098.

  • Get RSS Feed

2 Answers

  • Feb 26 at 02:29 PM

    When it is running slowly, go to SM50 and debug. It might all become clear then.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 26 at 09:37 AM

    Some things to look at:

    Does it slow after a similar number each time?

    Does it slow down at the same point with different datasets? E.g. if you determines it slows around 8000 records will it do so regardless of sort order.

    Take memory snapshots during fast and slow phases and compare. As Matthew already indicated, something might be hanging around or accumulating in a static attribute.

    Add comment
    10|10000 characters needed characters exceeded