| page 1 · pdf fileproof of concept for parallelization in abap-oo | page 13 | ck •...

32
www.peter-lacke.com | Page 1

Upload: vantram

Post on 13-Feb-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

www.peter-lacke.com | Page 1

Page 2: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

www.peter-lacke.com | Page 2

About us

Page 3: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

HISTORY AND PHILOSOPHY

• PETER/LACKE is a customer-focused, medium sized group of companies

• 110 years of experience in the development and production of high quality coating systems

• direct and professional communication with our customers

• global network with wholly-owned subsidiaries and partners in numerous countries

www.peter-lacke.com | Page 3

A PIONEERING SPIRIT AND FLEXIBILITY BASED ON TRADITION

Page 4: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

About us…

www.peter-lacke.com | Page 4

35,1 €

37,4 €

33,8 €

40,9 €

50,8 €

56,3 €

61,9 €

66,6 €

73,0 €

249 252

286

336

373

390

359

407

427

0

50

100

150

200

250

300

350

400

450

30,0 €

35,0 €

40,0 €

45,0 €

50,0 €

55,0 €

60,0 €

65,0 €

70,0 €

75,0 €

80,0 €

2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016

Emp

loye

es

Turn

ove

r in

Mio

. €

Jahre

Turnover & No of employees

Page 5: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

www.peter-lacke.com | Page 5

LOCATIONS

Page 6: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

www.peter-lacke.com | Page 6

Locations

PETER/LACKE Germany, Hiddenhausen

PETER/LACKE USA, Troy, MI

PETER/LACKE Russia, Moskau

PETER/LACKE Hungary, Székesfehérvár

PETER/LACKE India, Navi Mumbai

PETER/LACKE Mexico, Querétaro

PETER/LACKE USA, Vista, CA

PETER/LACKE Poland, Wroclaw

PETER/LACKE Turkey, Istanbul

PETER/LACKE China, Shanghai

Page 7: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

AUTOMOTIVE

www.peter-lacke.com | Page 7

INNOVATIVE COATINGS

• primers

• contrast paints

• effect paints

• brilliant Galvano paints

• decorative paints

• clear paints

• haptic paints

Page 8: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

CE/DAP

• perfect, aesthetically pleasing surface

• coating systems with an endless variety ofdesigns

• optimum resilience on very demanding substrates

www.peter-lacke.com | Page 8

COMMERCIAL COATING SYSTEMS

Page 9: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

www.peter-lacke.com | Page 9

GENERAL PLASTICS

MAXIMUM RESILIENCE

• medical supplies

• toys

• cosmetics packaging

• mannequins

• home & garden

Page 10: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

GLASS

• glass shows style-consciousness and communicates the preciousness of its contents

• new technological standards when it comes to coatings for glass

• the design developments in the area of perfume bottles are internationally unique and well-established on the market

www.peter-lacke.com | Page 10

CREATIVE COATING SYSTEMS

Page 11: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

SPORTS & LEISURE

• the main requirements a finish must meet are protection and design

• the finish must therefore not have an adverse effect on the protective properties of the substrate, or damage the substrate in any way

• yet it must also meet consumer expectations when it comes to design

www.peter-lacke.com | Page 11

STRONG FINISHES

Page 12: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

www.peter-lacke.com | Page 12

Serialize ABAP OO instances

Page 13: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Proof of concept for parallelization in ABAP-OO

www.peter-lacke.com | Page 13 | CK

• Altough we getting an incredible speed boost by using SAP HANA, sometimes databasespeed is not the bottleneck.

• Parallelization of ABAP code is not very common.

• The FM are marked as released in SM37

• The possibility exists for years (eg. FM SPBT_INITIALIZE, which is used, was released in1996 already)

• SAP themselves using this technic for example in SGEN loads and MRP

• Parallelization can shorten runtime, but is stressing database and application server

Page 14: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Side view „Serialization“ ABAP-OO

www.peter-lacke.com | Page 14 | CK

In computer science, in the context of data storage, serialization is theprocess of translating data structures or object state into a format that canbe stored (for example, in a file or memory buffer, or transmitted acrossa network connection link) and reconstructed later in the same or anothercomputer environment.

