# Express app sample for perfomance runs

This is a sample expressjs application intended to run
with jmeter in order to collect metrics related to api
performance and memory. (Only thick mode).

The same app was used against the following oracledb
versions and their throughput performance is recorded.

## TOC

- [How to run?](#how-to-run)
  - [1. Fix on the version of oracledb.](#1-fix-on-the-version-of-oracledb)
  - [2. Seed the database.](#2-seed-the-database)
  - [3. Configure app for data access.](#3-configure-app-for-data-access)
  - [4. Running express app server](#4-running-express-app-server)
  - [5. Setting up jmeter](#5-setting-up-jmeter)
  - [6. Run jmeter and collect reports](#6-run-jmeter-and-collect-reports)

## How to run

### 1. Fix on the version of oracledb. 


(This zip is set for oracledb@5.5.0). 

E.g.

`npm install oracledb@6.7.0`

### 2. Seed the database.

Run queries inside file `sql/data.sql`. This will create
tables and insert some seed data into table.

### 3. Configure app for data access.

Edit `utils.js` file; enter database info and credentials

### 4. Running express app server

> ensure oracle instant client binaries are
property installed for your os

`node .`

App runs on port 3000

### 5. Setting up jmeter

Download and install jmeter to some path
in your filesystem. For this exercise 
we are assuming that both jmeter and the app
are on the same computer.

Files: 

1. `jmeter/oracle-express-test.jmx`
2. `jmeter/config.properties`

You need the following plugins

```
jmeter-plugins-casutg-3.0.jar
jmeter-plugins-csvars-0.2.jar
jmeter-plugins-ffw-2.0.jar
jmeter-plugins-fifo-0.2.jar
jmeter-plugins-functions-2.2.jar
jmeter-plugins-graphs-basic-2.0.jar
jmeter-plugins-perfmon-2.1.jar
jmeter-plugins-tst-2.6.jar
jmeter-prometheus-plugin-0.6.0.jar
```
These need to be installed in the following path:

`$JMETER_HOME/lib/ext`

Configure the properties required for run such as 
`loopSize` and `concurrency`. Replace `config.properties` 
with custom values along side the jmx file

E.g.

```
hostname=localhost
port=3000
productsUrl=/api/Products
concurrency=2
loopSize=2
```

### 6. Run jmeter and collect reports

Run jmeter

Post the load test it will provide 2 reports

- summary
- aggregation

