|
| 1 | +# SagaBenchmark |
| 2 | + |
| 3 | +Repository for saga benchmark application. This application mimics a real application and drives a saga workload for various participants. |
| 4 | + |
| 5 | +## Getting started |
| 6 | + |
| 7 | +In order to drive the application, you will need to install Artillery (global installation is recommended). |
| 8 | + |
| 9 | +``` |
| 10 | +npm install -g artillery@latest |
| 11 | +``` |
| 12 | + |
| 13 | +Then install all of the driver dependencies via npm |
| 14 | + |
| 15 | +``` |
| 16 | +npm install |
| 17 | +``` |
| 18 | + |
| 19 | +Set up the connection properties |
| 20 | + |
| 21 | +Copy the template file `application.properties.example` in src/main/resources in the parent module to `application.properties`. Modify the property file to fit your environment. This only needs to be done once. A wallet and tnsnames.ora is required, see https://docs.oracle.com/middleware/1213/wls/JDBCA/oraclewallet.htm#JDBCA598 on how to create a wallet. |
| 22 | + |
| 23 | +Run `mvn clean install` which will copy the properties file as well as build and package each of the applications. |
| 24 | + |
| 25 | +From the root directory, create a `sql` directory, i.e., `mkdir sql` then run `mvn exec:java -pl sqlgenerator`. This will run the sql generator program that will generate all of the necessary sql scripts into the `sql` subdirectory. Modify `setupPDBS.sql` to match your CDB details, specifically, change `<seed_database>` on the `create pluggable database` lines to the value of your seed database. |
| 26 | + |
| 27 | +Copy `initdb.sh.example` to `initdb.sh` and mark it as executable, i.e. `chmod a+x ./initdb.sh` |
| 28 | + |
| 29 | +Modify `initdb.sh` with the correct credentials and connection strings for the environment. To (re)initialize the database, run `./initdb.sh` |
| 30 | + |
| 31 | +**Note**: `sqlplus` is required and must be in your path. |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +From the base directory, run `mvn clean install` to build everything. |
| 36 | + |
| 37 | +**Optional** Copy setenv.sh into the bin folder of the Tomcat directory. This will add some network and JMS tuning as well as add some additional logging. |
| 38 | + |
| 39 | +The application is split into 4 components. The Travel Agency is a WAR that needs to be deployed into a Tomcat 10 container. The Airline and Car applications are standalone Java apps. To start the Airline, run `mvn exec:java` from the airline directory. Similary, to start Car, run `mvn exec:java` from the car directory. |
| 40 | + |
| 41 | +To run the driver, run `npm start` (you may need to run `npm install` first to install the JavaScript dependencies). |
| 42 | + |
| 43 | +This will produce a `report.html` in the same directory which shows the results of the run. |
| 44 | + |
| 45 | +## Benchmark Parameters |
| 46 | + |
| 47 | +### application.properties |
| 48 | + |
| 49 | +* maxStatusWait |
| 50 | + |
| 51 | +The status endpoint will check to see when the original request was sent to create the saga. On each invocation of the status endpoint, it will check the delta between the creation time and now. If that exceeds `maxStatusWait`, the endpoint will return a 504. This parameter is in milliseconds. |
| 52 | + |
| 53 | +* cacheSize |
| 54 | + |
| 55 | +The initial cache size for each of the participants. This cache is used to maintain saga state information during the run such as compensation information. |
| 56 | + |
| 57 | +* queuePartitions |
| 58 | + |
| 59 | +The number of queues to use at each of participants (plus internal infrastructure). |
| 60 | + |
| 61 | +* numOfFlightsToCreate |
| 62 | + |
| 63 | +This property indicates how many flights should be added to the Flights table. This information will be used to create a payload for booking an airline. |
| 64 | + |
| 65 | +### driver.yaml |
| 66 | + |
| 67 | +* statusWait |
| 68 | + |
| 69 | +How long the driver will wait (in seconds) between status checks to see if the saga has completed. |
| 70 | + |
| 71 | +## Misc |
| 72 | + |
| 73 | +### Sample Payload |
| 74 | +``` |
| 75 | +{ |
| 76 | + "flight": { |
| 77 | + "action": "Booking", |
| 78 | + "passengers": [ |
| 79 | + { |
| 80 | + "firstName": "Jack", |
| 81 | + "lastName": "Frost", |
| 82 | + "birthdate": "1992-02-10", |
| 83 | + "gender": "F", |
| 84 | + "email": "sbt@yahoo.com", |
| 85 | + "phonePrimary": "949-767-9979", |
| 86 | + "flightId": "1", |
| 87 | + "seatType": "ECONOMY_SEATS", |
| 88 | + "seatNumber": "23A" |
| 89 | + }, |
| 90 | + { |
| 91 | + "firstName": "Sam", |
| 92 | + "lastName": "Frost", |
| 93 | + "birthdate": "1990-08-30", |
| 94 | + "gender": "M", |
| 95 | + "email": "snua@yahoo.com", |
| 96 | + "phonePrimary": "949-767-9967", |
| 97 | + "flightId": "1", |
| 98 | + "seatType": "ECONOMY_SEATS", |
| 99 | + "seatNumber": "23B" |
| 100 | + } |
| 101 | + ] |
| 102 | + }, |
| 103 | + "car": { |
| 104 | + "action": "Booking", |
| 105 | + "customer": "John Case", |
| 106 | + "phone": "898-908-9080", |
| 107 | + "driversLicense": "B189391", |
| 108 | + "birthdate": "1976-03-04", |
| 109 | + "startDate": "2022-04-05", |
| 110 | + "endDate": "2022-04-15", |
| 111 | + "carType": "Van" |
| 112 | + } |
| 113 | +} |
| 114 | +``` |
0 commit comments