Source: https://en.wikipedia.org/wiki/Serialization

Page 15: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Side view „Serialization“ ABAP-OO

www.peter-lacke.com | Page 15 | CK

How does it work…

• Enhance your ABAP class (global or local) with Interface “if_serializable_object“.

• No additional code is needed inside the ABAP class.

• Code Example for a consumer report:

http://www.tricktresor.de/blog/serialize-me/

DATA: o_land TYPE REF TO zcl_country,

ser TYPE string.

o_land = NEW #( land1 = l_county ).

o_land->do_something( ).

CALL TRANSFORMATION id

SOURCE model = o_land

RESULT XML ser.

Create variable for instance and

serialization string

Get instance of class and run methods

Serialize all attributes into XML-

String

Use cl_abap_gzip=>compress_textto compress data to xstring if needed.

Page 16: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Side view „De-Serialization“ ABAP-OO

www.peter-lacke.com | Page 16 | CK

Convert back your XML to another instance of your class…

http://www.tricktresor.de/blog/serialize-me/

DATA: o_land2 TYPE REF TO zcl_country.

CALL TRANSFORMATION id

SOURCE XML ser

RESULT model = o_land2.

Create variable for new instance

De-Serialize all attributes from XML-

String

o_land2 = NEW #( land1 = l_county ).

o_land2->do_something_different( ).

Get new instance of class and run

methods

Page 17: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

www.peter-lacke.com | Page 17

Parallelization ofABAP Code

Page 18: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

The „EVA“ Principle (IPO model)

www.peter-lacke.com | Page 18 | CK

E

V

A

Input

Processing

Output

Example of advanced programming technic

The input–process–output (IPO) model, or input-process-output pattern, is a widely used approach in system analysis and software engineering for describing the structure of an information processing program or other process.

https://en.wikipedia.org/wiki/IPO_model

Page 19: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

The Processing – the usual way

www.peter-lacke.com | Page 19 | CK

VProcessing

Example of advanced programming techniques

Calculate

Next-Record

Calculate

Calculate

The program runsequentialy through theoperations, altoughthere is no dependencybetween thecalculation.Eg: Special MRP processes

Next-Record

Next-Record

Page 20: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

The Processing – the parallel way

www.peter-lacke.com | Page 20 | CK

VProcessing

Example of advanced programming techniques

Calculate

Record 1

Calculate

Record 2

Calculate

Record 3

Initiateparallel run

Wait all tobe finished

Requirement: The parallel runningsteps are independent to each other.In ABAP, the parallel running steps aredone by using a function module.

Page 21: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

The Cookbook

www.peter-lacke.com | Page 21 | CK

Example of advanced programming techniques

To run parallel ABAP-Code, the following steps are needed:

• Create a logon group in RZ12 for parallel processing (administrative task, must be done in each system)

• Determine, how many jobs can run parallel• Call parallel running function module with your code as new task• Getting FM results in a call back subroutine• Check all tasks are finished.• Continue processing of program

Page 22: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Logon Group tcode RZ12

www.peter-lacke.com | Page 22 | CK

Example of advanced programming techniques

Create a new „Logon Group“ in RZ12. This must be done once in each system. You can also reuse an exisiting one

The logon group (here: parallel_generator) is case sensitive

Page 23: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Logon Group tcode RZ12

www.peter-lacke.com | Page 23 | CK

Example of advanced programming techniques

The entries are self explaining. Older NW Stack (up to 7.4?) offers „Min Anz.freie WP“, whichcontrolls, how many workprocesses will be untouched forgeneral use by the system.

Page 24: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Walk through the easy example program

www.peter-lacke.com | Page 24 | CK

Example of advanced programming techniques

Declaration of some variables which are needed later on.

LOAD-OF-PROPRAM.

DATA: g_group TYPE rzllitab-classname VALUE ‘parallel_generators',

g_wp_available TYPE i, "Number of dialog work processes

g_snd_jobs TYPE i VALUE 1, "Work packets sent for processing

g_rcv_jobs TYPE i VALUE 1, "Work packet replies received.

g_taskname(4) TYPE n VALUE 1. "identifier of task

Page 25: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Walk through the easy example program

www.peter-lacke.com | Page 25 | CK

Example of advanced programming techniques

DATA l_msg TYPE char80 VALUE space.

* Initialize the "Parallel Background Tasks" enviroment

CALL FUNCTION 'SPBT_INITIALIZE'

EXPORTING

group_name = g_group

IMPORTING

free_pbt_wps = g_wp_available.

WRITE: / 'No of max. parallel jobs:'(001), g_wp_available.

* Loop the itab (5 values) and run the worker method parallel in separate tasks

LOOP AT git_data ASSIGNING FIELD-SYMBOL(<fs>).

CALL FUNCTION 'Z_RFC_PARALLEL'

STARTING NEW TASK <fs>-key " will be taskname in return_info

DESTINATION IN GROUP g_group

PERFORMING z_rfc_parallel_return ON END OF TASK

EXPORTING

pi_time = <fs>-time

EXCEPTIONS

communication_failure = 1 MESSAGE l_msg

system_failure = 2 MESSAGE l_msg

resource_failure = 3 .

IF sy-subrc NE 0.

WRITE: / l_msg.

EXIT.

ENDIF.

ADD 1 TO g_snd_jobs. " Increment no. of started jobs

get the max number of usable work processes of logon group

Call FM as new task. Important: return_info is the subroutine which is called at the end of the task

Page 26: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Walk through the easy example programThe RFC-FM to call

www.peter-lacke.com | Page 26 | CK

Example of advanced programming techniques

FUNCTION z_rfc_parallel.

*"----------------------------------------------------------------------

*"*"Lokale Schnittstelle:

*" IMPORTING

*" VALUE(PI_TIME) TYPE I

*" EXPORTING

*" VALUE(PE_STRING) TYPE STRING

*"----------------------------------------------------------------------

* Create instanz and run the costy method

DATA(lo_myclass) = NEW zcl_parallel_demo( ).

lo_myclass->worker( pi_time = pi_time ).

* Serialize instance to string.

CALL TRANSFORMATION id

SOURCE model = lo_myclass

RESULT XML pe_string.

ENDFUNCTION.

Page 27: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Walk through the easy example programThe call back routine

www.peter-lacke.com | Page 27 | CK

Example of advanced programming techniques

##PERF_NO_TYPE

FORM z_rfc_parallel_return USING taskname. "do not use 'type xxxx' here.

DATA: l_string TYPE string,

l_msg TYPE char80 VALUE space.

* Import the FM export parameters (here: serialized instance)

RECEIVE RESULTS FROM FUNCTION 'Z_RFC_PARALLEL'

IMPORTING pe_string = l_string

EXCEPTIONS

communication_failure = 1 MESSAGE l_msg

system_failure = 2 MESSAGE l_msg

resource_failure = 3 .

IF sy-subrc EQ 0.

ADD 1 TO g_rcv_jobs. " Increment no. of received jobs

READ TABLE git_data WITH KEY key = taskname ASSIGNING FIELD-SYMBOL(<fs>).

IF sy-subrc EQ 0.

CALL TRANSFORMATION id " Deserialize string to instance

SOURCE XML l_string

RESULT model = <fs>-o_class.

ELSE.

WRITE: / l_msg.

EXIT.

ENDIF.

ENDIF.

ENDFORM.

Page 28: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Example program serial run

Page 29: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Example program Parallel

Page 30: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Runtime comparisons

Worker Serial Parallel

Wait up to n seconds 13,1 sec 5,1 sec

Test code as shownin example

23,7 sec 14,1 sec

Special MRP (Inhousedevelopment)

> More than 50 min, caused shortdump

Approx. 8 min

git_data = VALUE #( ( key = 'A' time = 3 )

( key = 'B' time = 1 )

( key = 'C' time = 2 )

( key = 'D' time = 5 )

( key = 'E' time = 2 ) ).

Page 31: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

Example code

The example code can be found here:https://www.dropbox.com/sh/acdyfiecqwoc0db/AAAbZFW7P8MWdzl9zz0gpYtMa?dl=0

Page 32: | Page 1 · PDF fileProof of concept for parallelization in ABAP-OO   | Page 13 | CK • Altough we getting an incredible speed boost by using SAP HANA, sometimes database

THANKS FOR LISTENING.